From 22f71cb522947279c423b4c871be1efa66024568 Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Wed, 4 Mar 2026 17:30:43 +0100 Subject: [PATCH 1/2] remove files that are already part of project-base by default - removed deploy-project.sh, basicHttpAuth, and nginx.yaml - nginx.yaml moved to test fixtures so that we can still test the manifest - update references in README.md --- README.md | 35 ++++---- docs/basicHttpAuth | 1 - docs/deploy-project.sh | 89 ------------------- tests/README.md | 3 + .../kubernetes}/configmap/nginx.yaml | 0 tests/run-tests.sh | 6 ++ 6 files changed, 27 insertions(+), 107 deletions(-) delete mode 100644 docs/basicHttpAuth delete mode 100644 docs/deploy-project.sh rename {kubernetes => tests/fixtures/orchestration/kubernetes}/configmap/nginx.yaml (100%) diff --git a/README.md b/README.md index 49470dc..4279282 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,14 @@ 1. Install package `composer require shopsys/deployment` -2. Copy [deploy-project.sh](./docs/deploy-project.sh) into your project to `deploy/deploy-project.sh` +2. Copy [deploy-project.sh](https://github.com/shopsys/project-base/blob/HEAD/app/deploy/deploy-project.sh) into your project to `app/deploy/deploy-project.sh` -3. Create or [copy](./docs/basicHttpAuth) htpasswd file with login credentials to `deploy/basicHttpAuth` +3. Create or [copy](https://github.com/shopsys/project-base/blob/HEAD/app/deploy/basicHttpAuth) htpasswd file with login credentials to `app/deploy/basicHttpAuth` > Default login for basicHttpAuth is `username/password` For info about how change http auth credentials see [Change HTTP auth](#change-http-auth) -4. Update your `gitlab-ci.yml` +4. Copy [nginx.yaml](https://github.com/shopsys/project-base/blob/HEAD/app/orchestration/kubernetes/configmap/nginx.yaml) into your project to `app/orchestration/kubernetes/configmap/nginx.yaml` +5. Update your `gitlab-ci.yml` - create new stage with name deploy: ```diff stages: @@ -77,9 +78,9 @@ url: https://${DOMAIN_HOSTNAME_1} ``` -5. Set Environment variables to in Gitlab (Settings -> CI/CD -> Variables) +6. Set Environment variables to in Gitlab (Settings -> CI/CD -> Variables) -6. Push changes and have fun +7. Push changes and have fun ## Environment Variables @@ -111,11 +112,11 @@ If you want to define your custom variables see [Define custom variables](#defin *1) Credentials can be generated in Gitlab (Settings -> Repository -> Deploy Tokens) with `read_registry` scope only -You can add your custom variables. *Do not forget to edit [deploy-project.sh](./docs/deploy-project.sh)* +You can add your custom variables. *Do not forget to edit your `deploy-project.sh` file* ## Customize deployment -You can override kubernetes manifests by place your custom manifest into `orchestration/kubernetes/` path in your project +You can override Kubernetes manifests by placing your custom manifests into `app/orchestration/kubernetes/` in your project. *You need to mirror folders to be able to override manifests* @@ -131,7 +132,7 @@ You can override kubernetes manifests by place your custom manifest into `orches ``` -2. Declare new cron to your deploy configuration file [deploy-project.sh](./docs/deploy-project.sh): +2. Declare new cron to your deploy configuration file (`deploy-project.sh`): As a key there is used phing target that you created in step 1. and value represents [crontab timer](https://crontab.guru/#*/5_*_*_*_*) ```diff @@ -155,7 +156,7 @@ You can override kubernetes manifests by place your custom manifest into `orches | DOMAIN_HOSTNAME_2 | sk.mydomain.prod.shopsys.cloud | | DOMAIN_HOSTNAME_3 | en.mydomain.prod.shopsys.cloud | -2. Edit [deploy-project.sh](./docs/deploy-project.sh) +2. Edit your `deploy-project.sh` file: ```diff ... function deploy() { @@ -170,7 +171,7 @@ You can override kubernetes manifests by place your custom manifest into `orches ### Define custom variables 1. Create Environment variable -2. Edit [deploy-project.sh](./docs/deploy-project.sh) +2. Edit your `deploy-project.sh` file: ```diff ... declare -A ENVIRONMENT_VARIABLES=( @@ -184,7 +185,7 @@ You can override kubernetes manifests by place your custom manifest into `orches ### Set custom Redis version -Add new variable to `deploy/deploy-project.sh` and specify your redis version +Add new variable to `deploy-project.sh` and specify your redis version ```diff ... @@ -198,7 +199,7 @@ Add new variable to `deploy/deploy-project.sh` and specify your redis version ### Enable Horizontal pod autoscaling -Add new variables to `deploy/deploy-project.sh` to enable pod autoscaling: +Add new variables to `deploy-project.sh` to enable pod autoscaling: - Enable this functionality: ```diff @@ -219,7 +220,7 @@ Add new variables to `deploy/deploy-project.sh` to enable pod autoscaling: - `MAX_STOREFRONT_REPLICAS` ### How to launch only some domains - Add to `deploy/deploy-project.sh` new array `FORCE_HTTP_AUTH_IN_PRODUCTION` with domains which should be not accessible without HTTP auth: + Add to `deploy-project.sh` new array `FORCE_HTTP_AUTH_IN_PRODUCTION` with domains which should be not accessible without HTTP auth: ```diff ... @@ -237,8 +238,8 @@ Add new variables to `deploy/deploy-project.sh` to enable pod autoscaling: ### Change HTTP auth 1. Generate new HTTP auth string (for example [here](https://www.web2generators.com/apache-tools/htpasswd-generator)), or by command `htpasswd -nb username password` -2. Replace or add new HTTP auth string to `deploy/basicHttpAuth` -3. Set new credentials to variable in `deploy/deploy-project.sh` +2. Replace or add new HTTP auth string to `basicHttpAuth` +3. Set new credentials to variable in `deploy-project.sh` ```diff ... function deploy() { @@ -263,9 +264,9 @@ You can set sensitive whitelisted IPs in your env variable like this: WHITELIST_IPS="8.8.8.8, 217.23.44.23, 93.111.234.111" ``` -#### `DEFAULT_WHITELIST_IPS` env variable in `deploy/deploy-project.sh` +#### `DEFAULT_WHITELIST_IPS` env variable in `deploy-project.sh` -For non-sensitive IPs, that you want to share between all environments you can use `DEFAULT_WHITELIST_IPS` in `deploy/deploy-project.sh` like this: +For non-sensitive IPs, that you want to share between all environments you can use `DEFAULT_WHITELIST_IPS` in `deploy-project.sh` like this: ```shell # Some IP Another IP Some service diff --git a/docs/basicHttpAuth b/docs/basicHttpAuth deleted file mode 100644 index b1be3f0..0000000 --- a/docs/basicHttpAuth +++ /dev/null @@ -1 +0,0 @@ -username:$apr1$rXCRoJ5T$E9pSjIZHR/RsxiK0SxSUf1 diff --git a/docs/deploy-project.sh b/docs/deploy-project.sh deleted file mode 100644 index 21e2cfc..0000000 --- a/docs/deploy-project.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -e - -BASE_PATH="$(realpath "$(dirname "$0")/..")" -CONFIGURATION_TARGET_PATH="${BASE_PATH}/var/deployment/kubernetes" -BASIC_AUTH_PATH="${BASE_PATH}/deploy/basicHttpAuth" -DEPLOY_TARGET_PATH="${BASE_PATH}/var/deployment/deploy" - -function deploy() { - DOMAINS=( - DOMAIN_HOSTNAME_1 - DOMAIN_HOSTNAME_2 - ) - - ENABLE_AUTOSCALING=true - - declare -A ENVIRONMENT_VARIABLES=( - ["APP_SECRET"]=${APP_SECRET} - ["DATABASE_HOST"]=${POSTGRES_DATABASE_IP_ADDRESS} - ["DATABASE_NAME"]=${PROJECT_NAME} - ["DATABASE_PORT"]=${POSTGRES_DATABASE_PORT} - ["DATABASE_USER"]=${PROJECT_NAME} - ["DATABASE_PASSWORD"]=${POSTGRES_DATABASE_PASSWORD} - - ["S3_ENDPOINT"]=${S3_ENDPOINT} - ["S3_ACCESS_KEY"]=${PROJECT_NAME} - ["S3_SECRET"]=${S3_SECRET} - ["S3_BUCKET_NAME"]=${PROJECT_NAME} - - ["ELASTICSEARCH_HOST"]=${ELASTICSEARCH_URLS} - ["ELASTIC_SEARCH_INDEX_PREFIX"]=${PROJECT_NAME} - - ["REDIS_PREFIX"]=${PROJECT_NAME} - ["MAILER_DSN"]=${MAILER_DSN} - ["TRUSTED_PROXY"]=10.0.0.0/8 - ["MESSENGER_TRANSPORT_DSN"]=${MESSENGER_TRANSPORT_DSN} - ) - - declare -A STOREFRONT_ENVIRONMENT_VARIABLES=( - - ) - - declare -A CRON_INSTANCES=( - ["cron"]='*/5 * * * *' - ) - - VARS=( - TAG - STOREFRONT_TAG - PROJECT_NAME - BASE_PATH - RABBITMQ_DEFAULT_USER - RABBITMQ_DEFAULT_PASS - RABBITMQ_IP_WHITELIST - ) - - source "${DEPLOY_TARGET_PATH}/functions.sh" - source "${DEPLOY_TARGET_PATH}/parts/domains.sh" - source "${DEPLOY_TARGET_PATH}/parts/domain-rabbitmq-management.sh" - source "${DEPLOY_TARGET_PATH}/parts/environment-variables.sh" - source "${DEPLOY_TARGET_PATH}/parts/kubernetes-variables.sh" - source "${DEPLOY_TARGET_PATH}/parts/cron.sh" - source "${DEPLOY_TARGET_PATH}/parts/autoscaling.sh" - source "${DEPLOY_TARGET_PATH}/parts/deploy.sh" -} - -function merge() { - # Specify consumers configuration with the default configuration in the format: - # :: - DEFAULT_CONSUMERS=( - "example:example_transport:1" - ) - - source "${BASE_PATH}/vendor/shopsys/deployment/deploy/functions.sh" - merge_configuration - create_consumer_manifests "${DEFAULT_CONSUMERS[@]}" -} - -case "$1" in - "deploy") - deploy - ;; - "merge") - merge - ;; - *) - echo "invalid option" - exit 1 - ;; -esac diff --git a/tests/README.md b/tests/README.md index 36e4d86..29eab67 100644 --- a/tests/README.md +++ b/tests/README.md @@ -42,6 +42,7 @@ Using `--user "$(id -u):$(id -g)"` ensures generated files are owned by your loc ``` tests/ ├── run-tests.sh # Main test runner +├── fixtures/ # Shared project-level overrides copied to tmp test project ├── lib/ │ ├── test-helpers.sh # Helper functions │ └── default-env.sh # Shared default environment variables @@ -67,3 +68,5 @@ tests/ 3. Runs scenario's `deploy-project.sh generate` 4. Builds kustomize outputs 5. Compares with expected files + +`tests/fixtures/orchestration/kubernetes/configmap/nginx.yaml` is intentionally tracked because the deployment package no longer ships `kubernetes/configmap/nginx.yaml`, but test scenarios still need a project-level override to build webserver manifests. diff --git a/kubernetes/configmap/nginx.yaml b/tests/fixtures/orchestration/kubernetes/configmap/nginx.yaml similarity index 100% rename from kubernetes/configmap/nginx.yaml rename to tests/fixtures/orchestration/kubernetes/configmap/nginx.yaml diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 33e732e..138e055 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -130,6 +130,12 @@ setup_test_environment() { ln -s "${PROJECT_ROOT}/kubernetes" "${test_tmp}/vendor/shopsys/deployment/kubernetes" ln -s "${PROJECT_ROOT}/deploy" "${test_tmp}/vendor/shopsys/deployment/deploy" + # Provide required project-level overrides that are no longer shipped by deployment package. + local fixtures_orchestration_path="${PROJECT_ROOT}/tests/fixtures/orchestration" + if [ -d "${fixtures_orchestration_path}" ]; then + cp -R "${fixtures_orchestration_path}/." "${test_tmp}/orchestration/" + fi + # Create domains_urls.yaml.dist dynamically based on domain count echo "domains_urls:" > "${test_tmp}/config/domains_urls.yaml.dist" for i in $(seq 1 ${domain_count}); do From 89970a149a5d57bf238374732b1fd5e7e8eb4a92 Mon Sep 17 00:00:00 2001 From: Rostislav Vitek Date: Wed, 4 Mar 2026 17:36:21 +0100 Subject: [PATCH 2/2] add upgrade notes --- UPGRADE.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPGRADE.md b/UPGRADE.md index fe9a7da..9d8be56 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -10,6 +10,11 @@ 2. Run `composer update shopsys/deployment` 3. Check files in mentioned pull requests and if you have any of them extended in your project, apply changes manually +## Upgrade from v4.6.1 to v5.0.0 + +- remove files that are already part of project-base by default ([#66](https://github.com/shopsys/deployment/pull/66)) +- if your project does not include `nginx.yaml` file for Kubernetes deployment, you need to copy-paste the [file](https://github.com/shopsys/project-base/blob/HEAD/app/orchestration/kubernetes/configmap/nginx.yaml) from project-base repository into `app/orchestration/kubernetes/configmap/nginx.yaml` in your project + ## Upgrade from v4.6.0 to v4.6.1 - fix redirects within imageResizer ([#68](https://github.com/shopsys/deployment/pull/68))