-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add postgres db for staging and production
- Loading branch information
David Wilby
committed
Oct 6, 2021
1 parent
3336304
commit c74e058
Showing
6 changed files
with
231 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<EOSQL | ||
CREATE USER $DJANGO_DB_USER WITH PASSWORD '$DJANGO_DB_PASSWORD'; | ||
CREATE DATABASE $DJANGO_DB_NAME; | ||
GRANT ALL PRIVILEGES ON DATABASE $DJANGO_DB_NAME TO $DJANGO_DB_USER; | ||
CREATE USER $DB_BACKUP_USER WITH PASSWORD '$DB_BACKUP_PASSWORD'; | ||
GRANT CONNECT ON DATABASE $DJANGO_DB_NAME TO $DB_BACKUP_USER; | ||
GRANT USAGE ON SCHEMA public TO $DB_BACKUP_USER; | ||
EOSQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
# | ||
# Run Django migrations against the postgresql container to create the initial | ||
# schema or migrate after an upgrade | ||
# | ||
|
||
docker-compose run --rm --entrypoint "python" backend manage.py migrate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters