Skip to content

WIP: Clean up #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OS2IoT-docker

This repository contains the docker-compose file and configuration needed to run the OS2IoT project.
This repository contains the docker compose file and configuration needed to run the OS2IoT project.

Documentation is available at: https://os2iot.readthedocs.io/en/latest/

Expand All @@ -17,8 +17,8 @@ OS2IoT

From the `OS2IoT-docker` folder in a suitable terminal use:

```
docker-compose up
```shell
docker compose up
```

## Configuration
Expand All @@ -28,7 +28,7 @@ Edit the files in the configuration folder to adjust settings for each requireme
## Contents

- Postgres from the official image.
- Chirpstack using their docker-compose
- Chirpstack using their docker compose

## Troubleshooting FAQ

Expand Down Expand Up @@ -58,26 +58,33 @@ error: database "os2iot-e2e" does not exist
```

Cause:

Database has not been setup correctly on local machine.

Solution:
docker-compose down --volumes

```shell
docker compose down --volumes
dos2unix configuration/os2iot-postgresql/initdb/\* <-- Skal køres fra git bash
docker-compose up
docker compose up
```

### error: Error: connect ETIMEDOUT xxx.xxx.xxx.xxx:xxxx at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)

Cause:

Docker is trying to connect to the wrong ip.

Solution:

1. Navigate to hosts file: C:\Windows\System32\drivers\etc
2. Open hosts file as administrator
3. Change related ip of host.docker.internal and gateway.docker.internal to your new ip (found in terminal using the ipconfig command: e.g. 192.168.0.1)
4. save
5. restart the application.

## Adding an ADR Algorithm

When the ADR Algorithm has been tested, and is ready for deployment, the ADR Algorithm has to be added to chirpstack. It is mandatory that the custom adr module is writtin in js.

## Adding the Plugin to Chirpstack
Expand All @@ -89,6 +96,7 @@ Therefore a new folder can be added such as `./configuration/chirpstack/adr-modu
This makes the file available at `/etc/chirpstack/adr-modules/example-file.js` within the chirpstack container.

The last step is to specify the file as being an adr-plugin within the `chirpstack.toml` config file by adding `adr_plugins=["/etc/chirpstack/adr-modules/example-file.js"]` under `[network]`, like this:

```toml
[network]
adr_plugins=["/etc/chirpstack/adr-modules/example-file.js"]
Expand All @@ -103,7 +111,7 @@ When hosting via helm the steps are slightly different.
1. Make sure that the persistent volume claim belonging to the chirpstack exists in your hosted setup.
2. Find the actual name of the network-server pod. This can be done in a few ways. If you're have a connection via a GUI like `Lens` it can be found under the `Pods` list. If you're hosting on an Azure Kubernetes service, it can be found under the side menu `Workloads -> Pods`
3. Use `kubectl` to copy the module into the pod
```bash
```shell
kubectl cp ./path/to/module/adr-module chirpstack-xxxxxxxxx-xxxxx:/etc/chirpstack/adr-modules
```
4. Update `configmap.yaml` located under `/helm/charts/chirpstack/templates` with the path to the plugin under `[network]`, like this:
Expand Down
62 changes: 30 additions & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
#Chirpstack
chirpstack-network-server:
Expand All @@ -10,14 +8,14 @@ services:
chirpstack-application-server:
image: chirpstack/chirpstack-application-server:3.17.9
ports:
- 8084:8080
- '8080'
volumes:
- ./configuration/chirpstack-application-server:/etc/chirpstack-application-server

chirpstack-gateway-bridge:
image: chirpstack/chirpstack-gateway-bridge:4.0.10
ports:
- 1700:1700/udp
- '1700/udp'
volumes:
- ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge

Expand All @@ -27,14 +25,14 @@ services:
volumes:
- ./configuration/chirpstack:/etc/chirpstack
ports:
- 8080:8080
- '8080'

postgresql:
image: postgres:9.6-alpine
environment:
- POSTGRES_PASSWORD=root
ports:
- 5434:5432
- '5432'
volumes:
- ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
- postgresqldata:/var/lib/postgresql/data
Expand All @@ -47,54 +45,54 @@ services:
environment:
- POSTGRES_PASSWORD=root
ports:
- 5435:5432
- '5432'

redis:
image: redis:5-alpine
volumes:
- redisdata:/data
ports:
- 6379:6379
- '6379'

mosquitto:
image: eclipse-mosquitto:2
ports:
- 1883:1883
- '1883'
volumes:
- ./configuration/eclipse-mosquitto/mosquitto.conf:/mosquitto/config/mosquitto.conf

#OS2IoT
os2iot-frontend:
image: "os2iot-frontend"
image: os2iot-frontend
build:
context: "../OS2IoT-frontend"
dockerfile: "Dockerfile-prod"
context: ../OS2IoT-frontend
dockerfile: Dockerfile-prod
ports:
- "8081:8081"
- '8081'
environment:
PRODUCTION: "false"
BASE_URL: http://localhost:3000/api/v1/
TABLE_PAGE_SIZE: 25

#OS2IoT
os2iot-lorawanSimulator:
image: "os2iot-lorawan_simulator"
image: os2iot-lorawan_simulator
build:
context: "./simulator"
dockerfile: "Dockerfile"
context: ./simulator
dockerfile: Dockerfile
ports:
- "8768:8000"
- '8000'

os2iot-backend:
image: "os2iot-backend"
image: os2iot-backend
build:
context: ../OS2IoT-backend
dockerfile: Dockerfile
target: prod
ports:
- 3000:3000
- '3000'
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/status"]
test: ["CMD", "curl", "-f", "http://os2iot-backend:3000/status"]
interval: 10s
timeout: 5s
retries: 5
Expand Down Expand Up @@ -130,7 +128,7 @@ services:
restart: always
image: postgis/postgis # We need postgis to store geodata
ports:
- 5433:5432
- '5432'
hostname: os2iot-pg
healthcheck:
test: ["CMD-SHELL", "pg_isready -U os2iot"]
Expand All @@ -146,20 +144,20 @@ services:
- pg-data:/var/lib/postgresql:Z

os2iot-zookeeper:
image: "bitnami/zookeeper:latest"
image: bitnami/zookeeper:latest
ports:
- "2181:2181"
- '2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
volumes:
- os2iot-zookeeperdata:/data
tmpfs: "/datalog"
tmpfs: /datalog

os2iot-kafka:
image: "bitnami/kafka:latest"
image: bitnami/kafka:latest
ports:
- "9092:9092"
- "9093:9093"
- '9092'
- '9093'
environment:
- KAFKA_BROKER_ID=1
- KAFKA_LISTENERS=PLAINTEXT://:9092,INTERNAL://:9093
Expand All @@ -174,12 +172,12 @@ services:

mosquitto-os2iot:
image: os2iot-mosquitto
ports:
- 8884:8884
- 8885:8885
build:
context: "./mosquitto-broker"
dockerfile: "Dockerfile"
context: ./mosquitto-broker
dockerfile: Dockerfile
ports:
- '8884'
- '8885'
volumes:
- ./configuration/mosquitto-broker-os2iot/ca.crt:/etc/mosquitto/ca_certificates/ca.crt
- ./configuration/mosquitto-broker-os2iot/ca.key:/etc/mosquitto/ca_certificates/ca.key
Expand Down