-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐳 [maykinmedia/django-setup-configuration#1] add setup_configuration …
…into docker
- Loading branch information
1 parent
d5ea12d
commit 9109e7e
Showing
5 changed files
with
48 additions
and
6 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/bash | ||
|
||
# setup initial configuration using environment variables | ||
# Run this script from the root of the repository | ||
|
||
#set -e | ||
${SCRIPTPATH}/wait_for_db.sh | ||
|
||
src/manage.py migrate | ||
src/manage.py setup_configuration --no-selftest |
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,15 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Wait for the database container | ||
# See: https://docs.docker.com/compose/startup-order/ | ||
export PGHOST=${DB_HOST:-db} | ||
export PGPORT=${DB_PORT:-5432} | ||
|
||
until pg_isready; do | ||
>&2 echo "Waiting for database connection..." | ||
sleep 1 | ||
done | ||
|
||
>&2 echo "Database is up." |
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 |
---|---|---|
|
@@ -11,19 +11,36 @@ services: | |
|
||
web: | ||
build: . | ||
environment: | ||
environment: &app-env | ||
- DJANGO_SETTINGS_MODULE=objects.conf.docker | ||
- SECRET_KEY=${SECRET_KEY:-1(@f(-6s_u(5fd&1sg^uvu2s(c-9sapw)1era8q&)g)h@cwxxg} | ||
- OBJECTS_SUPERUSER_USERNAME=admin | ||
- OBJECTS_SUPERUSER_PASSWORD=admin | ||
- OBJECTS_SUPERUSER_EMAIL=admin@localhost | ||
- ALLOWED_HOSTS=* | ||
# setup_configuration env vars | ||
- OBJECTS_DOMAIN=web:8000 | ||
- OBJECTS_ORGANIZATION=Objects | ||
- OBJECTTYPES_API_ROOT=https://objecttypes.example.com/api/v2/ | ||
- OBJECTS_OBJECTTYPES_TOKEN=some-random-string | ||
- DEMO_CONFIG_ENABLE=yes | ||
- DEMO_TOKEN=demo-random-string | ||
- DEMO_PERSON=Demo | ||
- [email protected] | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- db | ||
web-init: | ||
condition: service_completed_successfully | ||
volumes: | ||
- media:/app/media # Shared media volume to get access to saved OAS files | ||
|
||
web-init: | ||
build: . | ||
environment: *app-env | ||
command: /setup_configuration.sh | ||
depends_on: | ||
- db | ||
|
||
volumes: | ||
media: |