Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# IN PORTS
WEB_PORT_IN=80
SECURE_WEB_PORT_IN=443
MODBUS_ELEVATOR_PORT_IN=3179
COAP_SIMPLE_PORT_IN=5683
COAP_NEGOTIATION_PORT_IN=5684
Expand All @@ -8,6 +9,7 @@ TRAEFIK_DASHBOARD_PORT_IN=8080

# OUT PORTS
WEB_PORT_OUT=80
SECURE_WEB_PORT_OUT=443
MODBUS_ELEVATOR_PORT_OUT=3179
COAP_SIMPLE_PORT_OUT=5683
COAP_NEGOTIATION_PORT_OUT=5684
Expand Down
8 changes: 5 additions & 3 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ COAP_NEGOTIATION_PORT_OUT=5684
SMART_HOME_SMART_CLOCK_PORT_OUT=5685
TRAEFIK_DASHBOARD_PORT_OUT=8080

STACK_HOSTNAME="localhost"
BROKER_URI="localhost"
STACK_HOSTNAME="0.0.0.0"
BROKER_URI="mqtt://mosquitto:1883"
PORT=8087

LOKI_HOSTNAME="http://loki"
LOKI_HOSTNAME="loki"
LOKI_PORT=3100

JAEGER_ENDPOINT=http://jaeger:4318/v1/traces

