From 51e6e2df466ba03e71a3a737c83affbb587d3733 Mon Sep 17 00:00:00 2001 From: Maxwell Date: Mon, 25 Sep 2023 17:42:34 +0200 Subject: [PATCH] Update docker configuration --- .idea/{anitrend-relations-py.iml => anitrend.iml} | 2 +- .idea/misc.xml | 2 +- .idea/vcs.xml | 6 ------ Dockerfile | 7 ++----- app/settings/production.py | 2 +- docker-compose.yml | 5 ----- start-q.sh | 6 ++++++ start-server.sh | 6 ++++++ 8 files changed, 17 insertions(+), 19 deletions(-) rename .idea/{anitrend-relations-py.iml => anitrend.iml} (77%) delete mode 100644 .idea/vcs.xml create mode 100644 start-q.sh create mode 100644 start-server.sh diff --git a/.idea/anitrend-relations-py.iml b/.idea/anitrend.iml similarity index 77% rename from .idea/anitrend-relations-py.iml rename to .idea/anitrend.iml index 7c0e379..397d297 100644 --- a/.idea/anitrend-relations-py.iml +++ b/.idea/anitrend.iml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index d72aa69..0e8efe4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 140cbf4..9245e5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,17 +31,14 @@ RUN mkdir tmp # Stage 2: Django Server stage FROM builder AS django-server -# Run Django's migrations -RUN python manage.py migrate - # Expose the port your Django app will run on EXPOSE 8800 # Start Django server -CMD ["python", "manage.py", "runserver", "0.0.0.0:8800"] +CMD start-server.sh # Stage 3: Django Q Cluster stage FROM builder AS django-q-cluster # Start Django Q scheduler and worker -CMD ["python", "manage.py", "qcluster"] +CMD start-q.sh diff --git a/app/settings/production.py b/app/settings/production.py index 50f60a5..d121221 100644 --- a/app/settings/production.py +++ b/app/settings/production.py @@ -12,7 +12,7 @@ from .common import * -ALLOWED_HOSTS = ["anitrend.co"] +ALLOWED_HOSTS = ["graphql.anitrend.co"] DATABASES = { "default": { diff --git a/docker-compose.yml b/docker-compose.yml index 3e9ce98..1afef55 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,11 +23,6 @@ services: dockerfile: Dockerfile networks: - traefik-network - labels: - - "traefik.enable=true" - - "traefik.http.routers.django-q-cluster.rule=Host(`${DOMAIN}`) && Path(`/q/`)" - - "traefik.http.routers.django-q-cluster.entrypoints=web" - - "traefik.http.services.django-q-cluster.loadbalancer.server.port=8800" depends_on: - db diff --git a/start-q.sh b/start-q.sh new file mode 100644 index 0000000..fef2d9a --- /dev/null +++ b/start-q.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +echo "Setting running migrations" +python manage.py migrate +echo "Starting qcluster" +python manage.py qcluster \ No newline at end of file diff --git a/start-server.sh b/start-server.sh new file mode 100644 index 0000000..acd3bf4 --- /dev/null +++ b/start-server.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +echo "Setting running migrations" +python manage.py migrate +echo "Starting server" +python manage.py runserver 0.0.0.0:8800 \ No newline at end of file