mirror of
https://github.com/daniviga/bite.git
synced 2024-11-23 05:16:13 +01:00
parent
648608525d
commit
8e71d64f8f
|
@ -1,4 +1,4 @@
|
|||
"""beer URL Configuration
|
||||
"""bite URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
ASGI config for beer project.
|
||||
ASGI config for bite project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'beer.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bite.settings')
|
||||
|
||||
application = get_asgi_application()
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Django settings for beer project.
|
||||
Django settings for bite project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.0.6.
|
||||
|
||||
|
@ -52,7 +52,7 @@ MIDDLEWARE = [
|
|||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'beer.urls'
|
||||
ROOT_URLCONF = 'bite.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'beer.wsgi.application'
|
||||
WSGI_APPLICATION = 'bite.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
|
@ -79,8 +79,8 @@ WSGI_APPLICATION = 'beer.wsgi.application'
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'beer',
|
||||
'USER': 'beer',
|
||||
'NAME': 'bite',
|
||||
'USER': 'bite',
|
||||
'PASSWORD': 'password',
|
||||
'HOST': 'timescale',
|
||||
'PORT': '5432',
|
||||
|
@ -136,7 +136,7 @@ MQTT_BROKER = {
|
|||
# If no local_settings.py is availble in the current folder let's try to
|
||||
# load it from the application root
|
||||
try:
|
||||
from beer.production import *
|
||||
from bite.production import *
|
||||
except ImportError:
|
||||
# If a local_setting.py does not exist
|
||||
# settings in this file only will be used
|
|
@ -1,4 +1,4 @@
|
|||
"""beer URL Configuration
|
||||
"""bite URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
WSGI config for beer project.
|
||||
WSGI config for bite project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
|
@ -11,6 +11,6 @@ import os
|
|||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'beer.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bite.settings')
|
||||
|
||||
application = get_wsgi_application()
|
|
@ -5,7 +5,7 @@ import sys
|
|||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'beer.settings')
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bite.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
|
@ -1,4 +1,4 @@
|
|||
"""beer URL Configuration
|
||||
"""bite URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.0/topics/http/urls/
|
|
@ -6,18 +6,18 @@ RUN apk update && apk add gcc musl-dev postgresql-dev \
|
|||
|
||||
FROM python:3.8-alpine
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
ENV DJANGO_SETTINGS_MODULE "beer.settings"
|
||||
ENV DJANGO_SETTINGS_MODULE "bite.settings"
|
||||
|
||||
RUN apk update && apk add --no-cache postgresql-libs \
|
||||
&& wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-alpine-linux-amd64-v0.6.1.tar.gz -qO- \
|
||||
| tar -xz -C /usr/local/bin
|
||||
COPY --from=builder /usr/local/lib/python3.8/site-packages/ /usr/local/lib/python3.8/site-packages/
|
||||
COPY --chown=1000:1000 beer /srv/app/beer
|
||||
COPY --chown=1000:1000 bite /srv/app/bite
|
||||
COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
|
||||
|
||||
RUN pip3 install -r /tmp/requirements.txt && rm /tmp/requirements.txt
|
||||
|
||||
USER 1000:1000
|
||||
WORKDIR /srv/app/beer
|
||||
WORKDIR /srv/app/bite
|
||||
EXPOSE 8000/tcp
|
||||
CMD ["python3", "manage.py", "runserver"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# vim: syntax=python
|
||||
|
||||
from beer import settings
|
||||
from bite 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&'
|
||||
|
@ -13,8 +13,8 @@ ALLOWED_HOSTS = ['*']
|
|||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'beer',
|
||||
'USER': 'beer',
|
||||
'NAME': 'bite',
|
||||
'USER': 'bite',
|
||||
'PASSWORD': 'password',
|
||||
'HOST': 'timescale',
|
||||
'PORT': '5432',
|
||||
|
|
|
@ -6,15 +6,15 @@ services:
|
|||
ports:
|
||||
- "80:80"
|
||||
|
||||
beer:
|
||||
bite:
|
||||
volumes:
|
||||
- "./django/production.py.sample:/srv/app/beer/beer/production.py"
|
||||
command: ["gunicorn", "-b", "0.0.0.0:8000", "beer.wsgi:application"]
|
||||
- "./django/production.py.sample:/srv/app/bite/bite/production.py"
|
||||
command: ["gunicorn", "-b", "0.0.0.0:8000", "bite.wsgi:application"]
|
||||
|
||||
data-migration:
|
||||
volumes:
|
||||
- "./django/production.py.sample:/srv/app/beer/beer/production.py"
|
||||
- "./django/production.py.sample:/srv/app/bite/bite/production.py"
|
||||
|
||||
mqtt-to-db:
|
||||
volumes:
|
||||
- "./django/production.py.sample:/srv/app/beer/beer/production.py"
|
||||
- "./django/production.py.sample:/srv/app/bite/bite/production.py"
|
||||
|
|
|
@ -25,7 +25,7 @@ services:
|
|||
<<: *service_default
|
||||
image: timescale/timescaledb:latest-pg12
|
||||
environment:
|
||||
POSTGRES_USER: "beer"
|
||||
POSTGRES_USER: "bite"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
volumes:
|
||||
- "pgdata:/var/lib/postgresql/data"
|
||||
|
@ -53,14 +53,14 @@ services:
|
|||
# So that Traefik can listen to the Docker events
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
beer:
|
||||
bite:
|
||||
<<: *service_default
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: ./docker/django/Dockerfile
|
||||
image: daniviga/beer
|
||||
image: daniviga/bite
|
||||
volumes:
|
||||
- "../beer:/srv/app/beer"
|
||||
- "../bite:/srv/app/bite"
|
||||
command: ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||
networks:
|
||||
- net
|
||||
|
@ -69,12 +69,12 @@ services:
|
|||
- data-migration
|
||||
- timescale
|
||||
labels:
|
||||
- "traefik.http.routers.beer.rule=PathPrefix(`/`)"
|
||||
- "traefik.http.routers.bite.rule=PathPrefix(`/`)"
|
||||
|
||||
data-migration:
|
||||
image: daniviga/beer
|
||||
image: daniviga/bite
|
||||
volumes:
|
||||
- "../beer:/srv/app/beer"
|
||||
- "../bite:/srv/app/bite"
|
||||
command: ["dockerize", "-wait", "tcp://timescale:5432", "python3", "manage.py", "migrate", "--noinput"]
|
||||
networks:
|
||||
- net
|
||||
|
@ -83,9 +83,9 @@ services:
|
|||
|
||||
mqtt-to-db:
|
||||
<<: *service_default
|
||||
image: daniviga/beer
|
||||
image: daniviga/bite
|
||||
volumes:
|
||||
- "../beer:/srv/app/beer"
|
||||
- "../bite:/srv/app/bite"
|
||||
command: ["python3", "manage.py", "mqtt-to-db"]
|
||||
networks:
|
||||
- net
|
||||
|
|
|
@ -13,7 +13,7 @@ services:
|
|||
<<: *service_default
|
||||
build:
|
||||
context: ../simulator
|
||||
image: daniviga/beer-device-simulator
|
||||
image: daniviga/bite-device-simulator
|
||||
environment:
|
||||
IOT_HTTP: "http://192.168.10.123:8000"
|
||||
# IOT_SERIAL: "abcd1234"
|
||||
|
@ -26,13 +26,13 @@ services:
|
|||
<<: *service_default
|
||||
build:
|
||||
context: ../simulator
|
||||
image: daniviga/beer-device-simulator
|
||||
image: daniviga/bite-device-simulator
|
||||
environment:
|
||||
IOT_HTTP: "http://192.168.10.123:8000"
|
||||
IOT_MQTT: "192.168.10.123:1883"
|
||||
# IOT_SERIAL: "abcd1234"
|
||||
# IOT_DELAY: 10
|
||||
IOT_DEBUG: 1
|
||||
command: ["/opt/beer/device_simulator.py", "-t", "mqtt"]
|
||||
command: ["/opt/bite/device_simulator.py", "-t", "mqtt"]
|
||||
networks:
|
||||
- localnet
|
||||
|
|
|
@ -4,8 +4,8 @@ services:
|
|||
broker:
|
||||
image: rabbitmq:3-management-alpine
|
||||
# environment: # we use unauth access atm
|
||||
# RABBITMQ_DEFAULT_VHOST: "beer"
|
||||
# RABBITMQ_DEFAULT_USER: "beer"
|
||||
# RABBITMQ_DEFAULT_VHOST: "bite"
|
||||
# RABBITMQ_DEFAULT_USER: "bite"
|
||||
# RABBITMQ_DEFAULT_PASS: "password"
|
||||
volumes:
|
||||
- ./mqtt/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
FROM python:3.8-alpine
|
||||
|
||||
RUN pip3 install urllib3 paho-mqtt
|
||||
COPY ./device_simulator.py /opt/beer/device_simulator.py
|
||||
COPY ./device_simulator.py /opt/bite/device_simulator.py
|
||||
|
||||
ENTRYPOINT ["python3"]
|
||||
CMD ["/opt/beer/device_simulator.py"]
|
||||
CMD ["/opt/bite/device_simulator.py"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user