diff --git a/cmd/helpers_values.go b/cmd/helpers_values.go index 845a8efa..8f6909e4 100644 --- a/cmd/helpers_values.go +++ b/cmd/helpers_values.go @@ -240,16 +240,17 @@ func composeToServiceValues(lYAML *lagoon.YAML, lagoonValues *lagoon.BuildValues } } } - lagoonTypeName := lagoon.CheckServiceLagoonLabel(csValues.Labels, "lagoon.name") - if lagoonTypeName != "" { - if lagoonTypeName != csName { - // if there is a lagoon.name label on a service, then this service does not need an autogenerated route - // as it is likely an ancillary pod for another service (the one in the `lagoon.name` label :)) - autogenEnabled = false + lagoonOverrideName := lagoon.CheckServiceLagoonLabel(csValues.Labels, "lagoon.name") + if lagoonOverrideName != "" { + for _, service := range lagoonValues.Services { + if service.OverrideName == lagoonOverrideName { + autogenEnabled = false + } } } cService := lagoon.ServiceValues{ Name: csName, + OverrideName: lagoonOverrideName, Type: lagoonType, AutogeneratedRoutesEnabled: autogenEnabled, AutogeneratedRoutesTLSAcme: autogenTLSAcmeEnabled, diff --git a/cmd/identify_ingress_test.go b/cmd/identify_ingress_test.go index 4682e82d..6d724f83 100644 --- a/cmd/identify_ingress_test.go +++ b/cmd/identify_ingress_test.go @@ -385,6 +385,28 @@ func TestIdentifyRoute(t *testing.T) { wantautoGen: []string{"https://nginx-sales-customer-support-develop.ex1.example-web.com"}, wantJSON: `{"primary":"https://nginx-sales-customer-support-develop.ex1.example-web.com","secondary":["https://nginx-sales-customer-support-develop.ex1.example-web.com"],"autogenerated":["https://nginx-sales-customer-support-develop.ex1.example-web.com"]}`, }, + { + name: "test16 autogenerated routes where lagoon.name of service does not match service names", + args: args{ + alertContact: "alertcontact", + statusPageID: "statuspageid", + projectName: "content-example-com", + environmentName: "feature-migration", + environmentType: "development", + buildType: "branch", + lagoonVersion: "v2.7.x", + branch: "feature/migration", + projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${environment}.${project}.example.com","scope":"internal_system"}]`, + envVars: `[]`, + secretPrefix: "fastly-api-", + lagoonYAML: "../test-resources/identify-ingress/test16/lagoon.yml", + templatePath: "../test-resources/output", + }, + want: "https://nginx-php.feature-migration.content-example-com.example.com", + wantRemain: []string{"https://nginx-php.feature-migration.content-example-com.example.com"}, + wantautoGen: []string{"https://nginx-php.feature-migration.content-example-com.example.com"}, + wantJSON: `{"primary":"https://nginx-php.feature-migration.content-example-com.example.com","secondary":["https://nginx-php.feature-migration.content-example-com.example.com"],"autogenerated":["https://nginx-php.feature-migration.content-example-com.example.com"]}`, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/cmd/template_autogen_ingress.go b/cmd/template_autogen_ingress.go index 9ef2971f..c9b7f206 100644 --- a/cmd/template_autogen_ingress.go +++ b/cmd/template_autogen_ingress.go @@ -80,7 +80,13 @@ func generateAutogenRoutes( // if autogenerated routes are enabled, generate them :) if service.AutogeneratedRoutesEnabled { if helpers.Contains(supportedAutogeneratedTypes, service.Type) { - domain, shortDomain := AutogeneratedDomainFromPattern(lagoonRouterPattern.Value, serviceName) + // use the service name as the servicetype name + serviceOverrideName := serviceName + if service.OverrideName != "" { + // but if a typename is provided by the service, use it instead + serviceOverrideName = service.OverrideName + } + domain, shortDomain := AutogeneratedDomainFromPattern(lagoonRouterPattern.Value, serviceOverrideName) serviceValues := lagoon.ServiceValues{ AutogeneratedRouteDomain: domain, ShortAutogeneratedRouteDomain: shortDomain, @@ -112,12 +118,12 @@ func generateAutogenRoutes( "lagoon.sh/autogenerated": "true", "helm.sh/chart": fmt.Sprintf("%s-%s", "autogenerated-ingress", "0.1.0"), "app.kubernetes.io/name": "autogenerated-ingress", - "app.kubernetes.io/instance": serviceName, - "lagoon.sh/service": serviceName, + "app.kubernetes.io/instance": serviceOverrideName, + "lagoon.sh/service": serviceOverrideName, "lagoon.sh/service-type": service.Type, }, - Service: serviceName, - IngressName: serviceName, + Service: serviceOverrideName, + IngressName: serviceOverrideName, Insecure: &insecure, AlternativeNames: alternativeNames, } diff --git a/cmd/template_autogen_ingress_test.go b/cmd/template_autogen_ingress_test.go index de50e89a..c7054491 100644 --- a/cmd/template_autogen_ingress_test.go +++ b/cmd/template_autogen_ingress_test.go @@ -434,6 +434,26 @@ func TestAutogeneratedIngressGeneration(t *testing.T) { emptyDir: false, want: "../test-resources/template-autogenerated/test19-results", }, + { + name: "test20 autogenerated routes where lagoon.name of service does not match service names", + args: args{ + alertContact: "alertcontact", + statusPageID: "statuspageid", + projectName: "content-example-com", + environmentName: "feature-migration", + environmentType: "development", + buildType: "branch", + lagoonVersion: "v2.7.x", + branch: "feature/migration", + projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${environment}.${project}.example.com","scope":"internal_system"}]`, + envVars: `[]`, + secretPrefix: "fastly-api-", + lagoonYAML: "../test-resources/template-autogenerated/test20/lagoon.yml", + templatePath: "../test-resources/template-autogenerated/output", + }, + emptyDir: false, + want: "../test-resources/template-autogenerated/test20-results", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/cmd/template_ingress_test.go b/cmd/template_ingress_test.go index 7f97457c..c8d8bd17 100644 --- a/cmd/template_ingress_test.go +++ b/cmd/template_ingress_test.go @@ -229,6 +229,25 @@ func TestTemplateRoutes(t *testing.T) { }, want: "../test-resources/template-ingress/test10-results", }, + { + name: "test10 standby no values", + args: args{ + alertContact: "alertcontact", + statusPageID: "statuspageid", + projectName: "content-example-com", + environmentName: "production", + environmentType: "production", + buildType: "branch", + lagoonVersion: "v2.7.x", + branch: "production", + projectVars: `[{"name":"LAGOON_SYSTEM_ROUTER_PATTERN","value":"${environment}.${project}.example.com","scope":"internal_system"}]`, + envVars: `[]`, + secretPrefix: "fastly-api-", + lagoonYAML: "../test-resources/template-ingress/test11/lagoon.yml", + templatePath: "../test-resources/template-ingress/output", + }, + want: "../test-resources/template-ingress/test11-results", + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/internal/lagoon/buildvalues.go b/internal/lagoon/buildvalues.go index 31d5ce59..d213981d 100644 --- a/internal/lagoon/buildvalues.go +++ b/internal/lagoon/buildvalues.go @@ -40,7 +40,8 @@ type BuildValues struct { // ServiceValues is the values for a specific service used by a lagoon build type ServiceValues struct { - Name string `json:"name"` + Name string `json:"name"` // this is the actual compose service name + OverrideName string `json:"overrideName"` // if an override name is provided, use it Type string `json:"type"` AutogeneratedRoutesEnabled bool `json:"autogeneratedRoutesEnabled"` AutogeneratedRoutesTLSAcme bool `json:"autogeneratedRoutesTLSAcme"` diff --git a/test-resources/identify-ingress/test16/docker-compose.yml b/test-resources/identify-ingress/test16/docker-compose.yml new file mode 100644 index 00000000..946ec1b0 --- /dev/null +++ b/test-resources/identify-ingress/test16/docker-compose.yml @@ -0,0 +1,146 @@ +version: '2.3' + +x-example-image-version: + &example-image-version ${EXAMPLE_IMAGE_VERSION:-4.x} + +x-project: + &project ${PROJECT_NAME:-mysite} + +x-volumes: + &default-volumes + volumes: + - .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + - ./docroot/sites/default/files:/app/docroot/sites/default/files:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + +x-environment: + &default-environment + LAGOON_PROJECT: *project + DRUPAL_HASH_SALT: fakehashsaltfakehashsaltfakehashsalt + LAGOON_LOCALDEV_URL: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + LAGOON_ROUTE: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + GITHUB_TOKEN: ${GITHUB_TOKEN:-} + EXAMPLE_KEY: ${EXAMPLE_KEY:-} + EXAMPLE_IMAGE_VERSION: ${EXAMPLE_IMAGE_VERSION:-latest} + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} + DRUPAL_REFRESH_SEARCHAPI: ${DRUPAL_REFRESH_SEARCHAPI:-} + EXAMPLE_INGRESS_PSK: ${EXAMPLE_INGRESS_PSK:-} + EXAMPLE_INGRESS_HEADER: ${EXAMPLE_INGRESS_HEADER:-} + EXAMPLE_INGRESS_ENABLED: ${EXAMPLE_INGRESS_ENABLED:-} + REDIS_CACHE_PREFIX: "tide_" + DB_ALIAS: ${DB_ALIAS:-bay.production} + + +services: + + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + args: + COMPOSER: ${COMPOSER:-composer.json} + EXAMPLE_IMAGE_VERSION: *example-image-version + image: *project + environment: + << : *default-environment + << : *default-volumes + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + labels: + lagoon.type: cli-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.name: nginx-php + lagoon.persistent.size: 5Gi + + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + << : *default-volumes + environment: + << : *default-environment + depends_on: + - cli + networks: + - amazeeio-network + - default + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + expose: + - "8080" + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + + mariadb: + image: amazeeio/mariadb-drupal + environment: + << : *default-environment + ports: + - "3306" # Find port on host with `ahoy info` or `docker-compose port mariadb 3306` + labels: + lagoon.type: mariadb-shared + + redis: + image: amazeeio/redis + labels: + lagoon.type: redis + + elasticsearch: + build: + context: . + dockerfile: .docker/Dockerfile.elasticsearch + args: + - ES_TPL=${ES_TPL:-elasticsearch.yml} + environment: + - discovery.type=single-node + labels: + lagoon.type: none + + chrome: + image: selenium/standalone-chrome:3.141.59-oxygen + shm_size: '1gb' + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: none + + clamav: + image: clamav/clamav:${EXAMPLE_IMAGE_VERSION:-4.x} + environment: + << : *default-environment + ports: + - "3310" + labels: + lagoon.type: none + + +networks: + amazeeio-network: + external: true + +volumes: + app: {} + files: {} \ No newline at end of file diff --git a/test-resources/identify-ingress/test16/lagoon.yml b/test-resources/identify-ingress/test16/lagoon.yml new file mode 100644 index 00000000..31b68477 --- /dev/null +++ b/test-resources/identify-ingress/test16/lagoon.yml @@ -0,0 +1,46 @@ +--- +docker-compose-yaml: ../test-resources/template-autogenerated/test20/docker-compose.yml + +project: content-example-com + +environments: + production: + cronjobs: + - name: drush cron + schedule: "*/15 * * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "content.example.com": + monitoring-path: "/api/v1" + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + master: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "master.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + develop: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "develop.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 \ No newline at end of file diff --git a/test-resources/template-autogenerated/test20-results/nginx-php.yaml b/test-resources/template-autogenerated/test20-results/nginx-php.yaml new file mode 100644 index 00000000..108d61b3 --- /dev/null +++ b/test-resources/template-autogenerated/test20-results/nginx-php.yaml @@ -0,0 +1,45 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + fastly.amazee.io/watch: "false" + ingress.kubernetes.io/ssl-redirect: "false" + kubernetes.io/tls-acme: "true" + lagoon.sh/branch: feature/migration + lagoon.sh/version: v2.7.x + nginx.ingress.kubernetes.io/server-snippet: | + add_header X-Robots-Tag "noindex, nofollow"; + nginx.ingress.kubernetes.io/ssl-redirect: "false" + creationTimestamp: null + labels: + app.kubernetes.io/instance: nginx-php + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: autogenerated-ingress + helm.sh/chart: autogenerated-ingress-0.1.0 + lagoon.sh/autogenerated: "true" + lagoon.sh/buildType: branch + lagoon.sh/environment: feature-migration + lagoon.sh/environmentType: development + lagoon.sh/project: content-example-com + lagoon.sh/service: nginx-php + lagoon.sh/service-type: nginx-php-persistent + name: nginx-php +spec: + rules: + - host: nginx-php.feature-migration.content-example-com.example.com + http: + paths: + - backend: + service: + name: nginx-php + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - nginx-php.feature-migration.content-example-com.example.com + secretName: nginx-php-tls +status: + loadBalancer: {} diff --git a/test-resources/template-autogenerated/test20/docker-compose.yml b/test-resources/template-autogenerated/test20/docker-compose.yml new file mode 100644 index 00000000..946ec1b0 --- /dev/null +++ b/test-resources/template-autogenerated/test20/docker-compose.yml @@ -0,0 +1,146 @@ +version: '2.3' + +x-example-image-version: + &example-image-version ${EXAMPLE_IMAGE_VERSION:-4.x} + +x-project: + &project ${PROJECT_NAME:-mysite} + +x-volumes: + &default-volumes + volumes: + - .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + - ./docroot/sites/default/files:/app/docroot/sites/default/files:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + +x-environment: + &default-environment + LAGOON_PROJECT: *project + DRUPAL_HASH_SALT: fakehashsaltfakehashsaltfakehashsalt + LAGOON_LOCALDEV_URL: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + LAGOON_ROUTE: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + GITHUB_TOKEN: ${GITHUB_TOKEN:-} + EXAMPLE_KEY: ${EXAMPLE_KEY:-} + EXAMPLE_IMAGE_VERSION: ${EXAMPLE_IMAGE_VERSION:-latest} + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} + DRUPAL_REFRESH_SEARCHAPI: ${DRUPAL_REFRESH_SEARCHAPI:-} + EXAMPLE_INGRESS_PSK: ${EXAMPLE_INGRESS_PSK:-} + EXAMPLE_INGRESS_HEADER: ${EXAMPLE_INGRESS_HEADER:-} + EXAMPLE_INGRESS_ENABLED: ${EXAMPLE_INGRESS_ENABLED:-} + REDIS_CACHE_PREFIX: "tide_" + DB_ALIAS: ${DB_ALIAS:-bay.production} + + +services: + + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + args: + COMPOSER: ${COMPOSER:-composer.json} + EXAMPLE_IMAGE_VERSION: *example-image-version + image: *project + environment: + << : *default-environment + << : *default-volumes + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + labels: + lagoon.type: cli-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.name: nginx-php + lagoon.persistent.size: 5Gi + + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + << : *default-volumes + environment: + << : *default-environment + depends_on: + - cli + networks: + - amazeeio-network + - default + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + expose: + - "8080" + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + + mariadb: + image: amazeeio/mariadb-drupal + environment: + << : *default-environment + ports: + - "3306" # Find port on host with `ahoy info` or `docker-compose port mariadb 3306` + labels: + lagoon.type: mariadb-shared + + redis: + image: amazeeio/redis + labels: + lagoon.type: redis + + elasticsearch: + build: + context: . + dockerfile: .docker/Dockerfile.elasticsearch + args: + - ES_TPL=${ES_TPL:-elasticsearch.yml} + environment: + - discovery.type=single-node + labels: + lagoon.type: none + + chrome: + image: selenium/standalone-chrome:3.141.59-oxygen + shm_size: '1gb' + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: none + + clamav: + image: clamav/clamav:${EXAMPLE_IMAGE_VERSION:-4.x} + environment: + << : *default-environment + ports: + - "3310" + labels: + lagoon.type: none + + +networks: + amazeeio-network: + external: true + +volumes: + app: {} + files: {} \ No newline at end of file diff --git a/test-resources/template-autogenerated/test20/lagoon.yml b/test-resources/template-autogenerated/test20/lagoon.yml new file mode 100644 index 00000000..31b68477 --- /dev/null +++ b/test-resources/template-autogenerated/test20/lagoon.yml @@ -0,0 +1,46 @@ +--- +docker-compose-yaml: ../test-resources/template-autogenerated/test20/docker-compose.yml + +project: content-example-com + +environments: + production: + cronjobs: + - name: drush cron + schedule: "*/15 * * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "content.example.com": + monitoring-path: "/api/v1" + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + master: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "master.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + develop: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "develop.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 \ No newline at end of file diff --git a/test-resources/template-ingress/test11-results/content.example.com.yaml b/test-resources/template-ingress/test11-results/content.example.com.yaml new file mode 100644 index 00000000..fe313731 --- /dev/null +++ b/test-resources/template-ingress/test11-results/content.example.com.yaml @@ -0,0 +1,49 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + fastly.amazee.io/watch: "false" + ingress.kubernetes.io/ssl-redirect: "false" + kubernetes.io/tls-acme: "false" + lagoon.sh/branch: production + lagoon.sh/version: v2.7.x + monitor.stakater.com/enabled: "true" + monitor.stakater.com/overridePath: / + nginx.ingress.kubernetes.io/ssl-redirect: "false" + uptimerobot.monitor.stakater.com/alert-contacts: alertcontact + uptimerobot.monitor.stakater.com/interval: "60" + uptimerobot.monitor.stakater.com/status-pages: statuspageid + creationTimestamp: null + labels: + app.kubernetes.io/instance: content.example.com + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: custom-ingress + dioscuri.amazee.io/migrate: "false" + helm.sh/chart: custom-ingress-0.1.0 + lagoon.sh/autogenerated: "false" + lagoon.sh/buildType: branch + lagoon.sh/environment: production + lagoon.sh/environmentType: production + lagoon.sh/project: content-example-com + lagoon.sh/service: content.example.com + lagoon.sh/service-type: custom-ingress + name: content.example.com +spec: + rules: + - host: content.example.com + http: + paths: + - backend: + service: + name: nginx-php + port: + name: http + path: / + pathType: Prefix + tls: + - hosts: + - content.example.com + secretName: content.example.com-tls +status: + loadBalancer: {} diff --git a/test-resources/template-ingress/test11/docker-compose.yml b/test-resources/template-ingress/test11/docker-compose.yml new file mode 100644 index 00000000..946ec1b0 --- /dev/null +++ b/test-resources/template-ingress/test11/docker-compose.yml @@ -0,0 +1,146 @@ +version: '2.3' + +x-example-image-version: + &example-image-version ${EXAMPLE_IMAGE_VERSION:-4.x} + +x-project: + &project ${PROJECT_NAME:-mysite} + +x-volumes: + &default-volumes + volumes: + - .:/app:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + - ./docroot/sites/default/files:/app/docroot/sites/default/files:${VOLUME_FLAGS:-delegated} ### Local overrides to mount host filesystem. Automatically removed in CI and PROD. + +x-environment: + &default-environment + LAGOON_PROJECT: *project + DRUPAL_HASH_SALT: fakehashsaltfakehashsaltfakehashsalt + LAGOON_LOCALDEV_URL: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + LAGOON_ROUTE: ${LOCALDEV_URL:-http://mysite.docker.amazee.io} + GITHUB_TOKEN: ${GITHUB_TOKEN:-} + EXAMPLE_KEY: ${EXAMPLE_KEY:-} + EXAMPLE_IMAGE_VERSION: ${EXAMPLE_IMAGE_VERSION:-latest} + LAGOON_ENVIRONMENT_TYPE: ${LAGOON_ENVIRONMENT_TYPE:-local} + DRUPAL_REFRESH_SEARCHAPI: ${DRUPAL_REFRESH_SEARCHAPI:-} + EXAMPLE_INGRESS_PSK: ${EXAMPLE_INGRESS_PSK:-} + EXAMPLE_INGRESS_HEADER: ${EXAMPLE_INGRESS_HEADER:-} + EXAMPLE_INGRESS_ENABLED: ${EXAMPLE_INGRESS_ENABLED:-} + REDIS_CACHE_PREFIX: "tide_" + DB_ALIAS: ${DB_ALIAS:-bay.production} + + +services: + + cli: + build: + context: . + dockerfile: .docker/Dockerfile.cli + args: + COMPOSER: ${COMPOSER:-composer.json} + EXAMPLE_IMAGE_VERSION: *example-image-version + image: *project + environment: + << : *default-environment + << : *default-volumes + volumes_from: ### Local overrides to mount host SSH keys. Automatically removed in CI. + - container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI. + labels: + lagoon.type: cli-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.name: nginx-php + lagoon.persistent.size: 5Gi + + nginx: + build: + context: . + dockerfile: .docker/Dockerfile.nginx-drupal + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + << : *default-volumes + environment: + << : *default-environment + depends_on: + - cli + networks: + - amazeeio-network + - default + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + expose: + - "8080" + php: + build: + context: . + dockerfile: .docker/Dockerfile.php + args: + CLI_IMAGE: *project + EXAMPLE_IMAGE_VERSION: *example-image-version + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: nginx-php-persistent + lagoon.persistent: /app/docroot/sites/default/files/ + lagoon.persistent.size: 5Gi + lagoon.name: nginx-php + + mariadb: + image: amazeeio/mariadb-drupal + environment: + << : *default-environment + ports: + - "3306" # Find port on host with `ahoy info` or `docker-compose port mariadb 3306` + labels: + lagoon.type: mariadb-shared + + redis: + image: amazeeio/redis + labels: + lagoon.type: redis + + elasticsearch: + build: + context: . + dockerfile: .docker/Dockerfile.elasticsearch + args: + - ES_TPL=${ES_TPL:-elasticsearch.yml} + environment: + - discovery.type=single-node + labels: + lagoon.type: none + + chrome: + image: selenium/standalone-chrome:3.141.59-oxygen + shm_size: '1gb' + environment: + << : *default-environment + << : *default-volumes + depends_on: + - cli + labels: + lagoon.type: none + + clamav: + image: clamav/clamav:${EXAMPLE_IMAGE_VERSION:-4.x} + environment: + << : *default-environment + ports: + - "3310" + labels: + lagoon.type: none + + +networks: + amazeeio-network: + external: true + +volumes: + app: {} + files: {} \ No newline at end of file diff --git a/test-resources/template-ingress/test11/lagoon.yml b/test-resources/template-ingress/test11/lagoon.yml new file mode 100644 index 00000000..31b68477 --- /dev/null +++ b/test-resources/template-ingress/test11/lagoon.yml @@ -0,0 +1,46 @@ +--- +docker-compose-yaml: ../test-resources/template-autogenerated/test20/docker-compose.yml + +project: content-example-com + +environments: + production: + cronjobs: + - name: drush cron + schedule: "*/15 * * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "content.example.com": + monitoring-path: "/api/v1" + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + master: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "master.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 + develop: + cronjobs: + - name: drush cron + schedule: "0 1,4 * * *" + command: 'drush cron' + service: cli + + routes: + - nginx-php: + - "develop.content.example.com": + tls-acme: 'false' + insecure: Allow + hsts: max-age=31536000 \ No newline at end of file