Get site running on staging domain.

This commit is contained in:
jmsgrogan 2024-02-18 17:20:38 +00:00
parent 4be5e93c9c
commit 7ba077608c
5 changed files with 49 additions and 11 deletions

View file

@ -13,16 +13,40 @@ services:
env_file:
- ./.env.prod
nginx:
nginx-proxy:
container_name: nginx-proxy
build: ./nginx
restart: always
ports:
- 8080:80
- 443:443
- 80:80
volumes:
- static_volume:/staticfiles
- media_volume:/mediafiles
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- /var/run/docker.sock:/tmp/docker.sock:ro
depends_on:
- web
acme-companion:
image: docker.io/nginxproxy/acme-companion
env_file:
- ./.env.prod.proxy-companion
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- acme:/etc/acme.sh
depends_on:
- nginx-proxy
volumes:
static_volume:
media_volume:
certs:
html:
vhost:
acme:

View file

@ -19,19 +19,19 @@ services:
restart: always
ports:
- 443:443
- 8080:80
- 80:80
volumes:
- static_volume:/staticfiles
- media_volume:/mediafiles
- certs:/etc/nginx/certs
- html:/usr/share/nginx/html
- vhost:/etc/nginx/vhost.d
- /var/run/docker.sock:/tmp/docker/sock:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
depends_on:
- web
acme-companion:
image: nginxproxy/acme-companion
image: docker.io/nginxproxy/acme-companion
env_file:
- ./.env.staging.proxy-companion
volumes:

View file

@ -1,3 +1,4 @@
FROM docker.io/nginxproxy/nginx-proxy
COPY vhost.d/default /etc/nginx/vhost.d/default
COPY custom.conf /etc/nginx/conf.d/custom.conf

View file

@ -3,4 +3,5 @@
content="width=device-width, initial-scale=1">
{% load static %}
<link rel="shortcut icon" type="image/png" href="{% static 'primary/favicon.ico' %}"/>
<link rel="stylesheet" href="{% static 'primary/style.css' %}">

View file

@ -22,9 +22,11 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get("SECRET_KEY")
DEBUG = bool(os.environ.get("DEBUG", default=0))
#DEBUG = bool(os.environ.get("DEBUG", default=0))
#DEBUG=True
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
if "DJANGO_ALLOWED_HOSTS" in os.environ:
ALLOWED_HOSTS = os.environ.get("DJANGO_ALLOWED_HOSTS").split(" ")
# Application definition
@ -112,17 +114,27 @@ USE_I18N = True
USE_TZ = True
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ")
if "CSRF_TRUSTED_ORIGINS" in os.environ:
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ")
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / "staticfiles"
if "DJANGO_STATIC_ROOT" in os.environ:
STATIC_ROOT = os.environ.get("DJANGO_STATIC_ROOT")
else:
STATIC_ROOT = BASE_DIR / "staticfiles"
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR / "mediafiles"
if "DJANGO_MEDIA_ROOT" in os.environ:
MEDIA_ROOT = os.environ.get("DJANGO_MEDIA_ROOT")
else:
MEDIA_ROOT = BASE_DIR / "mediafiles"
# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field