Hello. I am trying to get librenms working using the container station. With help from one of the forum posters I figured out I need to use the “Applications” to enter the docker-compose.yml file info. I am trying to use this one as i was able to use it on an ubuntu vm at work. docker/examples/compose at master · librenms/docker · GitHub
This requires having two variable files in the same directory as the docker-compose.yml though. Is there a way to do this with container station? I need to create the .env and the librenms.env files in this same github folder. I tried the code here too but it still didn’t do the database correctly and gives an error on the db if you use it. docker-librenms/docker-compose.yml at master · jarischaefer/docker-librenms · GitHub This is the error ERROR: DB_HOST must be defined
Can you post your used compose (you can remove any used passwords of course or just replace them with placeholders)
name: librenms
services:
db:
image: mariadb:10
container_name: librenms_db
command:
- "mysqld"
- "--innodb-file-per-table=1"
- "--lower-case-table-names=1"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
volumes:
- "./db:/var/lib/mysql"
environment:
- "TZ=${TZ}"
- "MARIADB_RANDOM_ROOT_PASSWORD=yes"
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
- "MYSQL_USER=${MYSQL_USER}"
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
restart: always
redis:
image: redis:7.2-alpine
container_name: librenms_redis
environment:
- "TZ=${TZ}"
restart: always
msmtpd:
image: crazymax/msmtpd:latest
container_name: librenms_msmtpd
env_file:
- "./msmtpd.env"
restart: always
librenms:
image: librenms/librenms:latest
container_name: librenms
hostname: librenms
cap_add:
- NET_ADMIN
- NET_RAW
ports:
- target: 8000
published: 8000
protocol: tcp
depends_on:
- db
- redis
#- msmtpd
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
restart: always
dispatcher:
image: librenms/librenms:latest
container_name: librenms_dispatcher
hostname: librenms-dispatcher
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "DISPATCHER_NODE_ID=dispatcher1"
- "SIDECAR_DISPATCHER=1"
restart: always
syslogng:
image: librenms/librenms:latest
container_name: librenms_syslogng
hostname: librenms-syslogng
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 514
published: 514
protocol: tcp
- target: 514
published: 514
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SYSLOGNG=1"
restart: always
snmptrapd:
image: librenms/librenms:latest
container_name: librenms_snmptrapd
hostname: librenms-snmptrapd
cap_add:
- NET_ADMIN
- NET_RAW
depends_on:
- librenms
- redis
ports:
- target: 162
published: 162
protocol: tcp
- target: 162
published: 162
protocol: udp
volumes:
- "./librenms:/data"
env_file:
- "./librenms.env"
environment:
- "TZ=${TZ}"
- "PUID=${PUID}"
- "PGID=${PGID}"
- "DB_HOST=db"
- "DB_NAME=${MYSQL_DATABASE}"
- "DB_USER=${MYSQL_USER}"
- "DB_PASSWORD=${MYSQL_PASSWORD}"
- "DB_TIMEOUT=60"
- "SIDECAR_SNMPTRAPD=1"
restart: always
I would simplify first … use the YAMLS from here
Just change the port to not block your QNAP GUI
version: '3.9'
services:
web:
image: jarischaefer/docker-librenms
hostname: librenms
ports:
- "8000:80"
volumes:
- ./docker-persistence/logs:/opt/librenms/logs
- ./docker-persistence/rrd:/opt/librenms/rrd
environment:
- APP_KEY=base64:7cVDlhFEZ1dyxIuP38Yy72YuXrcGg1ISwAwZ2dKt4Pk=
- DB_HOST=db
- DB_NAME=librenms
- DB_USER=librenms
- DB_PASS=librenms
- POLLERS=16
- BASE_URL=http://localhost
- DAILY_ON_STARTUP=true
links:
- mysql:db
depends_on:
mysql:
condition: service_healthy
mysql:
image: mysql:8.0
command: --sql-mode=""
ports:
- "3306"
volumes:
- ./docker-persistence/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_USER=librenms
- MYSQL_PASSWORD=librenms
- MYSQL_DATABASE=librenms
healthcheck:
test: "mysql -h localhost -u root -p$$MYSQL_ROOT_PASSWORD -e 'USE librenms'"
interval: 5s
timeout: 5s
retries: 20
When this minimal version works, you can expand with additional options
You cannot do what you want from the Container Station (the GUI). Either you hardcode the values from your environment variables directly into your docker compose script (as others suggested above), either you do this from the command line. SSH to your QNAP, create a folder in your home directory where you create your docker-compose.yaml
file and next to it an .env
file in which you define your environment variables. Then you can deploy it using docker compose -p your-project-name up -d
. Easy.