From 8dd295fa1b43c494010758f4c3773df380a3204d Mon Sep 17 00:00:00 2001 From: Topvennie Date: Tue, 12 Mar 2024 19:00:32 +0100 Subject: [PATCH] chore: cleanup --- .dev.env | 1 - backend/Dockerfile.dev | 3 +++ backend/notifications/logic.py | 1 - backend/ypovoli/settings.py | 2 +- data/nginx/nginx.prod.conf | 12 ------------ development.sh | 8 ++++++-- development.yml | 4 ++-- 7 files changed, 12 insertions(+), 19 deletions(-) diff --git a/.dev.env b/.dev.env index 52cc4f46..53902a7f 100644 --- a/.dev.env +++ b/.dev.env @@ -15,7 +15,6 @@ DJANGO_SECRET_KEY= DJANGO_DEBUG=True DJANGO_BASE_URL="https://localhost:8080" DJANGO_DB_ENGINE=django.db.backends.sqlite3 -DJANGO_DB_NAME=${BACKEND_DIR}/db.sqlite3 DJANGO_REDIS_HOST=${REDIS_IP} DJANGO_REDIS_PORT=${REDIS_PORT} DJANGO_REDIS_PASSWORD=${REDIS_PASSWORD} \ No newline at end of file diff --git a/backend/Dockerfile.dev b/backend/Dockerfile.dev index 0365d5f9..75a7bf99 100644 --- a/backend/Dockerfile.dev +++ b/backend/Dockerfile.dev @@ -11,3 +11,6 @@ COPY requirements.txt /code/ RUN pip install -r requirements.txt COPY . /code/ + +RUN ./setup.sh + diff --git a/backend/notifications/logic.py b/backend/notifications/logic.py index b5df6d18..d8999ad8 100644 --- a/backend/notifications/logic.py +++ b/backend/notifications/logic.py @@ -1,6 +1,5 @@ import threading from collections import defaultdict -from os import error from smtplib import SMTPException from typing import DefaultDict, Dict, List diff --git a/backend/ypovoli/settings.py b/backend/ypovoli/settings.py index a57ea885..19ddd545 100644 --- a/backend/ypovoli/settings.py +++ b/backend/ypovoli/settings.py @@ -30,7 +30,7 @@ # SECURITY WARNING: don't run with debug turned on in production! DEBUG = environ.get("DJANGO_DEBUG", "False").lower() in ["true", "1", "t"] -ALLOWED_HOSTS = ["sel2-7.ugent.be"] +ALLOWED_HOSTS = ["localhost", "sel2-7.ugent.be"] # Application definition diff --git a/data/nginx/nginx.prod.conf b/data/nginx/nginx.prod.conf index 2518e7d4..042f9859 100644 --- a/data/nginx/nginx.prod.conf +++ b/data/nginx/nginx.prod.conf @@ -20,18 +20,6 @@ http { } } - server { - listen 8080 ssl; - listen [::]:8080 ssl; - - ssl_certificate ssl/certificate.crt; - ssl_certificate_key ssl/private.key; - - location / { - return 301 https://$host$request_uri; - } - } - server { listen 443 ssl; listen [::]:443 ssl; diff --git a/development.sh b/development.sh index 210027f6..8b7780b4 100755 --- a/development.sh +++ b/development.sh @@ -1,6 +1,10 @@ +echo "Checking environment file..." + if ! [ -f .env ]; then - echo "Error: .env file does not exist." - exit 1 + cp .dev.env .env + read -s -p "Enter a random string for the django secret (just smash keyboard): " new_secret + sed -i "s/^DJANGO_SECRET_KEY=.*/DJANGO_SECRET_KEY=$new_secret/" .env + echo "Created environment file" fi echo "Checking for existing SSL certificates..." diff --git a/development.yml b/development.yml index 2723a878..7c093801 100644 --- a/development.yml +++ b/development.yml @@ -49,7 +49,7 @@ services: container_name: backend build: context: $BACKEND_DIR - dockerfile: Dockerfile + dockerfile: Dockerfile.dev command: /bin/bash -c "./setup.sh && python manage.py runsslserver 192.168.90.2:8080" expose: - 8080 @@ -92,7 +92,7 @@ services: ipv4_address: $REDIS_IP expose: - $REDIS_PORT - entrypoint: redis-server --appendonly yes --requirepass $REDIS_PASSWORD --maxmemory 512mb --maxmemory-policy allkeys-lru + entrypoint: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru volumes: - $DATADIR/redis:/data \ No newline at end of file