From 75a25124380ef32bdb6086b02cd85d51890fab23 Mon Sep 17 00:00:00 2001 From: Benjamin Dweck Date: Fri, 23 Oct 2020 10:45:57 +0200 Subject: [PATCH] Parameterized docker-compose.yml file using .env --- .env.example | 4 ++++ docker-compose.yml | 12 ++++++------ {config => example-config}/ca.crt | 0 {config => example-config}/mosquitto.conf | 0 {config => example-config}/mqtt.example.com.crt | 0 {config => example-config}/mqtt.example.com.key | 0 {config => example-config}/subscriber.crt | 0 {config => example-config}/subscriber.key | 0 {config => example-config}/torch-sub.conf | 0 9 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .env.example rename {config => example-config}/ca.crt (100%) rename {config => example-config}/mosquitto.conf (100%) rename {config => example-config}/mqtt.example.com.crt (100%) rename {config => example-config}/mqtt.example.com.key (100%) rename {config => example-config}/subscriber.crt (100%) rename {config => example-config}/subscriber.key (100%) rename {config => example-config}/torch-sub.conf (100%) diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..6249c16 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +BROKER_MQTT_PORT=1883 +BROKER_MQTTS_PORT=8883 +HTTP_PORT=7700 +CONFIG_DIR=./example-config diff --git a/docker-compose.yml b/docker-compose.yml index dab6181..ab27fb2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: build: context: ./tor args: - - SVC_PORT=1883 + - SVC_PORT=${BROKER_MQTT_PORT} - SVC_HOST=broker networks: - tor_net @@ -15,10 +15,10 @@ services: image: eclipse-mosquitto volumes: - broker_data:/mosquitto/data - - ./config:/mosquitto/config:ro + - ${CONFIG_DIR}:/mosquitto/config:ro ports: - - "1883:1883" - - "8883:8883" + - ${BROKER_MQTT_PORT}:${BROKER_MQTT_PORT} + - ${BROKER_MQTTS_PORT}:${BROKER_MQTTS_PORT} networks: - tor_net - broker_net @@ -27,9 +27,9 @@ services: build: './subscriber' volumes: - client_data:/data - - ./config:/etc/torch:ro + - ${CONFIG_DIR}:/etc/torch:ro ports: - - "7700:8080" + - ${HTTP_PORT}:8080 networks: - broker_net diff --git a/config/ca.crt b/example-config/ca.crt similarity index 100% rename from config/ca.crt rename to example-config/ca.crt diff --git a/config/mosquitto.conf b/example-config/mosquitto.conf similarity index 100% rename from config/mosquitto.conf rename to example-config/mosquitto.conf diff --git a/config/mqtt.example.com.crt b/example-config/mqtt.example.com.crt similarity index 100% rename from config/mqtt.example.com.crt rename to example-config/mqtt.example.com.crt diff --git a/config/mqtt.example.com.key b/example-config/mqtt.example.com.key similarity index 100% rename from config/mqtt.example.com.key rename to example-config/mqtt.example.com.key diff --git a/config/subscriber.crt b/example-config/subscriber.crt similarity index 100% rename from config/subscriber.crt rename to example-config/subscriber.crt diff --git a/config/subscriber.key b/example-config/subscriber.key similarity index 100% rename from config/subscriber.key rename to example-config/subscriber.key diff --git a/config/torch-sub.conf b/example-config/torch-sub.conf similarity index 100% rename from config/torch-sub.conf rename to example-config/torch-sub.conf