From 2e1944a2ef88614352f4f622c2bc8615daafd9ac Mon Sep 17 00:00:00 2001 From: Dmitriy Stoyanov Date: Wed, 13 Nov 2024 14:31:59 +0000 Subject: [PATCH 1/4] Fix certificate update by changing runner where it works --- .github/workflows/certbot-update-cert.yml | 4 ++-- .github/workflows/create_cert.yml | 2 +- .github/workflows/instances-redeploy.yml_tmp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/certbot-update-cert.yml b/.github/workflows/certbot-update-cert.yml index 01edccaf2..9bf68c6a3 100644 --- a/.github/workflows/certbot-update-cert.yml +++ b/.github/workflows/certbot-update-cert.yml @@ -1,4 +1,4 @@ -name: Update TLS certificates for vscale +name: Update TLS certificates for selectel on: workflow_dispatch: @@ -7,7 +7,7 @@ on: jobs: update_certs: - runs-on: vscale + runs-on: selectel steps: - uses: actions/checkout@v4 - name: Configure secrets diff --git a/.github/workflows/create_cert.yml b/.github/workflows/create_cert.yml index a2506de12..ec518d60d 100644 --- a/.github/workflows/create_cert.yml +++ b/.github/workflows/create_cert.yml @@ -3,7 +3,7 @@ on: [workflow_dispatch] jobs: update_certs: - runs-on: vscale + runs-on: selectel steps: - uses: actions/checkout@v4 - name: Configure secrets diff --git a/.github/workflows/instances-redeploy.yml_tmp b/.github/workflows/instances-redeploy.yml_tmp index 36072deb5..4de816842 100644 --- a/.github/workflows/instances-redeploy.yml_tmp +++ b/.github/workflows/instances-redeploy.yml_tmp @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.runners }} strategy: matrix: - runners: [ epam, vscale ] + runners: [ selectel ] steps: - uses: actions/checkout@v4 - name: Configure secrets From e1e22d3eb5abb4c24325a510389eee70ea9a0dbb Mon Sep 17 00:00:00 2001 From: Dmitry Stoyanov Date: Wed, 13 Nov 2024 17:54:28 +0300 Subject: [PATCH 2/4] Adding ability to run from PR for testing purposes --- .github/workflows/certbot-update-cert.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/certbot-update-cert.yml b/.github/workflows/certbot-update-cert.yml index 9bf68c6a3..2d750b3a3 100644 --- a/.github/workflows/certbot-update-cert.yml +++ b/.github/workflows/certbot-update-cert.yml @@ -1,9 +1,10 @@ name: Update TLS certificates for selectel -on: - workflow_dispatch: - schedule: - - cron: '0 0 15 * *' +# on: +# workflow_dispatch: +# schedule: +# - cron: '0 0 15 * *' +on: pull_request jobs: update_certs: From 84fb1f89ccb9d11d78e6a532094f04052353c623 Mon Sep 17 00:00:00 2001 From: Dmitry Stoyanov Date: Wed, 13 Nov 2024 18:01:19 +0300 Subject: [PATCH 3/4] Update workflows with FIREBASE_CONFIG var --- .github/workflows/certbot-update-cert.yml | 4 ++-- .github/workflows/create_cert.yml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/certbot-update-cert.yml b/.github/workflows/certbot-update-cert.yml index 2d750b3a3..1bc413574 100644 --- a/.github/workflows/certbot-update-cert.yml +++ b/.github/workflows/certbot-update-cert.yml @@ -14,6 +14,7 @@ jobs: - name: Configure secrets run: | echo "$S3_KEY"|base64 -d > aws-key.properties + echo "$FIREBASE_CONFIG"|base64 -d > firebase_config.json mv docker-compose-run.yml docker-compose.yml sed -i -e "s/_YANDEX_AUTH_TOKEN_/\\$YANDEX_AUTH_TOKEN/" docker-compose.yml sed -i -e "s/_YANDEX_FOLDER_ID_/\\$YANDEX_FOLDER_ID/" docker-compose.yml @@ -21,13 +22,12 @@ jobs: sed -i -e "s/_API_GITHUB_TOKEN_/\\$API_GITHUB_TOKEN/" docker-compose.yml env: S3_KEY: ${{ secrets.S3_KEY }} + FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} YANDEX_AUTH_TOKEN: ${{ secrets.YANDEX_AUTH_TOKEN }} YANDEX_FOLDER_ID: ${{ secrets.YANDEX_FOLDER_ID }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} - name: Update certs run: | - docker compose pull docker compose run --rm certbot renew --allow-subset-of-names docker compose restart brn_fe_with_tls - docker image prune -af diff --git a/.github/workflows/create_cert.yml b/.github/workflows/create_cert.yml index ec518d60d..2c1ad40c2 100644 --- a/.github/workflows/create_cert.yml +++ b/.github/workflows/create_cert.yml @@ -9,6 +9,7 @@ jobs: - name: Configure secrets run: | echo "$S3_KEY"|base64 -d > aws-key.properties + echo "$FIREBASE_CONFIG"|base64 -d > firebase_config.json mv docker-compose-run.yml docker-compose.yml sed -i -e "s/_YANDEX_AUTH_TOKEN_/\\$YANDEX_AUTH_TOKEN/" docker-compose.yml sed -i -e "s/_YANDEX_FOLDER_ID_/\\$YANDEX_FOLDER_ID/" docker-compose.yml @@ -16,6 +17,7 @@ jobs: sed -i -e "s/_API_GITHUB_TOKEN_/\\$API_GITHUB_TOKEN/" docker-compose.yml env: S3_KEY: ${{ secrets.S3_KEY }} + FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }} YANDEX_AUTH_TOKEN: ${{ secrets.YANDEX_AUTH_TOKEN }} YANDEX_FOLDER_ID: ${{ secrets.YANDEX_FOLDER_ID }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} From 281b6bf8a992a76a2dc60d6c21f667e26507416a Mon Sep 17 00:00:00 2001 From: Dmitry Stoyanov Date: Wed, 13 Nov 2024 18:47:09 +0300 Subject: [PATCH 4/4] Remove additional domain brainup.fun --- .github/workflows/certbot-update-cert.yml | 9 ++++----- .github/workflows/create_cert.yml | 2 +- docker-compose-run.yml | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/certbot-update-cert.yml b/.github/workflows/certbot-update-cert.yml index 1bc413574..87a8be924 100644 --- a/.github/workflows/certbot-update-cert.yml +++ b/.github/workflows/certbot-update-cert.yml @@ -1,10 +1,9 @@ name: Update TLS certificates for selectel -# on: -# workflow_dispatch: -# schedule: -# - cron: '0 0 15 * *' -on: pull_request +on: + workflow_dispatch: + schedule: + - cron: '0 0 15 * *' jobs: update_certs: diff --git a/.github/workflows/create_cert.yml b/.github/workflows/create_cert.yml index 2c1ad40c2..1f5d6fd0a 100644 --- a/.github/workflows/create_cert.yml +++ b/.github/workflows/create_cert.yml @@ -24,4 +24,4 @@ jobs: API_GITHUB_TOKEN: ${{ secrets.API_GITHUB_TOKEN }} - name: Create cert run: | - docker compose run --rm certbot certonly --webroot --webroot-path=/var/www/html --email brainupproject@yandex.ru -d brainup.fun + docker compose run --rm certbot certonly --webroot --webroot-path=/var/www/html --email brainupproject@yandex.ru diff --git a/docker-compose-run.yml b/docker-compose-run.yml index b3425f92f..b1811e88e 100644 --- a/docker-compose-run.yml +++ b/docker-compose-run.yml @@ -60,7 +60,7 @@ services: - web-root-for-certbot:/var/www/html depends_on: - brn_fe_with_tls - command: certonly --webroot --webroot-path=/var/www/html --email brainupspbproject@gmail.com --agree-tos --no-eff-email --force-renewal -d brainup.fun + command: certonly --webroot --webroot-path=/var/www/html --email brainupspbproject@gmail.com --agree-tos --no-eff-email secrets: aws-key: file: aws-key.properties