Production fixes

This commit is contained in:
Stephan Porada 2020-12-04 15:55:11 +01:00
parent 0ea86f3a35
commit 71ab6bc550
7 changed files with 19 additions and 11 deletions

2
.gitignore vendored
View File

@ -15,4 +15,4 @@ static_volume
!**/.gitkeep
.env
live.env

View File

@ -18,8 +18,8 @@ RUN pip install -r requirements.txt
COPY . /usr/src/app/
# add wait for it
RUN git clone https://github.com/vishnubob/wait-for-it.git /wait-for-it
RUN chmod a+x /wait-for-it/wait-for-it.sh
RUN git clone https://github.com/vishnubob/wait-for-it.git
RUN chmod a+x wait-for-it/wait-for-it.sh
# add entry point
COPY ./django-entrypoint.sh django-entrypoint.sh

View File

@ -31,7 +31,7 @@ SESSION_COOKIE_SECURE = True
# CHANGE the hosts according to your settings.
ALLOWED_HOSTS = ["127.0.0.1", "localhost", "192.168.0.14", "bundesdata.sporada.eu"]
ALLOWED_HOSTS = ["127.0.0.1", "localhost", "0.0.0.0", "bundesdata.sporada.eu"]
# Application definition
@ -135,7 +135,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = '/staticfiles/'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# WATSON

View File

@ -2,4 +2,5 @@
python manage.py collectstatic --noinput
python manage.py makemigrations --noinput
python manage.py migrate --noinput
python manage.py runserver 0.0.0.0:8000
exec "$@"

View File

@ -4,17 +4,23 @@ services:
web:
build: ./app
volumes:
- ./app/:/usr/src/app/
- ./app/blog:/usr/src/app/blog
- ./app/bundesdata_app:/usr/src/app/bundesdata_app
- ./app/ngram_viewer:/usr/src/app/ngram_viewer
- ./app/speakers:/usr/src/app/speakers
- ./app/speeches:/usr/src/app/speeches
- ./input_volume/:/usr/src/app/input_data
- ./static_volume:/usr/src/app/staticfiles
expose:
- 8000
env_file: .env
env_file: live.env
depends_on:
- db
command: ["./wait-for-it.sh", "db:5432", "--strict", "--timeout=0"]
command: >
bash -c "./wait-for-it/wait-for-it.sh db:5432 --strict --timeout=0
&& gunicorn --bind 0.0.0.0:8000 --workers=4 bundesdata_app.wsgi:application"
db:
env_file: .env
env_file: live.env
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_USER: ${POSTGRES_USER}

View File

@ -2,6 +2,7 @@
### Django settings ###
SECRET_KEY=secretkey
DEBUG=False
### Postgress DB ###
POSTGRES_PASSWORD=password

View File

@ -13,7 +13,7 @@ server {
proxy_redirect off;
}
location /staticfiles/ {
location /static/ {
alias /usr/src/app/staticfiles/;
}
}