-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): add postgres as a compose service
- Loading branch information
Showing
6 changed files
with
80 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,7 @@ secrets.json | |
!.gitignore | ||
!.github | ||
|
||
dist/ | ||
dist/ | ||
|
||
# Docker container volumes | ||
volumes |
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,7 @@ | ||
DATABASE_NAME=django | ||
DATABASE_USER=django | ||
DATABASE_PASSWORD=django_postgres | ||
DJANGO_SUPERUSER_PASSWORD=rseadmindjango | ||
DATABASE_HOST=db | ||
DATABASE_PORT=5432 | ||
DEV_CONTAINER=True |
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,24 @@ | ||
#!/bin/bash | ||
|
||
# Configure postgres database | ||
# This should probably be run as the postgres user | ||
|
||
# Options | ||
user=django | ||
database_name=django | ||
password=django_postgres | ||
|
||
# Create the role | ||
psql -c "create role $user with login password '$password';" | ||
|
||
# Create the database | ||
createdb --owner=django $database_name | ||
|
||
# Give the user permission to create databases. | ||
# This is required for Django testing: | ||
# https://docs.djangoproject.com/en/4.0/topics/testing/overview/#the-test-database | ||
echo "Granting $user user permission to create databases..." | ||
psql -c "ALTER ROLE $user CREATEDB" | ||
echo "You might also need to apply migrations." | ||
|
||
|