Running the App with docker-compose
TIP
to install docker-compose
- download a binary and rename it
docker-compose - make it executable through
chmod +x docker-composeand move it to your/binfolder withsudo mv docker-compose /bin
Create a docker-compose.yml file:
services:
emoncms:
image: alexjunk/emoncms:alpine3.18_emoncms11.4.11
volumes:
- /data:/data
environment:
- TZ=Europe/Paris
- REDIS_BUFFER=1 # 0 to disable low-write mode
- EMONCMS_LOG_LEVEL=2 # 1=INFO, 2=WARN, 3=ERROR
- MYSQL_DATABASE=emoncms
- MYSQL_USER=emoncms
- MYSQL_PASSWORD=emonpiemoncmsmysql2016
- MQTT_USER=emonpi
- MQTT_PASSWORD=emonpimqtt2016
- MQTT_HOST=localhost
- MQTT_LOG_LEVEL=error
- CRT_FILE=/etc/ssl/apache2/server.pem
- KEY_FILE=/etc/ssl/apache2/server.key
- CNAME=localhost
ports:
# These ports are in format <host-port>:<container-port>
- 7443:443 # Public HTTPS Port
- 8081:80 # Public HTTP Port
- 9883:1883 # Public MQTT Port (if using the internal broker)
restart: always
Once you are happy with your compose file :
docker-compose up -d
persist your data
For persistent datas, create a folder named data at the root of the host.
If you just want an ephemeral test without persistent datas, remove the /data volume in the compose file.
mysql configuration
The mysql database is used to store metadatas.
Adjust MYSQL_USER and MYSQL_PASSWORD to the custom values of your taste.
WARNING
Please note you can only do that at the creation of the mariadb database.
MQTT
You can change the broker credentials and its IP/address when you want.
MQTT_LOG_LEVEL possible values :
- error
- warning
- information
- notice
- all
You can add more than one log level like that :
MQTT_LOG_LEVEL="error warning information notice"
WARNING
Using an external broker is possible only if listening on port 1883
https
Map a volume to a folder on the host including your customized credentials
Modify the env vars CRT_FILE and KEY_FILE with the path to the customized credentials