From 8e71d64f8f55f1de9f1853b3809cbfd91382baf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Wed, 17 Jun 2020 23:30:00 +0200 Subject: [PATCH] Renaming to BITE (#15) * Renaming, again * Update README.md --- README.md | 3 ++- {beer => bite}/api/__init__.py | 0 {beer => bite}/api/admin.py | 0 {beer => bite}/api/apps.py | 0 {beer => bite}/api/migrations/0001_initial.py | 0 .../api/migrations/0002_auto_20200601_1523.py | 0 .../api/migrations/0003_auto_20200602_2128.py | 0 .../api/migrations/0004_device_uuid.py | 0 {beer => bite}/api/migrations/__init__.py | 0 {beer => bite}/api/models.py | 0 {beer => bite}/api/serializers.py | 0 {beer => bite}/api/tests.py | 0 {beer => bite}/api/tests/sample.json | 0 {beer => bite}/api/urls.py | 2 +- {beer => bite}/api/views.py | 0 {beer/beer => bite/bite}/__init__.py | 0 {beer/beer => bite/bite}/asgi.py | 4 ++-- {beer/beer => bite/bite}/settings.py | 12 ++++++------ {beer/beer => bite/bite}/urls.py | 2 +- {beer/beer => bite/bite}/wsgi.py | 4 ++-- {beer => bite}/manage.py | 2 +- {beer => bite}/telemetry/__init__.py | 0 {beer => bite}/telemetry/admin.py | 0 {beer => bite}/telemetry/apps.py | 0 .../management/commands/mqtt-to-db.py | 0 .../telemetry/migrations/0001_initial.py | 0 .../migrations/0002_auto_20200601_1557.py | 0 .../migrations/0003_auto_20200602_2131.py | 0 .../migrations/0004_auto_20200602_2132.py | 0 .../migrations/0005_telemetry_clock.py | 0 .../migrations/0006_auto_20200603_1317.py | 0 .../migrations/0007_telemetry_transport.py | 0 .../telemetry/migrations/__init__.py | 0 {beer => bite}/telemetry/models.py | 0 {beer => bite}/telemetry/serializers.py | 0 {beer => bite}/telemetry/tests.py | 0 {beer => bite}/telemetry/tests/sample.json | 0 {beer => bite}/telemetry/urls.py | 2 +- {beer => bite}/telemetry/views.py | 0 docker/django/Dockerfile | 6 +++--- docker/django/production.py.sample | 6 +++--- docker/docker-compose.prod.yml | 10 +++++----- docker/docker-compose.yml | 18 +++++++++--------- docker/edge/docker-compose.yml | 6 +++--- docker/mqtt/docker-compose.rabbitmq.yml | 4 ++-- docker/simulator/Dockerfile | 4 ++-- 46 files changed, 43 insertions(+), 42 deletions(-) rename {beer => bite}/api/__init__.py (100%) rename {beer => bite}/api/admin.py (100%) rename {beer => bite}/api/apps.py (100%) rename {beer => bite}/api/migrations/0001_initial.py (100%) rename {beer => bite}/api/migrations/0002_auto_20200601_1523.py (100%) rename {beer => bite}/api/migrations/0003_auto_20200602_2128.py (100%) rename {beer => bite}/api/migrations/0004_device_uuid.py (100%) rename {beer => bite}/api/migrations/__init__.py (100%) rename {beer => bite}/api/models.py (100%) rename {beer => bite}/api/serializers.py (100%) rename {beer => bite}/api/tests.py (100%) rename {beer => bite}/api/tests/sample.json (100%) rename {beer => bite}/api/urls.py (97%) rename {beer => bite}/api/views.py (100%) rename {beer/beer => bite/bite}/__init__.py (100%) rename {beer/beer => bite/bite}/asgi.py (75%) rename {beer/beer => bite/bite}/settings.py (94%) rename {beer/beer => bite/bite}/urls.py (97%) rename {beer/beer => bite/bite}/wsgi.py (75%) rename {beer => bite}/manage.py (89%) rename {beer => bite}/telemetry/__init__.py (100%) rename {beer => bite}/telemetry/admin.py (100%) rename {beer => bite}/telemetry/apps.py (100%) rename {beer => bite}/telemetry/management/commands/mqtt-to-db.py (100%) rename {beer => bite}/telemetry/migrations/0001_initial.py (100%) rename {beer => bite}/telemetry/migrations/0002_auto_20200601_1557.py (100%) rename {beer => bite}/telemetry/migrations/0003_auto_20200602_2131.py (100%) rename {beer => bite}/telemetry/migrations/0004_auto_20200602_2132.py (100%) rename {beer => bite}/telemetry/migrations/0005_telemetry_clock.py (100%) rename {beer => bite}/telemetry/migrations/0006_auto_20200603_1317.py (100%) rename {beer => bite}/telemetry/migrations/0007_telemetry_transport.py (100%) rename {beer => bite}/telemetry/migrations/__init__.py (100%) rename {beer => bite}/telemetry/models.py (100%) rename {beer => bite}/telemetry/serializers.py (100%) rename {beer => bite}/telemetry/tests.py (100%) rename {beer => bite}/telemetry/tests/sample.json (100%) rename {beer => bite}/telemetry/urls.py (98%) rename {beer => bite}/telemetry/views.py (100%) diff --git a/README.md b/README.md index 450afdb..6a18730 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# beer +# BITE - BasicIoTExample + Playing with IoT diff --git a/beer/api/__init__.py b/bite/api/__init__.py similarity index 100% rename from beer/api/__init__.py rename to bite/api/__init__.py diff --git a/beer/api/admin.py b/bite/api/admin.py similarity index 100% rename from beer/api/admin.py rename to bite/api/admin.py diff --git a/beer/api/apps.py b/bite/api/apps.py similarity index 100% rename from beer/api/apps.py rename to bite/api/apps.py diff --git a/beer/api/migrations/0001_initial.py b/bite/api/migrations/0001_initial.py similarity index 100% rename from beer/api/migrations/0001_initial.py rename to bite/api/migrations/0001_initial.py diff --git a/beer/api/migrations/0002_auto_20200601_1523.py b/bite/api/migrations/0002_auto_20200601_1523.py similarity index 100% rename from beer/api/migrations/0002_auto_20200601_1523.py rename to bite/api/migrations/0002_auto_20200601_1523.py diff --git a/beer/api/migrations/0003_auto_20200602_2128.py b/bite/api/migrations/0003_auto_20200602_2128.py similarity index 100% rename from beer/api/migrations/0003_auto_20200602_2128.py rename to bite/api/migrations/0003_auto_20200602_2128.py diff --git a/beer/api/migrations/0004_device_uuid.py b/bite/api/migrations/0004_device_uuid.py similarity index 100% rename from beer/api/migrations/0004_device_uuid.py rename to bite/api/migrations/0004_device_uuid.py diff --git a/beer/api/migrations/__init__.py b/bite/api/migrations/__init__.py similarity index 100% rename from beer/api/migrations/__init__.py rename to bite/api/migrations/__init__.py diff --git a/beer/api/models.py b/bite/api/models.py similarity index 100% rename from beer/api/models.py rename to bite/api/models.py diff --git a/beer/api/serializers.py b/bite/api/serializers.py similarity index 100% rename from beer/api/serializers.py rename to bite/api/serializers.py diff --git a/beer/api/tests.py b/bite/api/tests.py similarity index 100% rename from beer/api/tests.py rename to bite/api/tests.py diff --git a/beer/api/tests/sample.json b/bite/api/tests/sample.json similarity index 100% rename from beer/api/tests/sample.json rename to bite/api/tests/sample.json diff --git a/beer/api/urls.py b/bite/api/urls.py similarity index 97% rename from beer/api/urls.py rename to bite/api/urls.py index ca0c1b5..9ccd47f 100644 --- a/beer/api/urls.py +++ b/bite/api/urls.py @@ -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/ diff --git a/beer/api/views.py b/bite/api/views.py similarity index 100% rename from beer/api/views.py rename to bite/api/views.py diff --git a/beer/beer/__init__.py b/bite/bite/__init__.py similarity index 100% rename from beer/beer/__init__.py rename to bite/bite/__init__.py diff --git a/beer/beer/asgi.py b/bite/bite/asgi.py similarity index 75% rename from beer/beer/asgi.py rename to bite/bite/asgi.py index ce63ae6..bc61030 100644 --- a/beer/beer/asgi.py +++ b/bite/bite/asgi.py @@ -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() diff --git a/beer/beer/settings.py b/bite/bite/settings.py similarity index 94% rename from beer/beer/settings.py rename to bite/bite/settings.py index 4daeb41..18be70f 100644 --- a/beer/beer/settings.py +++ b/bite/bite/settings.py @@ -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 diff --git a/beer/beer/urls.py b/bite/bite/urls.py similarity index 97% rename from beer/beer/urls.py rename to bite/bite/urls.py index 0e287d2..956a99a 100644 --- a/beer/beer/urls.py +++ b/bite/bite/urls.py @@ -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/ diff --git a/beer/beer/wsgi.py b/bite/bite/wsgi.py similarity index 75% rename from beer/beer/wsgi.py rename to bite/bite/wsgi.py index d2d6dd0..7db4be4 100644 --- a/beer/beer/wsgi.py +++ b/bite/bite/wsgi.py @@ -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() diff --git a/beer/manage.py b/bite/manage.py similarity index 89% rename from beer/manage.py rename to bite/manage.py index dde4a44..02eabe4 100755 --- a/beer/manage.py +++ b/bite/manage.py @@ -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: diff --git a/beer/telemetry/__init__.py b/bite/telemetry/__init__.py similarity index 100% rename from beer/telemetry/__init__.py rename to bite/telemetry/__init__.py diff --git a/beer/telemetry/admin.py b/bite/telemetry/admin.py similarity index 100% rename from beer/telemetry/admin.py rename to bite/telemetry/admin.py diff --git a/beer/telemetry/apps.py b/bite/telemetry/apps.py similarity index 100% rename from beer/telemetry/apps.py rename to bite/telemetry/apps.py diff --git a/beer/telemetry/management/commands/mqtt-to-db.py b/bite/telemetry/management/commands/mqtt-to-db.py similarity index 100% rename from beer/telemetry/management/commands/mqtt-to-db.py rename to bite/telemetry/management/commands/mqtt-to-db.py diff --git a/beer/telemetry/migrations/0001_initial.py b/bite/telemetry/migrations/0001_initial.py similarity index 100% rename from beer/telemetry/migrations/0001_initial.py rename to bite/telemetry/migrations/0001_initial.py diff --git a/beer/telemetry/migrations/0002_auto_20200601_1557.py b/bite/telemetry/migrations/0002_auto_20200601_1557.py similarity index 100% rename from beer/telemetry/migrations/0002_auto_20200601_1557.py rename to bite/telemetry/migrations/0002_auto_20200601_1557.py diff --git a/beer/telemetry/migrations/0003_auto_20200602_2131.py b/bite/telemetry/migrations/0003_auto_20200602_2131.py similarity index 100% rename from beer/telemetry/migrations/0003_auto_20200602_2131.py rename to bite/telemetry/migrations/0003_auto_20200602_2131.py diff --git a/beer/telemetry/migrations/0004_auto_20200602_2132.py b/bite/telemetry/migrations/0004_auto_20200602_2132.py similarity index 100% rename from beer/telemetry/migrations/0004_auto_20200602_2132.py rename to bite/telemetry/migrations/0004_auto_20200602_2132.py diff --git a/beer/telemetry/migrations/0005_telemetry_clock.py b/bite/telemetry/migrations/0005_telemetry_clock.py similarity index 100% rename from beer/telemetry/migrations/0005_telemetry_clock.py rename to bite/telemetry/migrations/0005_telemetry_clock.py diff --git a/beer/telemetry/migrations/0006_auto_20200603_1317.py b/bite/telemetry/migrations/0006_auto_20200603_1317.py similarity index 100% rename from beer/telemetry/migrations/0006_auto_20200603_1317.py rename to bite/telemetry/migrations/0006_auto_20200603_1317.py diff --git a/beer/telemetry/migrations/0007_telemetry_transport.py b/bite/telemetry/migrations/0007_telemetry_transport.py similarity index 100% rename from beer/telemetry/migrations/0007_telemetry_transport.py rename to bite/telemetry/migrations/0007_telemetry_transport.py diff --git a/beer/telemetry/migrations/__init__.py b/bite/telemetry/migrations/__init__.py similarity index 100% rename from beer/telemetry/migrations/__init__.py rename to bite/telemetry/migrations/__init__.py diff --git a/beer/telemetry/models.py b/bite/telemetry/models.py similarity index 100% rename from beer/telemetry/models.py rename to bite/telemetry/models.py diff --git a/beer/telemetry/serializers.py b/bite/telemetry/serializers.py similarity index 100% rename from beer/telemetry/serializers.py rename to bite/telemetry/serializers.py diff --git a/beer/telemetry/tests.py b/bite/telemetry/tests.py similarity index 100% rename from beer/telemetry/tests.py rename to bite/telemetry/tests.py diff --git a/beer/telemetry/tests/sample.json b/bite/telemetry/tests/sample.json similarity index 100% rename from beer/telemetry/tests/sample.json rename to bite/telemetry/tests/sample.json diff --git a/beer/telemetry/urls.py b/bite/telemetry/urls.py similarity index 98% rename from beer/telemetry/urls.py rename to bite/telemetry/urls.py index 27a4412..808906b 100644 --- a/beer/telemetry/urls.py +++ b/bite/telemetry/urls.py @@ -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/ diff --git a/beer/telemetry/views.py b/bite/telemetry/views.py similarity index 100% rename from beer/telemetry/views.py rename to bite/telemetry/views.py diff --git a/docker/django/Dockerfile b/docker/django/Dockerfile index 5d5af58..ffe2b41 100644 --- a/docker/django/Dockerfile +++ b/docker/django/Dockerfile @@ -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"] diff --git a/docker/django/production.py.sample b/docker/django/production.py.sample index ba18d75..fab2e34 100644 --- a/docker/django/production.py.sample +++ b/docker/django/production.py.sample @@ -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', diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 2267898..d456750 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -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" diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 63be72b..7eb3b7e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 diff --git a/docker/edge/docker-compose.yml b/docker/edge/docker-compose.yml index 663c37d..0d4cfab 100644 --- a/docker/edge/docker-compose.yml +++ b/docker/edge/docker-compose.yml @@ -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 diff --git a/docker/mqtt/docker-compose.rabbitmq.yml b/docker/mqtt/docker-compose.rabbitmq.yml index 2f50243..9ffb579 100644 --- a/docker/mqtt/docker-compose.rabbitmq.yml +++ b/docker/mqtt/docker-compose.rabbitmq.yml @@ -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 diff --git a/docker/simulator/Dockerfile b/docker/simulator/Dockerfile index 9130f5f..f5e3206 100644 --- a/docker/simulator/Dockerfile +++ b/docker/simulator/Dockerfile @@ -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"]