-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from freifunkMUC/docker-compose
Added docker-compose
- Loading branch information
Showing
6 changed files
with
151 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
FROM l.gcr.io/google/bazel:latest AS builder | ||
|
||
WORKDIR /srv/wgkex | ||
WORKDIR /wgkex | ||
|
||
COPY . ./ | ||
|
||
RUN ["bazel", "build", "//wgkex/broker:app"] | ||
RUN ["bazel", "build", "//wgkex/worker:app"] | ||
RUN ["cp", "-rL", "bazel-bin", "bazel"] | ||
|
||
FROM python:3.8 | ||
WORKDIR /srv/wgkex | ||
FROM python:3 | ||
WORKDIR /wgkex | ||
|
||
COPY --from=builder /srv/wgkex/bazel /srv/wgkex/ | ||
COPY --from=builder /wgkex/bazel /wgkex/ | ||
|
||
COPY entrypoint /entrypoint | ||
|
||
EXPOSE 5000 | ||
CMD ["./wgkex/broker/app"] | ||
|
||
ENTRYPOINT ["/entrypoint"] | ||
CMD ["broker"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.9" | ||
|
||
services: | ||
mqtt: | ||
#profiles: ["do-not-start"] | ||
#volumes: | ||
# - ./config/mosquitto:/mosquitto/config | ||
broker: | ||
#profiles: ["do-not-start"] | ||
#volumes: | ||
# - ./config/broker/wgkex.yaml:/etc/wgkex.yaml | ||
worker: | ||
profiles: ["do-not-start"] | ||
#volumes: | ||
# - ./config/broker/wgkex.yaml:/etc/wgkex.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
version: "3" | ||
|
||
services: | ||
mqtt: | ||
image: eclipse-mosquitto:1.6 | ||
restart: unless-stopped | ||
volumes: | ||
#- ./config/mosquitto:/mosquitto/config | ||
- ./volumes/mosquitto/data:/mosquitto/data | ||
- ./volumes/mosquitto/log:/mosquitto/log | ||
ports: | ||
- "9001:9001" | ||
|
||
broker: | ||
build: . | ||
image: wgkex | ||
command: broker | ||
restart: unless-stopped | ||
ports: | ||
- "5000:5000" | ||
#volumes: | ||
#- ./config/broker/wgkex.yaml:/etc/wgkex.yaml | ||
environment: | ||
WGKEX_DOMAINS: ${WGKEX_DOMAINS-ffmuc_freising, ffmuc_gauting, ffmuc_muc_cty, ffmuc_muc_nord, ffmuc_muc_ost, ffmuc_muc_sued, ffmuc_muc_west, ffmuc_uml_nord, ffmuc_uml_ost, ffmuc_uml_sued, ffmuc_uml_west, ffmuc_welt} | ||
WGKEX_DOMAIN_PREFIX: ${WGKEX_DOMAIN_PREFIX-ffmuc_} | ||
WGKEX_DEBUG: ${WGKEX_DEBUG-DEBUG} | ||
MQTT_BROKER_URL: ${MQTT_BROKER_URL-mqtt} | ||
MQTT_BROKER_PORT: ${MQTT_BROKER_PORT-1883} | ||
MQTT_USERNAME: ${MQTT_USERNAME-} | ||
MQTT_PASSWORD: ${MQTT_PASSWORD-} | ||
MQTT_KEEPALIVE: ${MQTT_KEEPALIVE-5} | ||
MQTT_TLS: ${MQTT_TLS-False} | ||
|
||
worker: | ||
build: . | ||
image: wgkex | ||
command: worker | ||
restart: unless-stopped | ||
#volumes: | ||
#- ./config/worker/wgkex.yaml:/etc/wgkex.yaml | ||
environment: | ||
WGKEX_DOMAINS: ${WGKEX_DOMAINS-ffmuc_freising, ffmuc_gauting, ffmuc_muc_cty, ffmuc_muc_nord, ffmuc_muc_ost, ffmuc_muc_sued, ffmuc_muc_west, ffmuc_uml_nord, ffmuc_uml_ost, ffmuc_uml_sued, ffmuc_uml_west, ffmuc_welt} | ||
WGKEX_DOMAIN_PREFIX: ${WGKEX_DOMAIN_PREFIX-ffmuc_} | ||
WGKEX_DEBUG: ${WGKEX_DEBUG-DEBUG} | ||
MQTT_BROKER_URL: ${MQTT_BROKER_URL-mqtt} | ||
MQTT_BROKER_PORT: ${MQTT_BROKER_PORT-1883} | ||
MQTT_USERNAME: ${MQTT_USERNAME-} | ||
MQTT_PASSWORD: ${MQTT_PASSWORD-} | ||
MQTT_KEEPALIVE: ${MQTT_KEEPALIVE-5} | ||
MQTT_TLS: ${MQTT_TLS-False} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
: ${WGKEX_DOMAINS:="ffmuc_freising, ffmuc_gauting, ffmuc_muc_cty, ffmuc_muc_nord, ffmuc_muc_ost, ffmuc_muc_sued, ffmuc_muc_west, ffmuc_uml_nord, ffmuc_uml_ost, ffmuc_uml_sued, ffmuc_uml_west, ffmuc_welt"} | ||
: ${WGKEX_DOMAIN_PREFIX:="ffmuc_"} | ||
: ${WGKEX_DEBUG:="DEBUG"} | ||
: ${MQTT_BROKER_URL:="mqtt"} | ||
: ${MQTT_BROKER_PORT:="1883"} | ||
: ${MQTT_USERNAME:=""} | ||
: ${MQTT_PASSWORD:=""} | ||
: ${MQTT_KEEPALIVE:="5"} | ||
: ${MQTT_TLS:="False"} | ||
|
||
mk_config() { | ||
if [ ! -e /etc/wgkex.yaml ] ; then | ||
( | ||
echo "domains:" | ||
IFS=", " | ||
for i in $WGKEX_DOMAINS; do | ||
echo " - $i" | ||
done | ||
cat <<EOF | ||
log_level: $WGKEX_DEBUG | ||
domain_prefix: $WGKEX_DOMAIN_PREFIX | ||
mqtt: | ||
broker_url: $MQTT_BROKER_URL | ||
broker_port: $MQTT_BROKER_PORT | ||
username: $MQTT_USERNAME | ||
password: $MQTT_PASSWORD | ||
keepalive: $MQTT_KEEPALIVE | ||
tls: $MQTT_TLS | ||
EOF | ||
unset IFS | ||
) > /etc/wgkex.yaml | ||
fi | ||
} | ||
|
||
mk_config | ||
|
||
case "$1" in | ||
broker) | ||
exec ./wgkex/broker/app | ||
;; | ||
worker) | ||
exec ./wgkex/worker/app | ||
;; | ||
esac | ||
|
||
exec "$@" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copy or rename this file to .env and modify if for your needs | ||
|
||
#WGKEX_DOMAINS="ffmuc_freising, ffmuc_gauting, ffmuc_muc_cty, ffmuc_muc_nord, ffmuc_muc_ost, ffmuc_muc_sued, ffmuc_muc_west, ffmuc_uml_nord, ffmuc_uml_ost, ffmuc_uml_sued, ffmuc_uml_west, ffmuc_welt" | ||
#WGKEX_DOMAIN_PREFIX="ffmuc_" | ||
#WGKEX_DEBUG="DEBUG" | ||
|
||
#MQTT_BROKER_URL="mqtt" | ||
#MQTT_BROKER_PORT="1883" | ||
#MQTT_USERNAME="" | ||
#MQTT_PASSWORD="" | ||
#MQTT_KEEPALIVE="5" | ||
#MQTT_TLS="False" | ||
|
||
|