From 41c455ec203d5827e12b5ccc478cc744333faf0f Mon Sep 17 00:00:00 2001 From: Joshua May Date: Sat, 31 Aug 2019 22:04:58 -0700 Subject: [PATCH] Hey, we can actually get the database set up when we launch with Docker now. Whoops. --- .env.example | 2 ++ Dockerfile | 2 -- bin/wait-for-it.sh | 0 docker-compose.development.yml | 9 ++++++++- manage.py | 7 ++++++- 5 files changed, 16 insertions(+), 4 deletions(-) mode change 100644 => 100755 bin/wait-for-it.sh diff --git a/.env.example b/.env.example index 6e70c07..a80b980 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,6 @@ FLASK_CONFIG=heroku +# TWITTER_CONSUMER_KEY= +# TWITTER_CONSUMER_SECRET= # default development database via Docker: # DEV_DATABASE_URL=postgresql://postgres:plop@sirius-database/sirius-dev \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3dda9b3..8595645 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,5 +21,3 @@ RUN pip install honcho EXPOSE 5000 ADD . . - -ENTRYPOINT honcho start diff --git a/bin/wait-for-it.sh b/bin/wait-for-it.sh old mode 100644 new mode 100755 diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 6f93d16..a3e7677 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -6,7 +6,13 @@ services: - 5000:5000 depends_on: - sirius-database - command: ["/bin/wait-for-it.sh", "db:5342", "--", "./manage.py db upgrade"] + command: + [ + "bin/wait-for-it.sh", + "sirius-database:5432", + "--", + "bin/docker-entrypoint.sh", + ] environment: - VIRTUAL_HOST=sirius.localhost @@ -17,6 +23,7 @@ services: ports: - "32770:5432" environment: + - POSTGRES_DB=sirius-dev - POSTGRES_PASSWORD=plop sirius-web: diff --git a/manage.py b/manage.py index 0105f2c..6aff4cf 100755 --- a/manage.py +++ b/manage.py @@ -1,11 +1,16 @@ #!/usr/bin/env python2.7 import os, sys +import re if os.path.exists('.env'): print('Importing environment from .env...') + regex = re.compile(r"#.*$") # strip comments for line in open('.env'): - name, value = line.strip().split('=', 1) + kv = regex.sub("", line).strip() + if '=' not in kv: + continue + name, value = kv.split('=', 1) os.environ[name] = value from sirius.web import webapp -- 2.47.3