From 67d6635f570bd30c24f7971cdedce101c8ab7b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20G=C3=B3recki?= Date: Fri, 20 Dec 2024 22:01:55 +0100 Subject: [PATCH] Fix problems with deployment (#35) * gracefully stop application to prevent errors * wait to start Redis before run the first deploy --- UPGRADE.md | 4 ++++ kubernetes/deployments/storefront.yaml | 3 ++- kubernetes/deployments/webserver-php-fpm.yaml | 6 ++++-- .../first-deploy-with-demo-data/migrate-application.yaml | 2 +- .../first-deploy/migrate-application.yaml | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index b2913e9..541ec42 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -10,6 +10,10 @@ 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 v3.3.2 to v3.3.3 + +- Fix problems with deployment ([#35](https://github.com/shopsys/deployment/pull/35)) + ## Upgrade from v3.3.1 to v3.3.2 - Redis was upgraded to version 7.4-alpine ([#34](https://github.com/shopsys/deployment/pull/34)) diff --git a/kubernetes/deployments/storefront.yaml b/kubernetes/deployments/storefront.yaml index 5c455e8..f23526b 100644 --- a/kubernetes/deployments/storefront.yaml +++ b/kubernetes/deployments/storefront.yaml @@ -36,7 +36,7 @@ spec: exec: command: - sleep - - '5' + - '10' resources: limits: cpu: "2" @@ -56,5 +56,6 @@ spec: initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 5 + terminationGracePeriodSeconds: 60 imagePullSecrets: - name: dockerregistry diff --git a/kubernetes/deployments/webserver-php-fpm.yaml b/kubernetes/deployments/webserver-php-fpm.yaml index 1a683e8..0c4e05d 100644 --- a/kubernetes/deployments/webserver-php-fpm.yaml +++ b/kubernetes/deployments/webserver-php-fpm.yaml @@ -90,8 +90,9 @@ spec: preStop: exec: command: - - sleep - - '5' + - sh + - '-c' + - sleep 10 && kill -SIGQUIT 1 volumeMounts: - name: source-codes mountPath: /var/www/html @@ -157,5 +158,6 @@ spec: requests: cpu: "0.5" memory: 500Mi + terminationGracePeriodSeconds: 120 imagePullSecrets: - name: dockerregistry diff --git a/kubernetes/kustomize/migrate-application/first-deploy-with-demo-data/migrate-application.yaml b/kubernetes/kustomize/migrate-application/first-deploy-with-demo-data/migrate-application.yaml index 3f89e3c..0eb7aa3 100644 --- a/kubernetes/kustomize/migrate-application/first-deploy-with-demo-data/migrate-application.yaml +++ b/kubernetes/kustomize/migrate-application/first-deploy-with-demo-data/migrate-application.yaml @@ -15,7 +15,7 @@ spec: command: - sh - -c - - cd /var/www/html && + - cd /var/www/html && sleep 30 && ./phing cluster-first-deploy db-fixtures-demo diff --git a/kubernetes/kustomize/migrate-application/first-deploy/migrate-application.yaml b/kubernetes/kustomize/migrate-application/first-deploy/migrate-application.yaml index 0d45947..61bb823 100644 --- a/kubernetes/kustomize/migrate-application/first-deploy/migrate-application.yaml +++ b/kubernetes/kustomize/migrate-application/first-deploy/migrate-application.yaml @@ -12,7 +12,7 @@ spec: containers: - name: migrate-application image: "{{TAG}}" - command: ["sh", "-c", "cd /var/www/html && ./phing cluster-first-deploy"] + command: ["sh", "-c", "cd /var/www/html && sleep 30 && ./phing cluster-first-deploy"] volumeMounts: - name: domains-urls mountPath: /var/www/html/{{DOMAINS_URLS_FILEPATH}}