# Healthcheck Parameters
HC_INTERVAL=40s
HC_TIMEOUT=30s
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ If you want to build and run the Things from your local source code (for develop
1. Make sure you have Docker and Docker Compose installed.
2. From the project root, run:
```sh
docker-compose -f docker-compose-things-local.yml build
docker-compose -f docker-compose-things-local.yml up
docker compose --env-file .env.local -f docker-compose-things-local.yml up --build
```
3. The Things will be accessible at the same local URLs as below (e.g., `http://localhost/http-advanced-coffee-machine`).

Expand Down
72 changes: 45 additions & 27 deletions docker-compose-things-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ services:
- traefik.udp.routers.coap-calculator-simple.entrypoints=coap-calculator-simple
- traefik.udp.services.coap-calculator-simple.loadbalancer.server.port=${COAP_SIMPLE_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${COAP_SIMPLE_PORT_OUT}
networks:
- things_network
- things_network_local
coap-calculator-content-negotiation:
build:
context: ./things/calculator
Expand All @@ -19,20 +19,23 @@ services:
- traefik.udp.routers.coap-calculator-content-negotiation.entrypoints=coap-calculator-content-negotiation
- traefik.udp.services.coap-calculator-simple.loadbalancer.server.port=${COAP_NEGOTIATION_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${COAP_NEGOTIATION_PORT_OUT}
networks:
- things_network
- things_network_local
http-express-calculator-simple:
build:
context: ./things/calculator
dockerfile: ./http/express/Dockerfile-simple
labels:
- traefik.http.routers.http-express-calculator-simple.rule=PathPrefix(`/http-express-calculator-simple`)
- traefik.http.routers.http-express-calculator-simple.entrypoints=web
- traefik.http.services.http-express-calculator-simple.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
- LOKI_HOSTNAME=${LOKI_HOSTNAME}
- LOKI_PORT=${LOKI_PORT}
healthcheck:
Expand All @@ -42,43 +45,49 @@ services:
retries: ${HC_RETRIES}
start_period: ${HC_START_PERIOD}
networks:
- things_network
- things_network_local
http-express-calculator-content-negotiation:
build:
context: ./things/calculator
dockerfile: ./http/express/Dockerfile-contentneg
labels:
- traefik.http.routers.http-express-calculator-content-negotiation.rule=PathPrefix(`/http-express-calculator-content-negotiation`)
- traefik.http.routers.http-express-calculator-content-negotiation.entrypoints=web
- traefik.http.services.http-express-calculator-content-negotiation.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
healthcheck:
test: wget --no-verbose --tries=1 --spider http://${STACK_HOSTNAME}:${WEB_PORT_OUT}/http-express-calculator-content-negotiation || exit 1
interval: ${HC_INTERVAL}
timeout: ${HC_TIMEOUT}
retries: ${HC_RETRIES}
start_period: ${HC_START_PERIOD}
networks:
- things_network
- things_network_local
http-flask-calculator:
build:
context: ./things/calculator
dockerfile: ./http/flask/Dockerfile
labels:
- traefik.http.routers.http-flask-calculator.rule=PathPrefix(`/http-flask-calculator`)
- traefik.http.routers.http-flask-calculator.entrypoints=web
- traefik.http.services.http-flask-calculator.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
healthcheck:
test: wget --no-verbose --tries=1 --spider http://${STACK_HOSTNAME}:${WEB_PORT_OUT}/http-flask-calculator || exit 1
interval: ${HC_INTERVAL}
timeout: ${HC_TIMEOUT}
retries: ${HC_RETRIES}
start_period: ${HC_START_PERIOD}
networks:
- things_network
- things_network_local
mqtt-calculator:
build:
context: ./things/calculator
Expand All @@ -88,7 +97,7 @@ services:
- LOKI_HOSTNAME=${LOKI_HOSTNAME}
- LOKI_PORT=${LOKI_PORT}
networks:
- things_network
- things_network_local
modbus-elevator:
build:
context: ./things/elevator
Expand All @@ -98,54 +107,63 @@ services:
- traefik.tcp.routers.modbus-elevator.rule=HostSNI(`*`)
- traefik.tcp.services.modbus-elevator.loadbalancer.server.port=${MODBUS_ELEVATOR_PORT_OUT}
networks:
- things_network
- things_network_local
http-advanced-coffee-machine:
build:
context: .
dockerfile: ./things/advanced-coffee-machine/http/ts/Dockerfile
labels:
- traefik.http.routers.http-advanced-coffee-machine.rule=PathPrefix(`/http-advanced-coffee-machine`)
- traefik.http.services.http-advanced-coffee-machine.loadbalancer.server.port=${WEB_PORT_OUT}
- traefik.http.routers.http-advanced-coffee-machine.rule=PathPrefix(`/http-advanced-coffee-machine`)
- traefik.http.routers.http-advanced-coffee-machine.entrypoints=web
- traefik.http.services.http-advanced-coffee-machine.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
- JAEGER_ENDPOINT=${JAEGER_ENDPOINT}
networks:
- things_network
- things_network_local
http-data-schema-thing:
build:
context: ./things/data-schema-thing
dockerfile: ./http/ts/Dockerfile
labels:
- traefik.http.routers.http-data-schema-thing.rule=PathPrefix(`/http-data-schema-thing`)
- traefik.http.routers.http-data-schema-thing.entrypoints=web
- traefik.http.services.http-data-schema-thing.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
- LOKI_HOSTNAME=${LOKI_HOSTNAME}
- LOKI_PORT=${LOKI_PORT}
networks:
- things_network
- things_network_local
counter-thing:
build:
context: ./things/counter-thing
dockerfile: ./http/ts/Dockerfile
labels:
- traefik.http.routers.counter-thing.rule=PathPrefix(`/counter-thing`)
- traefik.http.routers.counter-thing.rule=PathPrefix(`/counter`)
- traefik.http.routers.counter-thing.entrypoints=web
- traefik.http.services.counter-thing.loadbalancer.server.port=${WEB_PORT_OUT}
environment:
- HOSTNAME=${STACK_HOSTNAME}
- HOSTNAME=0.0.0.0
- PORT=${WEB_PORT_OUT}
- EXTERNAL_PORT=${WEB_PORT_OUT}
- PROTOCOL=http
- LOKI_HOSTNAME=${LOKI_HOSTNAME}
- LOKI_PORT=${LOKI_PORT}
networks:
- things_network
- things_network_local
smart-home-presence-sensor:
build:
context: ./mashups/smart-home
dockerfile: ./dockerfiles/presence-sensor.Dockerfile
networks:
- things_network
- things_network_local
smart-home-simple-coffee-machine:
build:
context: ./mashups/smart-home
Expand All @@ -161,7 +179,7 @@ services:
- SIMPLE_COFFEE_MACHINE_HOSTNAME=smart-home-simple-coffee-machine
- PORT=${WEB_PORT_OUT}
networks:
- things_network
- things_network_local
smart-home-smart-clock:
build:
context: ./mashups/smart-home
Expand All @@ -176,7 +194,7 @@ services:
- SMART_CLOCK_HOSTNAME=smart-home-smart-clock
- PORT=${SMART_HOME_SMART_CLOCK_PORT_OUT}
networks:
- things_network
- things_network_local
smart-home-mashup:
build:
context: ./mashups/smart-home
Expand All @@ -192,9 +210,9 @@ services:
- smart-home-smart-clock
restart: on-failure
networks:
- things_network
- things_network_local

networks:
things_network:
name: things_network
things_network_local:
name: things_network_local
external: true
Loading
Loading