Run database migration directly in backend main()
All checks were successful
Podman Rootless Demo / test-backend (push) Successful in 9m15s
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Has been skipped
Podman Rootless Demo / deploy-prod (push) Has been skipped
All checks were successful
Podman Rootless Demo / test-backend (push) Successful in 9m15s
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Has been skipped
Podman Rootless Demo / deploy-prod (push) Has been skipped
This commit is contained in:
parent
f01fa26d4f
commit
635a57645e
3 changed files with 12 additions and 10 deletions
|
|
@ -4,7 +4,7 @@ on: [push, pull_request]
|
|||
jobs:
|
||||
test-backend:
|
||||
runs-on: [ci]
|
||||
if: false
|
||||
# if: false
|
||||
|
||||
# Point all steps at the host's rootless Podman socket
|
||||
env:
|
||||
|
|
@ -128,7 +128,7 @@ jobs:
|
|||
|
||||
test-frontend:
|
||||
runs-on: [ci]
|
||||
# if: false
|
||||
if: false
|
||||
# needs: test-backend
|
||||
|
||||
steps:
|
||||
|
|
@ -140,7 +140,7 @@ jobs:
|
|||
|
||||
build-backend:
|
||||
runs-on: [ci]
|
||||
if: false
|
||||
# if: false
|
||||
needs: [test-backend, test-frontend]
|
||||
# needs: [test-frontend]
|
||||
|
||||
|
|
@ -177,8 +177,8 @@ jobs:
|
|||
build-frontend:
|
||||
runs-on: [ci]
|
||||
# if: false
|
||||
# needs: [test-backend, test-frontend]
|
||||
needs: [test-frontend]
|
||||
needs: [test-backend, test-frontend]
|
||||
# needs: [test-frontend]
|
||||
|
||||
env:
|
||||
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
||||
|
|
@ -236,8 +236,8 @@ jobs:
|
|||
|
||||
deploy-prod:
|
||||
runs-on: [prod]
|
||||
needs: [build-frontend]
|
||||
# needs: [build-backend, build-frontend]
|
||||
# needs: [build-frontend]
|
||||
needs: [build-backend, build-frontend]
|
||||
|
||||
env:
|
||||
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ async fn main() -> anyhow::Result<()> {
|
|||
.connect(&database_url)
|
||||
.await?;
|
||||
|
||||
// Run database migrations
|
||||
sqlx::migrate!("../../migrations")
|
||||
.run(&pool)
|
||||
.await?;
|
||||
|
||||
// Create repositories
|
||||
let user_repo = PostgresUserRepository::new(pool.clone());
|
||||
let product_repo = PostgresProductRepository::new(pool);
|
||||
|
|
|
|||
|
|
@ -78,9 +78,6 @@ spec:
|
|||
value: "postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@127.0.0.1:${POSTGRES_PORT}/${POSTGRES_DATABASE_NAME}?sslmode=disable"
|
||||
- name: PORT
|
||||
value: "${PROD_BACKEND_PORT}"
|
||||
command: ["sh", "-c"]
|
||||
args:
|
||||
- "cd /app && sqlx migrate run --database-url $DATABASE_URL && ./sharenet-api-postgres"
|
||||
ports:
|
||||
- containerPort: ${PROD_BACKEND_PORT}
|
||||
protocol: TCP
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue