Skip to content
Snippets Groups Projects
Commit 787443e4 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

settings and secrets to env.vars

parent 4cf1bd6f
No related branches found
No related tags found
4 merge requests!39Dev nico,!17pre-deploy to acceptance,!10Dev nico,!9Dev nico
Pipeline #9307 passed
from atdb.settings.base import * from atdb.settings.base import *
import os
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
...@@ -34,12 +36,10 @@ if SSL_ENABLED: ...@@ -34,12 +36,10 @@ if SSL_ENABLED:
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'atdb_admin', 'USER': os.environ['DATABASE_USER'],
'PASSWORD': 'atdb123', 'PASSWORD': os.environ['DATABASE_PASSWORD'],
# database runs locally in postgres # database runs locally in postgres
# 'NAME': 'atdb_trunk',
#'NAME': 'atdb_04oct2019',
'NAME': 'atdb_ldv', 'NAME': 'atdb_ldv',
'HOST': 'localhost', 'HOST': 'localhost',
'PORT': '', 'PORT': '',
......
from atdb.settings.base import * from atdb.settings.base import *
import os
# Import production setting must remain False. # Import production setting must remain False.
DEBUG = True DEBUG = True
...@@ -6,29 +7,6 @@ DEBUG = True ...@@ -6,29 +7,6 @@ DEBUG = True
ALLOWED_HOSTS = ["*"] ALLOWED_HOSTS = ["*"]
#####################################################
# These settings mainly deal with https.
# See http://django-secure.readthedocs.io/en/latest/middleware.html
# Check the warning and instructions with:
# (.env) atdb@/var/.../atdb ./manage.py check --deploy --settings=atdb.settings.prod
#####################################################
# Assume SSL is correctly set up.
SSL_ENABLED = False
if SSL_ENABLED:
# True: Django now checks that cookies are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#session-cookie-secure
SESSION_COOKIE_SECURE = True
# True: Django now checks that csrf tokens are ONLY sent over SSL.
# https://docs.djangoproject.com/en/1.11/ref/settings/#csrf-cookie-secure
CSRF_COOKIE_SECURE = True
# True: Always redirect requests back to https (currently ignored as Nginx should enforces https).
# Alternatively, enable and add set SECURE_PROXY_SSL_HEADER.
SECURE_SSL_REDIRECT = False
# Setting this to a non-zero value, will default the client UA always to connect over https.
# Unclear how or if this possibly affects other *.astron.nl domains. Especially, if these do
# not support https whether this option then breaks those http-only locations.
# SECURE_HSTS_SECONDS = 31536000
# True: Enables a header that disables the UA from 'clever' automatic mime type sniffing. # True: Enables a header that disables the UA from 'clever' automatic mime type sniffing.
# http://django-secure.readthedocs.io/en/latest/settings.html#secure-content-type-nosniff # http://django-secure.readthedocs.io/en/latest/settings.html#secure-content-type-nosniff
# https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff # https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff
...@@ -46,21 +24,13 @@ X_FRAME_OPTIONS = 'DENY' ...@@ -46,21 +24,13 @@ X_FRAME_OPTIONS = 'DENY'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'dbadmin', 'NAME': os.environ['DATABASE_NAME'],
'PASSWORD': 'dbadmin123', 'HOST': os.environ['DATABASE_HOST'],
'PORT': os.environ['DATABASE_PORT'],
# database runs locally in postgres 'USER' : os.environ['DATABASE_USER'],
# 'NAME': 'atdb', 'PASSWORD' : os.environ['DATABASE_PASSWORD'],
# 'HOST': 'sdc.astron.nl',
# 'PORT': '5432',
# database runs in docker container,
# HOST is the service name as specified in the docker-compose file
# 'NAME': 'atdb',
'NAME': 'atdbldv',
'HOST': 'atdb-ldv-db',
'PORT': '5432',
}, },
} }
......
from atdb.settings.base import *
# Import production setting must remain False.
DEBUG = False
ALLOWED_HOSTS = ["*"]
# True: Enables a header that disables the UA from 'clever' automatic mime type sniffing.
# http://django-secure.readthedocs.io/en/latest/settings.html#secure-content-type-nosniff
# https://stackoverflow.com/questions/18337630/what-is-x-content-type-options-nosniff
SECURE_CONTENT_TYPE_NOSNIFF = True
# True: Enables a header that tells the UA to switch on the XSS filter.
# http://django-secure.readthedocs.io/en/latest/middleware.html#x-xss-protection-1-mode-block
SECURE_BROWSER_XSS_FILTER = True
# Prevents the site from being deployed within a iframe.
# This prevent click-jacking attacks.
# See; https://docs.djangoproject.com/en/1.11/ref/clickjacking/
X_FRAME_OPTIONS = 'DENY'
#####################################################
DATABASE_PASSWORD = os.environ['DATABASE_PASSWORD']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'atdbldv',
'HOST': 'sdc-db.astron.nl',
'PORT': '5432',
'USER': 'atdb',
'PASSWORD': 'atdb_ldv_2021',
},
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = []
...@@ -39,4 +39,6 @@ services: ...@@ -39,4 +39,6 @@ services:
depends_on: depends_on:
- atdb-ldv-db - atdb-ldv-db
env_file:
- $HOME/shared/atdb_ldv.env
restart: always restart: always
...@@ -28,8 +28,6 @@ services: ...@@ -28,8 +28,6 @@ services:
atdb-backend: atdb-backend:
container_name: atdb-ldv container_name: atdb-ldv
image: atdb-ldv:latest image: atdb-ldv:latest
# ports:
# - "8010:8010"
expose: expose:
- "8000" - "8000"
networks: networks:
...@@ -42,7 +40,8 @@ services: ...@@ -42,7 +40,8 @@ services:
- "traefik.http.routers.atdb-backend.service=atdb-backend" - "traefik.http.routers.atdb-backend.service=atdb-backend"
- "traefik.http.routers.atdb-backend.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/atdb`)" - "traefik.http.routers.atdb-backend.rule=Host(`sdc-dev.astron.nl`) && PathPrefix(`/atdb`)"
- "traefik.http.services.atdb-backend.loadbalancer.server.port=8000" - "traefik.http.services.atdb-backend.loadbalancer.server.port=8000"
depends_on: depends_on:
- atdb-ldv-db - atdb-ldv-db
env_file:
- $HOME/shared/atdb_ldv.env
restart: always restart: always
version: '3.4'
networks:
atdb_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
atdb-backend:
container_name: atdb-ldv
image: git.astron.nl:5000/astron-sdc/atdb-ldv:latest
expose:
- "8000"
networks:
- traefik_proxy
- atdb_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.atdb-backend.entryPoints=atdb-ldv"
- "traefik.http.routers.atdb-backend.service=atdb-backend"
- "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)"
- "traefik.http.services.atdb-backend.loadbalancer.server.port=8000"
restart: always
version: '3.4'
networks:
atdb_network:
traefik_proxy:
external:
name: traefik_proxy
default:
driver: bridge
services:
atdb-backend:
container_name: atdb-ldv
image: atdb-ldv:latest
expose:
- "8000"
networks:
- traefik_proxy
- atdb_network
labels:
- "traefik.enable=true"
- "traefik.http.routers.atdb-backend.entryPoints=atdb-ldv"
- "traefik.http.routers.atdb-backend.service=atdb-backend"
- "traefik.http.routers.atdb-backend.rule=Host(`sdc.astron.nl`) && PathPrefix(`/atdb`)"
- "traefik.http.services.atdb-backend.loadbalancer.server.port=8000"
restart: always
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
</div> </div>
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
<p class="footer"> Version 1.0.0 (8 feb 2021 - 13:00) <p class="footer"> Version 1.0.0 (11 feb 2021 - 12:00)
<script type="text/javascript"> <script type="text/javascript">
(function(seconds) { (function(seconds) {
var refresh, var refresh,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment