Skip to content

Commit

Permalink
Moved log location and broke huey out to a separate container
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 8, 2020
1 parent 8760079 commit 3a395f4
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 59 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ setup.cfg
/cover/
.coverage
debug.log
/docker/configs/ssl-certs/
/docker/configs/shib-certs/
/docker/redis_data/
/docker/volumes/ssl-certs/
/docker/volumes/shib-certs/
/docker/volumes/redis_data/
/docker/volumes/logs/
*.env
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt

COPY . .
COPY appEntrypoint.sh /appEntrypoint.sh
RUN chmod +x /appEntrypoint.sh

EXPOSE 8000
CMD ["/appEntrypoint.sh"]
CMD ["gunicorn", "--workers=5", "--bind=0.0.0.0:8000", "puzzlehunt_server.wsgi:application"]
37 changes: 0 additions & 37 deletions appEntrypoint.sh

This file was deleted.

20 changes: 18 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ services:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- ./docker/db_data:/var/lib/postgresql/data
- ./docker/volumes/db_data:/var/lib/postgresql/data

redis:
image: redis:5-alpine
restart: always
volumes:
- ./docker/redis_data:/data
- ./docker/volumes/redis_data:/data

app:
build:
Expand All @@ -24,11 +24,13 @@ services:
http_proxy:
https_proxy:
no_proxy:
image: django_puzzlehunt # Name image for use in huey
restart: always
volumes:
- .:/code # Enables live modification of django files
- static:/static
- media:/media
- ./docker/volumes/logs:/var/log/external
environment:
- DOMAIN
- DJANGO_SECRET_KEY
Expand All @@ -43,6 +45,20 @@ services:
- db
- redis

huey:
image: django_puzzlehunt # re-use above image
command: bash -c "python /code/manage.py migrate --no-input && python /code/manage.py run_huey --quiet"
restart: always
volumes:
- .:/code
- ./docker/volumes/logs:/var/log/external
environment:
- DJANGO_SECRET_KEY
- DJANGO_SETTINGS_MODULE=puzzlehunt_server.settings.env_settings
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@db/${DB_NAME}
depends_on:
- app

web:
restart: always
build:
Expand Down
1 change: 0 additions & 1 deletion docker/configs/shib-certs/README

This file was deleted.

4 changes: 2 additions & 2 deletions docker/shib_override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ services:
build:
dockerfile: apacheShibDockerfile
volumes:
- ./docker/configs/shib-certs/:/etc/shibboleth/certs/
- ./docker/configs/ssl-certs/:/etc/letsencrypt/
- ./docker/volumes/shib-certs/:/etc/shibboleth/certs/
- ./docker/volumes/ssl-certs/:/etc/letsencrypt/
ports:
- "443"
app:
Expand Down
1 change: 1 addition & 0 deletions docker/volumes/logs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory will hold all of the logs from the various services
1 change: 1 addition & 0 deletions docker/volumes/shib-certs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Put sp-key.pem and sp-cert.pem in this directory when deploying shibboleth
1 change: 1 addition & 0 deletions docker/volumes/ssl-certs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory will hold lets-encrypt data when using shib-override.yml
25 changes: 14 additions & 11 deletions puzzlehunt_server/settings/base_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
LOGIN_URL = 'login_selection'

# Random settings
SILENCED_SYSTEM_CHECKS = ["urls.W005"] # silences admin url override warning
SILENCED_SYSTEM_CHECKS = ["urls.W005"] # silences admin url override warning
CRISPY_TEMPLATE_PACK = 'bootstrap3'
DEBUG_TOOLBAR_PATCH_SETTINGS = False
BOOTSTRAP_ADMIN_SIDEBAR_MENU = True
Expand Down Expand Up @@ -124,23 +124,26 @@
"sn": (False, "sn")
}

# Logging settings
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'noop': {
'level': 'WARNING',
'class': 'logging.NullHandler',
'file': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': '/var/log/external/django.log',
},
},
'loggers': {},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
'loggers': {
'django': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
'simple': {
'format': '%(levelname)s %(message)s'
'huntserver': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
},
}
Expand Down

0 comments on commit 3a395f4

Please sign in to comment.