1
0
mirror of https://github.com/daniviga/bite.git synced 2025-04-18 22:00:11 +02:00

Add a production conf

This commit is contained in:
Daniele Viganò 2020-06-15 22:06:54 +02:00
parent 731af262f3
commit 6a10c4fc0d
Signed by: dani
GPG Key ID: DB49AFC03C40EE02
4 changed files with 92 additions and 24 deletions

View File

@ -19,7 +19,7 @@ services:
networks:
- net
ports:
- "127.0.0.1:123:123/udp"
- "123:123/udp"
timescale:
<<: *service_default
@ -34,20 +34,6 @@ services:
ports:
- "127.0.0.1:5432:5432"
# mosquitto simple deployment
# mqtt:
# <<: *service_default
# # image: vernemq/vernemq
# # environment:
# # DOCKER_VERNEMQ_ALLOW_ANONYMOUS: "on"
# # DOCKER_VERNEMQ_ACCEPT_EULA: "yes"
# image: eclipse-mosquitto
# networks:
# - net
# ports:
# - "1883:1883"
# # - "9001:9001" # mqtt via websocket
rabbitmq:
<<: *service_default
image: rabbitmq:3-management-alpine
@ -61,16 +47,56 @@ services:
- net
ports:
- "1883:1883"
- "5672:5672"
- "15672:15672"
edge:
# edge:
# <<: *service_default
# image: docker:dind
# privileged: true
# environment:
# DOCKER_TLS_CERTDIR:
# networks:
# - net
# ports:
# - "127.0.0.1:22375:2375"
freedcs:
<<: *service_default
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR:
build:
context: ..
dockerfile: ./docker/django/Dockerfile
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
networks:
- net
ports:
- "127.0.0.1:22375:2375"
- "8000:8000"
depends_on:
- data-migration
- timescale
data-migration:
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "migrate", "--noinput"]
networks:
- net
mqtt-to-db:
<<: *service_default
image: daniviga/freedcs
volumes:
- "../freedcs:/srv/freedcs"
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
command: ["python3", "manage.py", "mqtt-to-db"]
networks:
- net
depends_on:
- data-migration
- timescale
- rabbitmq

View File

@ -0,0 +1,27 @@
from freedcs import settings
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i4z%50+4b4ek(l0#!w2-r1hpo%&r6tk7p$p_-(=6d!c9n=g5m&'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'freedcs',
'USER': 'freedcs',
'PASSWORD': 'password',
'HOST': 'timescale',
'PORT': '5432',
}
}
MQTT_BROKER = {
'HOST': 'rabbitmq',
'PORT': '1883',
}
SKIP_WHITELIST = True

View File

@ -82,7 +82,7 @@ DATABASES = {
'NAME': 'freedcs',
'USER': 'freedcs',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'HOST': 'timescale',
'PORT': '5432',
}
}
@ -127,3 +127,17 @@ USE_TZ = True
STATIC_URL = '/static/'
SKIP_WHITELIST = True
MQTT_BROKER = {
'HOST': 'rabbitmq',
'PORT': '1883',
}
# If no local_settings.py is availble in the current folder let's try to
# load it from the application root
try:
from freedcs.production import *
except ImportError:
# If a local_setting.py does not exist
# settings in this file only will be used
pass

View File

@ -1,4 +1,5 @@
Django
djangorestframework
psycopg2-binary
kombu
paho-mqtt==1.5.0
asyncio-mqtt==0.5.0