From d1212d852b1ff1d8efb2869fa7611c17ad2702ed Mon Sep 17 00:00:00 2001 From: Egor Matveev Date: Sun, 8 Jun 2025 11:12:54 +0300 Subject: [PATCH] fix --- .deploy-nginx/deploy-dev.yaml | 5 +++++ .deploy-nginx/deploy-prod.yaml | 7 ++++++- nginx/nginx-dev/prepare.py | 5 ++++- nginx/nginx-prod/prepare.py | 5 ++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.deploy-nginx/deploy-dev.yaml b/.deploy-nginx/deploy-dev.yaml index d481934..522a943 100644 --- a/.deploy-nginx/deploy-dev.yaml +++ b/.deploy-nginx/deploy-dev.yaml @@ -6,6 +6,9 @@ services: image: mathwave/sprint-repo:sprint-infra-nginx-dev networks: - common-infra-nginx-development + - configurator + environment: + MINIO_SECRET_KEY: $MINIO_SECRET_KEY_DEV ports: - published: 80 target: 80 @@ -27,3 +30,5 @@ services: networks: common-infra-nginx-development: external: true + configurator: + external: true diff --git a/.deploy-nginx/deploy-prod.yaml b/.deploy-nginx/deploy-prod.yaml index 79c382b..d61bb01 100644 --- a/.deploy-nginx/deploy-prod.yaml +++ b/.deploy-nginx/deploy-prod.yaml @@ -6,6 +6,9 @@ services: image: mathwave/sprint-repo:sprint-infra-nginx-prod networks: - common-infra-nginx + - configurator + environment: + MINIO_SECRET_KEY: $MINIO_SECRET_KEY_PROD ports: - published: 80 target: 80 @@ -26,4 +29,6 @@ services: networks: common-infra-nginx: - external: true \ No newline at end of file + external: true + configurator: + external: true diff --git a/nginx/nginx-dev/prepare.py b/nginx/nginx-dev/prepare.py index 5a2b09a..2e056d1 100644 --- a/nginx/nginx-dev/prepare.py +++ b/nginx/nginx-dev/prepare.py @@ -39,7 +39,10 @@ for host, params in hosts.items(): '''.format(host=host, target_host=params['host'], port=params['port']) fullchain = minio_client.get_object("certupdater", f'certificates/{host}/fullchain.pem') privkey = minio_client.get_object("certupdater", f'certificates/{host}/privkey.pem') - os.mkdir(f'/etc/nginx/{host}') + try: + os.mkdir(f'/etc/nginx/{host}') + except FileExistsError: + ... with open(f"/etc/nginx/{host}/fullchain.pem", 'wb') as fp: fp.write(fullchain.data) with open(f"/etc/nginx/{host}/privkey.pem", 'wb') as fp: diff --git a/nginx/nginx-prod/prepare.py b/nginx/nginx-prod/prepare.py index a545148..dd8b902 100644 --- a/nginx/nginx-prod/prepare.py +++ b/nginx/nginx-prod/prepare.py @@ -39,7 +39,10 @@ for host, params in hosts.items(): '''.format(host=host, target_host=params['host'], port=params['port']) fullchain = minio_client.get_object("certupdater", f'certificates/{host}/fullchain.pem') privkey = minio_client.get_object("certupdater", f'certificates/{host}/privkey.pem') - os.mkdir(f'/etc/nginx/{host}') + try: + os.mkdir(f'/etc/nginx/{host}') + except FileExistsError: + ... with open(f"/etc/nginx/{host}/fullchain.pem", 'wb') as fp: fp.write(fullchain.data) with open(f"/etc/nginx/{host}/privkey.pem", 'wb') as fp: