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:
|
jobs:
|
||||||
test-backend:
|
test-backend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
if: false
|
# if: false
|
||||||
|
|
||||||
# Point all steps at the host's rootless Podman socket
|
# Point all steps at the host's rootless Podman socket
|
||||||
env:
|
env:
|
||||||
|
|
@ -128,7 +128,7 @@ jobs:
|
||||||
|
|
||||||
test-frontend:
|
test-frontend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
# if: false
|
if: false
|
||||||
# needs: test-backend
|
# needs: test-backend
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -140,7 +140,7 @@ jobs:
|
||||||
|
|
||||||
build-backend:
|
build-backend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
if: false
|
# if: false
|
||||||
needs: [test-backend, test-frontend]
|
needs: [test-backend, test-frontend]
|
||||||
# needs: [test-frontend]
|
# needs: [test-frontend]
|
||||||
|
|
||||||
|
|
@ -177,8 +177,8 @@ jobs:
|
||||||
build-frontend:
|
build-frontend:
|
||||||
runs-on: [ci]
|
runs-on: [ci]
|
||||||
# if: false
|
# if: false
|
||||||
# needs: [test-backend, test-frontend]
|
needs: [test-backend, test-frontend]
|
||||||
needs: [test-frontend]
|
# needs: [test-frontend]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
||||||
|
|
@ -236,8 +236,8 @@ jobs:
|
||||||
|
|
||||||
deploy-prod:
|
deploy-prod:
|
||||||
runs-on: [prod]
|
runs-on: [prod]
|
||||||
needs: [build-frontend]
|
# needs: [build-frontend]
|
||||||
# needs: [build-backend, build-frontend]
|
needs: [build-backend, build-frontend]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
CONTAINER_HOST: unix:///run/user/1001/podman/podman.sock
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ async fn main() -> anyhow::Result<()> {
|
||||||
.connect(&database_url)
|
.connect(&database_url)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
// Run database migrations
|
||||||
|
sqlx::migrate!("../../migrations")
|
||||||
|
.run(&pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
// Create repositories
|
// Create repositories
|
||||||
let user_repo = PostgresUserRepository::new(pool.clone());
|
let user_repo = PostgresUserRepository::new(pool.clone());
|
||||||
let product_repo = PostgresProductRepository::new(pool);
|
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"
|
value: "postgres://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@127.0.0.1:${POSTGRES_PORT}/${POSTGRES_DATABASE_NAME}?sslmode=disable"
|
||||||
- name: PORT
|
- name: PORT
|
||||||
value: "${PROD_BACKEND_PORT}"
|
value: "${PROD_BACKEND_PORT}"
|
||||||
command: ["sh", "-c"]
|
|
||||||
args:
|
|
||||||
- "cd /app && sqlx migrate run --database-url $DATABASE_URL && ./sharenet-api-postgres"
|
|
||||||
ports:
|
ports:
|
||||||
- containerPort: ${PROD_BACKEND_PORT}
|
- containerPort: ${PROD_BACKEND_PORT}
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue