Skip to content

Commit

Permalink
Ensure postgres user has the replication privilege
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad committed Aug 8, 2024
1 parent 4449a64 commit d864d6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion TeachingRecordSystem/db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ ENV_VARS=$(env | grep DefaultConnection | sed 's/^ConnectionStrings__DefaultConn
/^Password/ { print "export PGPASSWORD=" substr($0, 10) }
')
eval "$ENV_VARS"
psql
psql "$@"
9 changes: 7 additions & 2 deletions terraform/aks/app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ resource "kubernetes_job" "migrations" {
container {
name = "cli"
image = var.docker_image
command = ["trscli"]
args = ["migrate-db", "--connection-string", "$(CONNECTION_STRING)"]
command = ["/bin/ash"]
args = ["-c", "./db.sh -c 'alter user $(PG_USER) with replication;'; trscli migrate-db --connection-string $(CONNECTION_STRING);"]

env {
name = "CONNECTION_STRING"
value = module.postgres.dotnet_connection_string
}

env {
name = "PG_USER"
value = module.postgres.username
}
}

restart_policy = "Never"
Expand Down

0 comments on commit d864d6d

Please sign in to comment.