From a4d8ddd8c3c7e1a6ec3d642b10486918b104b281 Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 09:49:15 +0100 Subject: [PATCH 1/6] Test flyway 1 --- .github/workflows/deploy-staging.yml | 50 +++++++++++----------------- 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 91886695..4a3296c8 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -24,34 +24,24 @@ jobs: remote_key: ${{ secrets.STAGING_KEY }} remote_key_pass: ${{ secrets.STAGING_KEY_PASS }} - - name: Run Flyway Migrations core - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.STAGING_HOST }} - username: ${{ secrets.STAGING_USER }} - key: ${{ secrets.STAGING_KEY }} - passphrase: ${{ secrets.STAGING_KEY_PASS }} - script: | - docker run --rm \ - --network npm_network \ - --volume /path/to/config/db/core:/flyway/core:ro \ - -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ - -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ - -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ - flyway/flyway -locations=filesystem:/flyway/core -table=flyway_core migrate + - name: Run Flyway migrations for core + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.STAGING_HOST }} + username: ${{ secrets.STAGING_USER }} + key: ${{ secrets.STAGING_KEY }} + passphrase: ${{ secrets.STAGING_KEY_PASS }} + script: | + export FLYWAY_DB_FOLDER=core + docker compose run --rm flyway || exit 1 - - name: Run Flyway Migrations myapp - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.STAGING_HOST }} - username: ${{ secrets.STAGING_USER }} - key: ${{ secrets.STAGING_KEY }} - passphrase: ${{ secrets.STAGING_KEY_PASS }} - script: | - docker run --rm \ - --network npm_network \ - --volume /path/to/config/db/myapp:/flyway/myapp:ro \ - -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ - -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ - -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ - flyway/flyway -locations=filesystem:/flyway/myapp -table=flyway_myapp migrate \ No newline at end of file + - name: Run Flyway migrations for myapp + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.STAGING_HOST }} + username: ${{ secrets.STAGING_USER }} + key: ${{ secrets.STAGING_KEY }} + passphrase: ${{ secrets.STAGING_KEY_PASS }} + script: | + export FLYWAY_DB_FOLDER=myapp + docker compose run --rm flyway || exit 1 \ No newline at end of file From f527968bb1b4bc24a9e858e512a3e0d447a0b4cf Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 09:55:18 +0100 Subject: [PATCH 2/6] Test Flyway 2 --- .github/workflows/deploy-staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 4a3296c8..23e4475b 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -44,4 +44,4 @@ jobs: passphrase: ${{ secrets.STAGING_KEY_PASS }} script: | export FLYWAY_DB_FOLDER=myapp - docker compose run --rm flyway || exit 1 \ No newline at end of file + docker compose run --rm flyway || exit 1 From 3494f7c1150c25b470347d651d52f6ba009a91ce Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 10:00:57 +0100 Subject: [PATCH 3/6] Flyway Test 3 --- .github/workflows/deploy-staging.yml | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 23e4475b..f2160f53 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -25,23 +25,23 @@ jobs: remote_key_pass: ${{ secrets.STAGING_KEY_PASS }} - name: Run Flyway migrations for core - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.STAGING_HOST }} - username: ${{ secrets.STAGING_USER }} - key: ${{ secrets.STAGING_KEY }} - passphrase: ${{ secrets.STAGING_KEY_PASS }} - script: | - export FLYWAY_DB_FOLDER=core - docker compose run --rm flyway || exit 1 + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.STAGING_HOST }} + username: ${{ secrets.STAGING_USER }} + key: ${{ secrets.STAGING_KEY }} + passphrase: ${{ secrets.STAGING_KEY_PASS }} + script: | + export FLYWAY_DB_FOLDER=core + docker compose run --rm flyway || exit 1 - - name: Run Flyway migrations for myapp - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.STAGING_HOST }} - username: ${{ secrets.STAGING_USER }} - key: ${{ secrets.STAGING_KEY }} - passphrase: ${{ secrets.STAGING_KEY_PASS }} - script: | - export FLYWAY_DB_FOLDER=myapp - docker compose run --rm flyway || exit 1 + - name: Run Flyway migrations for myapp + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.STAGING_HOST }} + username: ${{ secrets.STAGING_USER }} + key: ${{ secrets.STAGING_KEY }} + passphrase: ${{ secrets.STAGING_KEY_PASS }} + script: | + export FLYWAY_DB_FOLDER=myapp + docker compose run --rm flyway || exit 1 From 1b9d65ea87859fda36735df7bbb81082f85776b8 Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 11:09:03 +0100 Subject: [PATCH 4/6] Test Flyway 4 --- .github/workflows/deploy-staging.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index f2160f53..53871f08 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -24,7 +24,7 @@ jobs: remote_key: ${{ secrets.STAGING_KEY }} remote_key_pass: ${{ secrets.STAGING_KEY_PASS }} - - name: Run Flyway migrations for core + - name: Run Flyway Migrations core uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.STAGING_HOST }} @@ -32,10 +32,15 @@ jobs: key: ${{ secrets.STAGING_KEY }} passphrase: ${{ secrets.STAGING_KEY_PASS }} script: | - export FLYWAY_DB_FOLDER=core - docker compose run --rm flyway || exit 1 + docker run --rm \ + --network npm_network \ + --volume ./config/db/core:/flyway/core:ro \ + -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ + -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ + -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ + flyway/flyway -locations=filesystem:/flyway/core -table=flyway_core migrate - - name: Run Flyway migrations for myapp + - name: Run Flyway Migrations myapp uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.STAGING_HOST }} @@ -43,5 +48,10 @@ jobs: key: ${{ secrets.STAGING_KEY }} passphrase: ${{ secrets.STAGING_KEY_PASS }} script: | - export FLYWAY_DB_FOLDER=myapp - docker compose run --rm flyway || exit 1 + docker run --rm \ + --network npm_network \ + --volume ./config/db/myapp:/flyway/myapp:ro \ + -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ + -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ + -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ + flyway/flyway -locations=filesystem:/flyway/myapp -table=flyway_myapp migrate \ No newline at end of file From c1b5224d8df753fea45aa378335886971a92fffb Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 11:32:08 +0100 Subject: [PATCH 5/6] Test Flyway 5 --- .github/workflows/deploy-staging.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-staging.yml b/.github/workflows/deploy-staging.yml index 53871f08..2e8ae524 100644 --- a/.github/workflows/deploy-staging.yml +++ b/.github/workflows/deploy-staging.yml @@ -34,7 +34,7 @@ jobs: script: | docker run --rm \ --network npm_network \ - --volume ./config/db/core:/flyway/core:ro \ + --volume ${{ secrets.STAGING_REMOTE_PATH }}/config/db/core:/flyway/core:ro \ -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ @@ -50,7 +50,7 @@ jobs: script: | docker run --rm \ --network npm_network \ - --volume ./config/db/myapp:/flyway/myapp:ro \ + --volume ${{ secrets.STAGING_REMOTE_PATH }}/config/db/myapp:/flyway/myapp:ro \ -e FLYWAY_URL="${{ secrets.STAGING_DB_URL }}" \ -e FLYWAY_USER="${{ secrets.STAGING_DB_USER }}" \ -e FLYWAY_PASSWORD="${{ secrets.STAGING_DB_PASSWORD }}" \ From dd1ee81ab67e86456f9b8ea130ef770423c8cff7 Mon Sep 17 00:00:00 2001 From: ptruessel Date: Thu, 21 Nov 2024 11:34:04 +0100 Subject: [PATCH 6/6] Flyway changes --- .github/workflows/deploy-production.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml index 5a2eda94..70d6e574 100644 --- a/.github/workflows/deploy-production.yml +++ b/.github/workflows/deploy-production.yml @@ -34,7 +34,7 @@ jobs: script: | docker run --rm \ --network npm_network \ - --volume /path/to/config/db/core:/flyway/core:ro \ + --volume ${{ secrets.PROD_REMOTE_PATH }}/config/db/core:/flyway/core:ro \ -e FLYWAY_URL="${{ secrets.PROD_DB_URL }}" \ -e FLYWAY_USER="${{ secrets.PROD_DB_USER }}" \ -e FLYWAY_PASSWORD="${{ secrets.PROD_DB_PASSWORD }}" \ @@ -50,7 +50,7 @@ jobs: script: | docker run --rm \ --network npm_network \ - --volume /path/to/config/db/myapp:/flyway/myapp:ro \ + --volume ${{ secrets.PROD_REMOTE_PATH }}/config/db/myapp:/flyway/myapp:ro \ -e FLYWAY_URL="${{ secrets.PROD_DB_URL }}" \ -e FLYWAY_USER="${{ secrets.PROD_DB_USER }}" \ -e FLYWAY_PASSWORD="${{ secrets.PROD_DB_PASSWORD }}" \