Skip to content

Commit

Permalink
Flyway prod runner + postgres bumped to 16 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwitkowski authored Jul 30, 2024
1 parent e314458 commit 8dee971
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/db-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
workflow_dispatch:

jobs:
db-schema-migration:
validate-migrations:
runs-on: ubuntu-latest

steps:
Expand All @@ -21,4 +21,22 @@ jobs:
- name: 'Test flyway migration scripts'
working-directory: ./db
run: |
./run_migrations_test.sh
./run_migrations_test.sh
apply-migrations:
runs-on: ubuntu-latest
environment: production
if: github.ref == 'refs/heads/main'
needs: validate-migrations

steps:
- uses: actions/checkout@v4

- name: Run migration
uses: docker://flyway/flyway:10-alpine
env:
FLYWAY_URL: ${{ secrets.DB_JDBC_URL }}
FLYWAY_USER: ${{ secrets.DB_FLYWAY_USER }}
FLYWAY_PASSWORD: ${{ secrets.DB_FLYWAY_PASSWORD }}
FLYWAY_LOCATIONS: filesystem:./db/migrations
FLYWAY_VALIDATE_MIGRATION_NAMING: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This project aims at reviving www.aero-offers.com - invaluable source of price t
- `job_fetch_offers` - scans few portals (e.g. soaring.de) and stores new offers in the database (not yet classified)
- `job_reclassify_offers` - assigns manufacturer and model to new (not yet classified) offers stored in the database
- `job_update_exchange_rates` - updates currency exchange rates based ok ECP api
- `db` - PostgreSQL 15 database with DDL scripts managed by Flyway
- `db` - PostgreSQL 16 database with DDL scripts managed by Flyway

### Prod environment
Currently the project is being onboarded to Azure Cloud (still WIP).
Expand Down
3 changes: 1 addition & 2 deletions azure/setup_azure_infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ az containerapp create \
--cpu 0.25 --memory 0.5Gi \
--min-replicas 1 --max-replicas 1 \
--ingress external \
--query properties.configuration.ingress.fqdn

--query properties.configuration.ingress.fqdn
4 changes: 2 additions & 2 deletions db/run_migrations_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ docker run --rm \
-e 'POSTGRES_DB=aircraft_offers' \
-e 'POSTGRES_USER=aircraft_offers' \
-e 'POSTGRES_PASSWORD=aircraft_offers' \
postgres:15-alpine
postgres:16.3-alpine

sleep 2

Expand All @@ -18,7 +18,7 @@ echo "Running migrations"
docker run --rm \
--network test-network \
-v ${PWD}'/migrations/:/flyway/sql' \
flyway/flyway \
flyway/flyway:10-alpine \
-url=jdbc:postgresql://test-db:5432/aircraft_offers -user=aircraft_offers -password=aircraft_offers migrate

docker rm -f test-db
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- flyway

ca-aerooffers-db:
image: postgres:15-alpine
image: postgres:16.3-alpine
environment:
- POSTGRES_DB=aircraft_offers
- POSTGRES_USER=aircraft_offers
Expand All @@ -30,7 +30,7 @@ services:
- '25432:5432'

flyway:
image: flyway/flyway
image: flyway/flyway:10-alpine
command: -url=jdbc:postgresql://ca-aerooffers-db:5432/aircraft_offers -user=aircraft_offers -password=aircraft_offers migrate
volumes:
- ./db/migrations:/flyway/sql
Expand Down

0 comments on commit 8dee971

Please sign in to comment.