diff --git a/cmd/config.go b/cmd/config.go index 81f3f7a..a0be6d8 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -20,6 +20,7 @@ type Config struct { Kafka KafkaConfig `yaml:"kafka"` Zookeeper ZookeeperConfig `yaml:"zookeeper"` Redis RedisConfig `yaml:"redis"` + Utapi UtapiConfig `yaml:"utapi"` } type GlobalConfig struct { @@ -30,6 +31,7 @@ type GlobalConfig struct { type FeatureConfig struct { Scuba ScubaFeatureConfig `yaml:"scuba"` BucketNotifications BucketNotificationsFeatureConfig `yaml:"bucket_notifications"` + Utapi UtapiFeatureConfig `yaml:"utapi"` } type ScubaFeatureConfig struct { @@ -46,6 +48,10 @@ type BucketNotificationsFeatureConfig struct { } `yaml:"destinationAuth"` } +type UtapiFeatureConfig struct { + Enabled bool `yaml:"enabled"` +} + type CloudserverConfig struct { Image string `yaml:"image"` EnableNullVersionCompatMode bool `yaml:"enableNullVersionCompatMode"` @@ -62,6 +68,11 @@ type VaultConfig struct { LogLevel string `yaml:"log_level"` } +type UtapiConfig struct { + Image string `yaml:"image"` + LogLevel string `yaml:"log_level"` +} + type VFormat string func (vf VFormat) String() string { @@ -160,6 +171,9 @@ func DefaultConfig() Config { Type: "none", }, }, + Utapi: UtapiFeatureConfig{ + Enabled: false, + }, }, Cloudserver: CloudserverConfig{}, S3Metadata: MetadataConfig{ @@ -185,6 +199,7 @@ func DefaultConfig() Config { RaftSessions: 1, // LogLevel: "info", }, + Utapi: UtapiConfig{}, } } diff --git a/cmd/configure.go b/cmd/configure.go index 7e27aec..7f543aa 100644 --- a/cmd/configure.go +++ b/cmd/configure.go @@ -48,6 +48,7 @@ func configureEnv(cfg Config, envDir string) error { generateS3MetadataConfig, generateScubaMetadataConfig, generateKafkaConfig, + generateUtapiConfig, } configDir := filepath.Join(envDir, "config") @@ -132,3 +133,7 @@ func generateKafkaConfig(cfg Config, path string) error { return renderTemplates(cfg, "templates/kafka", filepath.Join(path, "kafka"), templates) } + +func generateUtapiConfig(cfg Config, path string) error { + return renderTemplateToFile(getTemplates(), "templates/utapi/config.json", cfg, filepath.Join(path, "utapi", "config.json")) +} diff --git a/cmd/util.go b/cmd/util.go index 91f950b..59074f5 100644 --- a/cmd/util.go +++ b/cmd/util.go @@ -71,6 +71,10 @@ func getComposeProfiles(cfg Config) []string { profiles = append(profiles, "feature-notifications") } + if cfg.Features.Utapi.Enabled { + profiles = append(profiles, "feature-utapi") + } + return profiles } diff --git a/templates/cloudserver/config.json b/templates/cloudserver/config.json index 32f2083..858780f 100644 --- a/templates/cloudserver/config.json +++ b/templates/cloudserver/config.json @@ -97,5 +97,20 @@ {{ else }} "bucketNotificationDestinations": [], {{ end }} + {{ if .Features.Utapi.Enabled }} + "localCache": { + "host": "localhost", + "port": 6379 + }, + "utapi": { + "host": "localhost", + "port": 8100, + "workers": 1, + "redis": { + "host": "localhost", + "port": 6379 + } + }, + {{ end }} "testingMode": true } diff --git a/templates/global/config.yaml b/templates/global/config.yaml index 5c5bb5e..216f7a1 100644 --- a/templates/global/config.yaml +++ b/templates/global/config.yaml @@ -13,6 +13,9 @@ features: username: admin password: admin123 + utapi: + enabled: false + cloudserver: image: ghcr.io/scality/cloudserver:7.70.62 @@ -39,3 +42,6 @@ zookeeper: redis: image: redis:7 + +utapi: + image: ghcr.io/scality/utapi:7.70.7 diff --git a/templates/global/defaults.env b/templates/global/defaults.env index eb028fe..53f79e4 100644 --- a/templates/global/defaults.env +++ b/templates/global/defaults.env @@ -7,6 +7,7 @@ CLOUDSERVER_IMAGE="{{ .Cloudserver.Image }}" VAULT_IMAGE="{{ .Vault.Image }}" SCUBA_IMAGE="{{ .Scuba.Image }}" BACKBEAT_IMAGE="{{ .Backbeat.Image }}" +UTAPI_IMAGE="{{ .Utapi.Image }}" METADATA_S3_DB_VERSION="{{ .S3Metadata.VFormat }}" CLOUDSERVER_ENABLE_NULL_VERSION_COMPAT_MODE="{{ .Cloudserver.EnableNullVersionCompatMode }}" diff --git a/templates/global/docker-compose.yaml b/templates/global/docker-compose.yaml index a680b81..e1348ec 100644 --- a/templates/global/docker-compose.yaml +++ b/templates/global/docker-compose.yaml @@ -142,6 +142,7 @@ services: profiles: - feature-crr - feature-notifications + - feature-utapi zookeeper: build: @@ -219,3 +220,15 @@ services: - feature-notifications volumes: - ./config/kafka/config.properties:/opt/kafka/config/config.properties:ro + + utapi: + profiles: + - feature-utapi + image: ${UTAPI_IMAGE} + container_name: workbench-utapi + network_mode: host + command: ["bash", "-c", "yarn start"] + volumes: + - ./config/utapi/config.json:/conf/config.json:ro + environment: + UTAPI_CONFIG_FILE: /conf/config.json diff --git a/templates/utapi/config.json b/templates/utapi/config.json new file mode 100644 index 0000000..ff3431d --- /dev/null +++ b/templates/utapi/config.json @@ -0,0 +1,21 @@ +{ + "port": 8100, + "workers": 10, + "healthChecks": { + "allowFrom": ["127.0.0.1/8", "::1"] + }, + "log": { + "logLevel": "info", + "dumpLevel": "error" + }, + "redis": { + "host": "127.0.0.1", + "port": 6379 + }, + "vaultd": { + "host": "127.0.0.1", + "port": 8500 + }, + "expireMetrics": false, + "expireMetricsTTL": 0 +}