Skip to content

Commit

Permalink
Restore working environment
Browse files Browse the repository at this point in the history
  • Loading branch information
ikks committed Jun 18, 2019
1 parent 4f9ceec commit acec986
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM python:3.6

RUN apt-get update
RUN apt-get install -y libpq-dev libxml2-dev libxmlsec1-dev libxmlsec1-openssl influxdb-client
RUN apt-get install -y libpq-dev libxml2-dev libxmlsec1-dev libxmlsec1-openssl influxdb-client binutils libproj-dev gdal-bin

RUN pip install --upgrade pip
ENV app /canairio

RUN mkdir $app
WORKDIR $app

ADD . $app
RUN pip install -r requirements.txt
RUN python manage.py migrate

COPY start $app/start
4 changes: 4 additions & 0 deletions Dockerfile_timescaledb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM timescale/timescaledb-postgis:latest-pg11
ARG db_name
ENV POSTGRES_DB $db_name
COPY create-dbs.sh /docker-entrypoint-initdb.d/
2 changes: 1 addition & 1 deletion canairio/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'canairio.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'canairio.settings.production')

application = get_wsgi_application()
12 changes: 12 additions & 0 deletions create-dbs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -ex

POSTGRES="psql --username ${POSTGRES_USER}"

echo "Creating database: ${POSTGRES_DB}"
echo "Creating database: ${POSTGRES_TEST_DB}"

$POSTGRES <<EOSQL
CREATE DATABASE "${POSTGRES_DB}" OWNER "${POSTGRES_USER}";
CREATE DATABASE "${POSTGRES_TEST_DB}" OWNER "${POSTGRES_USER}";
EOSQL
5 changes: 0 additions & 5 deletions scripts/dev_settings_local.py

This file was deleted.

4 changes: 2 additions & 2 deletions start
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
sleep 2
influx -host $INFLUXDB_HOST -precision rfc3339 -execute 'CREATE DATABASE canairio'
pip install -r requirements.txt
influx -host $INFLUXDB_HOST -precision rfc3339 -execute 'CREATE DATABASE '$INFLUXDB_DATABASE
python manage.py migrate

while [ 1 ]; do
date
Expand Down

0 comments on commit acec986

Please sign in to comment.