From c8851d552faa2d8dfa5df5be20fb3a5d3c2f90f0 Mon Sep 17 00:00:00 2001 From: Matthew Northcott Date: Tue, 28 Mar 2023 13:00:15 +1300 Subject: [PATCH] Update deployment config --- default.env | 9 +++++++-- docker-compose.production.yaml | 15 ++++++++------- docker-compose.yaml | 2 ++ nginx.conf | 4 ---- nginx.production.conf | 11 ++++++----- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/default.env b/default.env index e3b218c..53cb140 100644 --- a/default.env +++ b/default.env @@ -1,9 +1,14 @@ LINZ_API_KEY=myapikey +POSTGRES_DB=postgres +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres DATABASE_NAME=righttree DATABASE_USER=righttree DATABASE_PASSWORD=righttree DATABASE_HOST=postgres -CELERY_BROKER_URL=redis://redis:6379/0 -BASE_URL=localhost:8000 +REDIS_HOST=redis +REDIS_PASSWORD=redis DJANGO_SECRET_KEY=changeme DJANGO_DEBUG_MODE=True +STRIPE_API_KEY=sk_test_key +STRIPE_PRICE_ID=price_priceid diff --git a/docker-compose.production.yaml b/docker-compose.production.yaml index c258def..6aae0bd 100644 --- a/docker-compose.production.yaml +++ b/docker-compose.production.yaml @@ -9,6 +9,8 @@ x-django: &django depends_on: postgres: condition: service_healthy + redis: + condition: service_healthy env_file: .env user: "$UID:$GID" restart: always @@ -31,10 +33,10 @@ services: depends_on: - backend volumes: - - ./nginx.production.conf:/etc/nginx/nginx.conf - - ./backend/right_tree/staticfiles:/etc/nginx/html/staticfiles - - ./frontend/build:/etc/nginx/html/build - - /etc/letsencrypt:/etc/letsencrypt + - ./nginx.production.conf:/etc/nginx/nginx.conf:ro + - ./backend/right_tree/staticfiles:/etc/nginx/html/staticfiles:ro + - ./frontend/build:/etc/nginx/html/build:ro + - /etc/letsencrypt:/etc/letsencrypt:ro ports: - "80:80" - "443:443" @@ -45,9 +47,8 @@ services: container_name: postgres volumes: - righttree-postgres-data:/var/lib/postgresql/data - - ./create_database.sql:/docker-entrypoint-initdb.d/create_database.sql - ports: - - "5432:5432" + expose: + - "5432" environment: - POSTGRES_DB=${POSTGRES_DB} - POSTGRES_USER=${POSTGRES_USER} diff --git a/docker-compose.yaml b/docker-compose.yaml index bfabfc7..905e5eb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,6 +9,8 @@ x-django: &django depends_on: postgres: condition: service_healthy + redis: + condition: service_healthy volumes: - ./backend:/app env_file: .env diff --git a/nginx.conf b/nginx.conf index 882491c..0634bff 100644 --- a/nginx.conf +++ b/nginx.conf @@ -28,9 +28,5 @@ http { proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } - - location ~* \.(eot|otf|ttf|woff|woff2)$ { - add_header Access-Control-Allow-Origin *; - } } } diff --git a/nginx.production.conf b/nginx.production.conf index 3ff7fc3..f5b741d 100644 --- a/nginx.production.conf +++ b/nginx.production.conf @@ -4,22 +4,23 @@ http { server_name _; return 301 https://$host$request_uri; } + server { listen 443 ssl; index index.html; - include /etc/nginx/mime.types; - proxy_set_header Host $http_host; + include /etc/nginx/mime.types; + proxy_set_header Host $http_host; ssl_certificate /etc/letsencrypt/live/rightplant.biospherecapital.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/rightplant.biospherecapital.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/rightplant.biospherecapital.com/chain.pem; location / { - root /etc/nginx/html/build; + root /etc/nginx/html/build; } - + location /staticfiles { - root /etc/nginx/html/; + root /etc/nginx/html/; } location ~* ^/(api|admin) {