Skip to content

Commit

Permalink
Merge pull request #10 from internetstandards/docker
Browse files Browse the repository at this point in the history
Add configuration for deployment
  • Loading branch information
aequitas authored Nov 20, 2024
2 parents be358d5 + db62d2d commit e86484c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ services:
ports:
- 8001:8001
environment:
DEBUG: "False"
CTLSSA_SECRET_KEY: '1'
CTLSSA_DJANGO_DATABASE: production
CTLSSA_DB_ENGINE: postgresql_psycopg2
CTLSSA_DB_HOST: db
CTLSSA_CERTSTREAM_SERVER_URL: ws://certstream:4000
labels:
- "traefik.enable=true"
- "traefik.http.routers.ctlssa.rule='Host(`${CTLSSA_HOSTNAME}`) && PathPrefix(`/ctlssa`)"
- "traefik.http.routers.ctlssa.priority=20"
- "traefik.http.routers.ctlssa.entrypoints=websecure"

# uwsgi reloads on SIGTERM, so use SIGINT instead
# https://uwsgi-docs.readthedocs.io/en/latest/Management.html#signals-for-controlling-uwsgi
stop_signal: SIGINT
Expand All @@ -47,6 +54,7 @@ services:
develop: *app_develop
image: ghcr.io/internetstandards/ctlssa:latest
environment:
DEBUG: "False"
CTLSSA_SECRET_KEY: '1'
CTLSSA_DJANGO_DATABASE: production
CTLSSA_DB_ENGINE: postgresql_psycopg2
Expand Down
5 changes: 3 additions & 2 deletions src/ctlssa/app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
SECRET_KEY: str = os.environ.get("SECRET_KEY", "_dzlo^9d#ox6!7c9rju@=u8+4^sprqocy3s*l*ejc2yr34@&98")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.environ.get("DEBUG", "False").lower() == "true"

ALLOWED_HOSTS = os.environ.get("CTLSSA_ALLOWED_HOSTS", "").split(",")
CTLSSA_HOSTNAME = os.environ.get("CTLSSA_HOSTNAME", "localhost:8001")
ALLOWED_HOSTS = os.environ.get("CTLSSA_ALLOWED_HOSTS", f"{CTLSSA_HOSTNAME}").split(",")


# Application definition
Expand Down
2 changes: 2 additions & 0 deletions src/ctlssa/suggestions/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@

urlpatterns = [
path("", views.suggest, name="suggest"),
# make available under alternative path for when reverse proxied under prefix
path("ctlssa", views.suggest, name="suggest"),
]

0 comments on commit e86484c

Please sign in to comment.