mirror of
https://github.com/daniviga/bite.git
synced 2024-11-23 05:16:13 +01:00
Cleanup
This commit is contained in:
parent
ffc12992c4
commit
2a443815b0
|
@ -6,7 +6,7 @@ from freedcs import settings
|
||||||
SECRET_KEY = 'i4z%50+4b4ek(l0#!w2-r1hpo%&r6tk7p$p_-(=6d!c9n=g5m&'
|
SECRET_KEY = 'i4z%50+4b4ek(l0#!w2-r1hpo%&r6tk7p$p_-(=6d!c9n=g5m&'
|
||||||
|
|
||||||
# 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 = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
|
@ -21,9 +21,10 @@ DATABASES = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MQTT_BROKER = {
|
REST_FRAMEWORK = {
|
||||||
'HOST': 'rabbitmq',
|
'DEFAULT_RENDERER_CLASSES': (
|
||||||
'PORT': 1883,
|
'rest_framework.renderers.JSONRenderer',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
SKIP_WHITELIST = True
|
SKIP_WHITELIST = True
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
version: "3.7"
|
version: "3.7"
|
||||||
|
|
||||||
edge-host:
|
services:
|
||||||
|
edge-host:
|
||||||
<<: *service_default
|
<<: *service_default
|
||||||
image: docker:dind
|
image: docker:dind
|
||||||
privileged: true
|
privileged: true
|
||||||
|
|
|
@ -8,13 +8,13 @@ services:
|
||||||
|
|
||||||
freedcs:
|
freedcs:
|
||||||
volumes:
|
volumes:
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
- "./django/production.py.sample:/srv/app/freedcs/freedcs/production.py"
|
||||||
command: ["gunicorn", "-b", "0.0.0.0:8000", "freedcs.wsgi:application"]
|
command: ["gunicorn", "-b", "0.0.0.0:8000", "freedcs.wsgi:application"]
|
||||||
|
|
||||||
data-migration:
|
data-migration:
|
||||||
volumes:
|
volumes:
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
- "./django/production.py.sample:/srv/app/freedcs/freedcs/production.py"
|
||||||
|
|
||||||
mqtt-to-db:
|
mqtt-to-db:
|
||||||
volumes:
|
volumes:
|
||||||
- "./django/production.py.sample:/srv/freedcs/freedcs/production.py"
|
- "./django/production.py.sample:/srv/app/freedcs/freedcs/production.py"
|
||||||
|
|
|
@ -32,22 +32,16 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
|
|
||||||
rabbitmq:
|
broker:
|
||||||
<<: *service_default
|
<<: *service_default
|
||||||
image: rabbitmq:3-management-alpine
|
image: eclipse-mosquitto
|
||||||
# environment: # we use unauth access atm
|
|
||||||
# RABBITMQ_DEFAULT_VHOST: "freedcs"
|
|
||||||
# RABBITMQ_DEFAULT_USER: "freedcs"
|
|
||||||
# RABBITMQ_DEFAULT_PASS: "password"
|
|
||||||
volumes:
|
|
||||||
- ./rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
|
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
ports:
|
ports:
|
||||||
- "1883:1883"
|
- "1883:1883"
|
||||||
- "15672:15672"
|
|
||||||
|
|
||||||
ingress:
|
ingress:
|
||||||
|
<<: *service_default
|
||||||
image: traefik:v2.2
|
image: traefik:v2.2
|
||||||
command: --api.insecure=true --providers.docker
|
command: --api.insecure=true --providers.docker
|
||||||
ports:
|
ports:
|
||||||
|
@ -66,7 +60,7 @@ services:
|
||||||
dockerfile: ./docker/django/Dockerfile
|
dockerfile: ./docker/django/Dockerfile
|
||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/app/freedcs"
|
||||||
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
|
@ -80,7 +74,7 @@ services:
|
||||||
data-migration:
|
data-migration:
|
||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/app/freedcs"
|
||||||
command: ["python3", "manage.py", "migrate", "--noinput"]
|
command: ["python3", "manage.py", "migrate", "--noinput"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
|
@ -89,11 +83,11 @@ services:
|
||||||
<<: *service_default
|
<<: *service_default
|
||||||
image: daniviga/freedcs
|
image: daniviga/freedcs
|
||||||
volumes:
|
volumes:
|
||||||
- "../freedcs:/srv/freedcs"
|
- "../freedcs:/srv/app/freedcs"
|
||||||
command: ["python3", "manage.py", "mqtt-to-db"]
|
command: ["python3", "manage.py", "mqtt-to-db"]
|
||||||
networks:
|
networks:
|
||||||
- net
|
- net
|
||||||
depends_on:
|
depends_on:
|
||||||
- data-migration
|
- data-migration
|
||||||
- timescale
|
- timescale
|
||||||
- rabbitmq
|
- broker
|
||||||
|
|
18
docker/mqtt/docker-compose.rabbitmq.yml
Normal file
18
docker/mqtt/docker-compose.rabbitmq.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
broker:
|
||||||
|
image: rabbitmq:3-management-alpine
|
||||||
|
# environment: # we use unauth access atm
|
||||||
|
# RABBITMQ_DEFAULT_VHOST: "freedcs"
|
||||||
|
# RABBITMQ_DEFAULT_USER: "freedcs"
|
||||||
|
# RABBITMQ_DEFAULT_PASS: "password"
|
||||||
|
volumes:
|
||||||
|
- ./mqtt/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
ports:
|
||||||
|
- "1883:1883"
|
||||||
|
- "15672:15672"
|
||||||
|
init: true
|
||||||
|
restart: always
|
14
docker/mqtt/docker-compose.vernemq.yml
Normal file
14
docker/mqtt/docker-compose.vernemq.yml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
broker:
|
||||||
|
image: vernemq/vernemq
|
||||||
|
environment:
|
||||||
|
DOCKER_VERNEMQ_ALLOW_ANONYMOUS: "on"
|
||||||
|
DOCKER_VERNEMQ_ACCEPT_EULA: "yes"
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
ports:
|
||||||
|
- "1883:1883"
|
||||||
|
init: true
|
||||||
|
restart: always
|
|
@ -1,27 +0,0 @@
|
||||||
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
|
|
|
@ -129,7 +129,7 @@ STATIC_URL = '/static/'
|
||||||
SKIP_WHITELIST = True
|
SKIP_WHITELIST = True
|
||||||
|
|
||||||
MQTT_BROKER = {
|
MQTT_BROKER = {
|
||||||
'HOST': 'rabbitmq',
|
'HOST': 'broker',
|
||||||
'PORT': '1883',
|
'PORT': '1883',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ class TelemetryLatest(ModelViewSet):
|
||||||
|
|
||||||
def retrieve(self, request, device=None):
|
def retrieve(self, request, device=None):
|
||||||
queryset = Telemetry.objects.filter(
|
queryset = Telemetry.objects.filter(
|
||||||
device__serial=device).order_by('-time')[0]
|
device__serial=device).order_by('-time')
|
||||||
if not queryset:
|
if not queryset:
|
||||||
raise Http404
|
raise Http404
|
||||||
serializer = TelemetrySerializer(queryset)
|
serializer = TelemetrySerializer(queryset[0])
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user