From e8f17346ff8fbf7358fb6118558cab4630f751a8 Mon Sep 17 00:00:00 2001 From: FlyingToto <68790909+FlyingToto@users.noreply.github.com> Date: Mon, 1 Sep 2025 22:02:25 -0400 Subject: [PATCH 1/2] 3rd attempt to add example 5 of docker compose! --- docs/DOCKER_COMPOSE.md | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/docs/DOCKER_COMPOSE.md b/docs/DOCKER_COMPOSE.md index ecde2533..6c4203e8 100755 --- a/docs/DOCKER_COMPOSE.md +++ b/docs/DOCKER_COMPOSE.md @@ -137,3 +137,58 @@ networks: ``` +### Example 5: same as 3 but with a single top level folder, fixed log ready to drop in portainer + +`docker-compose.yml` + +```yaml +services: + netalertx: + container_name: netalertx + # use the below line if you want to test the latest dev image instead of the stable release + # image: "ghcr.io/jokob-sk/netalertx-dev:latest" + image: "ghcr.io/jokob-sk/netalertx:latest" + network_mode: "host" + restart: unless-stopped + volumes: + - ${APP_FOLDER}/netalertx/config:/app/config + - ${APP_FOLDER}/netalertx/db:/app/db + # (optional) useful for debugging if you have issues setting up the container + - ${APP_FOLDER}/netalertx/log:/app/log + # (API: OPTION 1) default -> use for performance + - type: tmpfs + target: /app/api + # (API: OPTION 2) use when debugging issues + # - ${APP_FOLDER}/netalertx/api:/app/api + environment: + - TZ=${TZ} + - PORT=${PORT} +``` + +`.env` file + +```yaml +APP_FOLDER=/path/to/local/NetAlertX/location + +#ENVIRONMENT VARIABLES +PUID=200 +PGID=300 +TZ=America/New_York +LISTEN_ADDR=0.0.0.0 +PORT=20211 +#GLOBAL PATH VARIABLE + +# you may want to create a dedicated user and group to run the container with +# sudo groupadd -g 300 nax-g +# sudo useradd -u 200 -g 300 nax-u +# mkdir -p $APP_FOLDER/{db,config,log} +# chown -R 200:300 $APP_FOLDER +# chmod -R 775 $APP_FOLDER + +# DEVELOPMENT VARIABLES +# you can create multiple env files called .env.dev1, .env.dev2 etc and use them by running: +# docker compose --env-file .env.dev1 up -d +# you can then clone multiple dev copies of NetAlertX just make sure to change the APP_FOLDER and PORT variables in each .env.devX file +``` + +To run the container execute: `sudo docker-compose --env-file /path/to/.env up` From 1d7439833726773e16a67ef1f8b799ae8fde9c9e Mon Sep 17 00:00:00 2001 From: FlyingToto <68790909+FlyingToto@users.noreply.github.com> Date: Mon, 1 Sep 2025 22:13:02 -0400 Subject: [PATCH 2/2] adding address and uid/gid Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- docs/DOCKER_COMPOSE.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/DOCKER_COMPOSE.md b/docs/DOCKER_COMPOSE.md index 6c4203e8..5653fc33 100755 --- a/docs/DOCKER_COMPOSE.md +++ b/docs/DOCKER_COMPOSE.md @@ -148,11 +148,12 @@ services: # use the below line if you want to test the latest dev image instead of the stable release # image: "ghcr.io/jokob-sk/netalertx-dev:latest" image: "ghcr.io/jokob-sk/netalertx:latest" - network_mode: "host" + network_mode: "host" restart: unless-stopped + user: "${PUID}:${PGID}" volumes: - ${APP_FOLDER}/netalertx/config:/app/config - - ${APP_FOLDER}/netalertx/db:/app/db + - ${APP_FOLDER}/netalertx/db:/app/db # (optional) useful for debugging if you have issues setting up the container - ${APP_FOLDER}/netalertx/log:/app/log # (API: OPTION 1) default -> use for performance @@ -161,9 +162,11 @@ services: # (API: OPTION 2) use when debugging issues # - ${APP_FOLDER}/netalertx/api:/app/api environment: - - TZ=${TZ} + - TZ=${TZ} - PORT=${PORT} -``` + - PUID=${PUID} + - PGID=${PGID} + - LISTEN_ADDR=${LISTEN_ADDR} `.env` file