diff --git a/docker-compose.yml b/docker-compose.yml index 1598e39..51c480a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,21 +6,27 @@ services: volumes: - ./data/db:/var/lib/postgresql/data environment: - - POSTGRES_NAME=postgres + - POSTGRES_NAME=sigi - POSTGRES_USER=sigi - - POSTGRES_PASSWORD=123456 - code: + - POSTGRES_PASSWORD=sigi + - PGDATA=var/lib/postgresql/data + networks: + - sigi-net + sigi: build: . command: python manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - - "8000:8000" + - "8001:8000" environment: - DB_HOST=db - POSTGRES_NAME=postgres - POSTGRES_USER=sigi - - POSTGRES_PASSWORD=132456 + - POSTGRES_PASSWORD=sigi depends_on: - db - +networks: + sigi-net: + name: sigi-net + driver: bridge \ No newline at end of file diff --git a/nginx.default b/nginx.default new file mode 100644 index 0000000..46684a6 --- /dev/null +++ b/nginx.default @@ -0,0 +1,15 @@ +# nginx.default + +server { + listen 8020; + server_name example.org; + + location / { + proxy_pass http://127.0.0.1:8010; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + location /static { + root ./; + } +} \ No newline at end of file diff --git a/start-server.sh b/start-server.sh new file mode 100755 index 0000000..55ad5dd --- /dev/null +++ b/start-server.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# start-server.sh +if [ -n "$DJANGO_SUPERUSER_USERNAME" ] && [ -n "$DJANGO_SUPERUSER_PASSWORD" ] ; then + (.; python manage.py createsuperuser --no-input) +fi +(. ; gunicorn sigi.wsgi --user www-data --bind 0.0.0.0:8010 --workers 3) & +nginx -g "sigi off;" \ No newline at end of file