aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2018-10-06 22:42:38 +0200
committerGravatar Johannes Christ <[email protected]>2018-10-06 22:42:38 +0200
commit8b1523b8c484abed432dfd80d4592048e9861405 (patch)
tree29010b57ac42109f4f06546516217fe74942ca6e /docker
parentUse proper keyword argument. (diff)
Update the compose file and dockerapp file.
The development app from the compose file will now apply migrations on boot and additionally, it will use Django's development server along with the current directory mounted read-only into the container in order to support code reloading, helpful while development.
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/app/migrate_and_serve.sh13
-rw-r--r--docker/pysite.dockerapp23
2 files changed, 20 insertions, 16 deletions
diff --git a/docker/app/migrate_and_serve.sh b/docker/app/migrate_and_serve.sh
new file mode 100755
index 00000000..7c20130b
--- /dev/null
+++ b/docker/app/migrate_and_serve.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+### NOTE
+# This file is intended to be used by local setups.
+# You do not want to run the Django development server
+# in production. The default Dockerfile command will
+# run using uWSGI, this script is provided purely as
+# a convenience to run migrations and start a development server.
+
+echo [i] Applying migrations.
+python manage.py migrate --verbosity 0
+echo [i] Starting server.
+python manage.py runserver
diff --git a/docker/pysite.dockerapp b/docker/pysite.dockerapp
index 4a811861..dc472b2e 100644
--- a/docker/pysite.dockerapp
+++ b/docker/pysite.dockerapp
@@ -1,8 +1,8 @@
-version: 0.1.0
+version: 0.3.0
name: pysite
description: |
Our community website, built on Django and PostgreSQL.
-#namespace: python-discord
+namespace: python-discord
maintainers:
- name: Johannes Christ
@@ -11,15 +11,16 @@ maintainers:
version: "3.6"
services:
django:
- image: registry.gitlab.com/python-discord/projects/site/django:latest
+ build:
+ context: .
+ command: docker/app/migrate_and_serve.sh
ports:
- "127.0.0.1:4000:4000"
environment:
DATABASE_URL: "postgres://${pg_user}:${pg_passwd}@${pg_host}/${pg_db}"
- DEBUG: 0
+ DEBUG: 'false'
SECRET_KEY: "${secret_key}"
depends_on:
- - migrator
- postgres
postgres:
@@ -29,20 +30,10 @@ services:
POSTGRES_USER: "${pg_user}"
POSTGRES_PASSWORD: "${pg_passwd}"
- migrator:
- image: registry.gitlab.com/python-discord/projects/site/django:latest
- environment:
- DATABASE_URL: "postgres://${pg_user}:${pg_passwd}@${pg_host}/${pg_db}"
- DEBUG: 0
- SECRET_KEY: "${secret_key}"
- command: "python manage.py migrate"
- depends_on:
- - postgres
-
---
pg_user: pysite
pg_db: pysite
-pg_passwd: ''
+pg_passwd: supersecretpassword
pg_host: postgres
secret_key: 'suitable-for-development-only'