2020-06-21 23:34:54 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: tabstop=2 shiftwidth=2 softtabstop=2
|
|
|
|
#
|
|
|
|
# BITE - A Basic/IoT/Example
|
2021-03-21 16:18:44 +01:00
|
|
|
# Copyright (C) 2020-2021 Daniele Viganò <daniele@vigano.me>
|
2020-06-21 23:34:54 +02:00
|
|
|
#
|
|
|
|
# BITE is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# BITE is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2020-06-02 00:57:20 +02:00
|
|
|
version: "3.7"
|
|
|
|
|
|
|
|
networks:
|
|
|
|
net:
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
pgdata:
|
2020-06-18 19:09:46 +02:00
|
|
|
staticdata:
|
2020-06-02 00:57:20 +02:00
|
|
|
|
|
|
|
x-op-service-default: &service_default
|
2020-06-08 23:17:16 +02:00
|
|
|
restart: always # unless-stopped
|
2020-06-02 00:57:20 +02:00
|
|
|
init: true
|
|
|
|
|
|
|
|
services:
|
2020-06-03 18:53:33 +02:00
|
|
|
ntpd:
|
|
|
|
<<: *service_default
|
2020-06-08 23:17:16 +02:00
|
|
|
build:
|
|
|
|
context: ./ntpd
|
2020-06-03 18:53:33 +02:00
|
|
|
image: daniviga/ntpd
|
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
ports:
|
2021-12-08 18:48:48 +01:00
|
|
|
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:1230:123/udp" # PORT 123 CAN BE USED WHEN RUNNING AS PRIVILEGED USER
|
2020-06-03 18:53:33 +02:00
|
|
|
|
2020-06-02 00:57:20 +02:00
|
|
|
timescale:
|
|
|
|
<<: *service_default
|
2021-12-08 22:34:14 +01:00
|
|
|
image: timescale/timescaledb:latest-pg14
|
2020-06-02 00:57:20 +02:00
|
|
|
environment:
|
2020-06-17 23:30:00 +02:00
|
|
|
POSTGRES_USER: "bite"
|
2020-06-02 00:57:20 +02:00
|
|
|
POSTGRES_PASSWORD: "password"
|
|
|
|
volumes:
|
|
|
|
- "pgdata:/var/lib/postgresql/data"
|
|
|
|
networks:
|
|
|
|
- net
|
2020-06-08 23:17:16 +02:00
|
|
|
|
2020-06-16 22:48:58 +02:00
|
|
|
broker:
|
2020-06-02 23:20:34 +02:00
|
|
|
<<: *service_default
|
2021-03-19 10:11:55 +01:00
|
|
|
image: eclipse-mosquitto:1.6
|
2020-06-21 15:21:00 +02:00
|
|
|
volumes:
|
|
|
|
- "./mqtt/mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf"
|
2020-06-02 23:20:34 +02:00
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
ports:
|
2020-06-21 22:58:46 +02:00
|
|
|
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:1883:1883"
|
2020-06-03 19:26:35 +02:00
|
|
|
|
2023-09-08 23:10:49 +02:00
|
|
|
zookeeper:
|
|
|
|
image: confluentinc/cp-zookeeper:latest
|
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
environment:
|
|
|
|
ZOOKEEPER_CLIENT_PORT: 2181
|
|
|
|
ZOOKEEPER_TICK_TIME: 2000
|
|
|
|
|
|
|
|
kafka:
|
|
|
|
image: confluentinc/cp-kafka:latest
|
|
|
|
depends_on:
|
|
|
|
- zookeeper
|
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
environment:
|
|
|
|
KAFKA_BROKER_ID: 1
|
|
|
|
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
2023-09-09 11:24:00 +02:00
|
|
|
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
|
|
|
|
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT
|
2023-09-08 23:10:49 +02:00
|
|
|
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
|
|
|
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
|
|
|
2020-06-15 22:47:55 +02:00
|
|
|
ingress:
|
2020-06-16 22:48:58 +02:00
|
|
|
<<: *service_default
|
2020-06-18 00:02:28 +02:00
|
|
|
image: nginx:stable-alpine
|
2021-03-19 10:11:55 +01:00
|
|
|
environment:
|
|
|
|
NGINX_ENTRYPOINT_QUIET_LOGS: 1
|
2020-06-15 22:47:55 +02:00
|
|
|
ports:
|
2021-12-08 18:48:48 +01:00
|
|
|
- "${CUSTOM_DOCKER_IP:-0.0.0.0}:8080:80" # PORT 80 CAN BE USED WHEN RUNNING AS PRIVILEGED USER
|
2020-06-15 22:47:55 +02:00
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
volumes:
|
2021-12-08 18:48:48 +01:00
|
|
|
- "staticdata:/srv/appdata/bite/static:U" # REMOVE ':U' ON MOBY/DOCKER
|
2021-10-05 20:54:36 +02:00
|
|
|
- "./ingress/nginx.conf:/etc/nginx/nginx.conf"
|
2020-06-18 00:02:28 +02:00
|
|
|
|
2020-06-15 22:47:55 +02:00
|
|
|
|
2020-06-17 23:30:00 +02:00
|
|
|
bite:
|
2020-06-03 19:26:35 +02:00
|
|
|
<<: *service_default
|
2020-06-15 22:47:55 +02:00
|
|
|
build:
|
|
|
|
context: ..
|
|
|
|
dockerfile: ./docker/django/Dockerfile
|
2020-06-17 23:30:00 +02:00
|
|
|
image: daniviga/bite
|
2020-06-18 19:09:46 +02:00
|
|
|
command: ["gunicorn", "-b", "0.0.0.0:8000", "bite.wsgi:application"]
|
2020-06-03 19:26:35 +02:00
|
|
|
networks:
|
|
|
|
- net
|
2020-06-15 22:47:55 +02:00
|
|
|
depends_on:
|
2020-06-15 22:53:02 +02:00
|
|
|
- ingress
|
2020-06-15 22:47:55 +02:00
|
|
|
- data-migration
|
|
|
|
- timescale
|
|
|
|
|
|
|
|
data-migration:
|
2020-06-17 23:30:00 +02:00
|
|
|
image: daniviga/bite
|
2020-06-17 20:08:10 +02:00
|
|
|
command: ["dockerize", "-wait", "tcp://timescale:5432", "python3", "manage.py", "migrate", "--noinput"]
|
2020-06-15 22:47:55 +02:00
|
|
|
networks:
|
|
|
|
- net
|
2020-06-17 20:08:10 +02:00
|
|
|
depends_on:
|
|
|
|
- timescale
|
2020-06-15 22:47:55 +02:00
|
|
|
|
2020-06-18 19:09:46 +02:00
|
|
|
static-files:
|
|
|
|
image: daniviga/bite
|
|
|
|
volumes:
|
2021-12-08 18:48:48 +01:00
|
|
|
- "staticdata:/srv/appdata/bite/static:U" # REMOVE ':U' ON MOBY/DOCKER
|
2020-06-18 19:09:46 +02:00
|
|
|
command: ["python3", "manage.py", "collectstatic", "--noinput"]
|
|
|
|
|
2023-09-08 18:14:14 +02:00
|
|
|
dispatcher:
|
2020-06-15 22:47:55 +02:00
|
|
|
<<: *service_default
|
2020-06-17 23:30:00 +02:00
|
|
|
image: daniviga/bite
|
2023-09-08 18:14:14 +02:00
|
|
|
command: ["python3", "manage.py", "dispatcher"]
|
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
depends_on:
|
|
|
|
- broker
|
|
|
|
|
|
|
|
handler:
|
|
|
|
<<: *service_default
|
|
|
|
image: daniviga/bite
|
|
|
|
command: ["python3", "manage.py", "handler"]
|
2020-06-15 22:47:55 +02:00
|
|
|
networks:
|
|
|
|
- net
|
|
|
|
depends_on:
|
|
|
|
- data-migration
|
|
|
|
- timescale
|