diff --git a/.github/workflows/container-deploy.yml b/.github/workflows/container-deploy.yml index a151af56..e2b43469 100644 --- a/.github/workflows/container-deploy.yml +++ b/.github/workflows/container-deploy.yml @@ -147,10 +147,16 @@ jobs: script_stop: false script: | cd ${{ matrix.env }} + # Get the latest version (to apply migration next) + make pull + # Apply migrations + make migrate-db + # Launch new version make up - name: Check services are up uses: appleboy/ssh-action@master + id: livecheck if: ${{ always() }} with: host: ${{ env.SSH_HOST }} @@ -162,6 +168,8 @@ jobs: script_stop: false script: | cd ${{ matrix.env }} + # Let 10s to the API to be up + sleep 10 make livecheck - name: Cleanup obsolete Docker objects diff --git a/Makefile b/Makefile index 5ab5590f..daa056ed 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,11 @@ create_external_volumes: @echo "🥫 Creating external volumes (production only) …" docker volume create open_prices_postgres-data + +migrate-db: + @echo "🥫 Migrating database …" + ${DOCKER_COMPOSE} run --rm --no-deps api poetry run alembic upgrade head + #---------# # Cleanup # #---------#