From 84465e3e2b735d94a9c7eac7b529a36f4890c5ba Mon Sep 17 00:00:00 2001
From: Tamas Gal <himself@tamasgal.com>
Date: Mon, 29 Jul 2024 11:43:08 +0200
Subject: [PATCH] Modernise compose and make it compatible with new DNS names
 (dash instead underscore)

---
 README.md                        | 12 +++----
 backend/supervisord.conf.example | 18 +++++-----
 docker-compose.yml               | 57 +++++++++++++++++++++++++++++---
 3 files changed, 67 insertions(+), 20 deletions(-)

diff --git a/README.md b/README.md
index 15bf550..0809ed1 100644
--- a/README.md
+++ b/README.md
@@ -33,14 +33,14 @@ uncomment the `build` lines in the `docker-compose.yml`.
 
 The monitoring system can be started using
 
-    docker-compose up -d
+    docker compose up -d
 
 This will download and build all the required images and launch the containers
 for each service. It will also create an overlay network.
 
 To stop it it
 
-    docker-compose down
+    docker compose down
 
 ## Monitoring the monitoring
 
@@ -49,7 +49,7 @@ Log files are kept in `logs/`, data dumps in `data/` and plots in `plots/`.
 To check the logs or follow them in real-time (`-f`) and limit the rewind
 to a number of lines `--tail=N`, e.g.
 
-    docker-compose logs -f --tail=10 SERVICE_NAME
+    docker compose logs -f --tail=10 SERVICE_NAME
 
 The `SERVICE_NAME` can be any of `backend`, `frontend`, `ligier`, `ligiermirror`,
 `ligierlogmirror`, `reco` or `livelog`.
@@ -144,9 +144,9 @@ The monitoring processes talk to the KM3NeT Oracle DB service and need an
 valid session cookie. The monitoring servers of the ORCA and ARCA shore stations
 are whitelisted, but if you run the system on other machines, you need to provide
 the cookie string for that specific machine. To get the cookie string, run the
-monitoring system with `docker-compose up -d` and connect to the backend with
+monitoring system with `docker compose up -d` and connect to the backend with
 
-    # docker exec -it monitoring_backend_1 bash
+    # docker exec -it monitoring-backend-1 bash
 
 To get a session cookie, query the database however you like, e.g.
 
@@ -165,5 +165,5 @@ container!) with the following entry (of course with your cookie string):
 
 and restart the whole monitoring system with
 
-    docker-compose down && docker-compose up -d
+    docker compose down && docker compose up -d
 
diff --git a/backend/supervisord.conf.example b/backend/supervisord.conf.example
index e2cc3cd..03cde81 100644
--- a/backend/supervisord.conf.example
+++ b/backend/supervisord.conf.example
@@ -37,7 +37,7 @@ stdout_logfile=/logs/%(program_name)s.out.log        ; stdout log path, NONE for
 stderr_logfile=/logs/%(program_name)s.err.log        ; stderr log path, NONE for none; default AUTO
 
 [program:ahrs_calibration]
-command=python -u scripts/ahrs_calibration.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/ahrs_calibration.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
 ;priority=999                  ; the relative start priority (default 999)
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
@@ -48,7 +48,7 @@ stdout_logfile=/logs/%(program_name)s.out.log        ; stdout log path, NONE for
 stderr_logfile=/logs/%(program_name)s.err.log        ; stderr log path, NONE for none; default AUTO
 
 [program:dom_activity]
-command=python -u scripts/dom_activity.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/dom_activity.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -56,7 +56,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:dom_rates]
-command=python -u scripts/dom_rates.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/dom_rates.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -64,7 +64,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:pmt_rates]
-command=python -u scripts/pmt_rates.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1 -i 20 -u 1
+command=python -u scripts/pmt_rates.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1 -i 20 -u 1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -72,7 +72,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:trigger_rates]
-command=python -u scripts/trigger_rates.py -l monitoring_ligier_1
+command=python -u scripts/trigger_rates.py -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -80,7 +80,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
  
 [program:triggermap]
-command=python -u scripts/live_triggermap.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/live_triggermap.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -88,7 +88,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:ztplot]
-command=python -u scripts/ztplot.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/ztplot.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -104,7 +104,7 @@ stdout_logfile=/logs/%(program_name)s.out.log
 stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:triggeredhits]
-command=python -u scripts/triggered_hits.py -d %(ENV_DETECTOR_ID)s -l monitoring_ligier_1
+command=python -u scripts/triggered_hits.py -d %(ENV_DETECTOR_ID)s -l monitoring-ligier-1
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
@@ -141,7 +141,7 @@ stderr_logfile=/logs/%(program_name)s.err.log
 ;stderr_logfile=/logs/%(program_name)s.err.log
 
 [program:timesync_monitor]
-command=python -u scripts/timesync_monitor.py -l monitoring_ligier_1 -m %(ENV_LOG_LIGIER_IP)s -q %(ENV_LOG_LIGIER_PORT)s
+command=python -u scripts/timesync_monitor.py -l monitoring-ligier-1 -m %(ENV_LOG_LIGIER_IP)s -q %(ENV_LOG_LIGIER_PORT)s
 startsecs=5                   ; # of secs prog must stay up to be running (def. 1)
 startretries=30                ; max # of serial start failures when starting (default 3)
 autorestart=true        ; when to restart if exited after running (def: unexpected)
diff --git a/docker-compose.yml b/docker-compose.yml
index 4357eb6..8ad0bbd 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,10 @@
-version: "3"
 services:
     ligier:
         image: "docker.km3net.de/jpp:v14.4.3"
+        deploy:
+          resources:
+           limits:
+             memory: 1024M
         command: JLigier -d2
         volumes:
             - ./logs:/logs
@@ -10,9 +13,13 @@ services:
 
     ligiermirror:
         image: "docker.km3net.de/jpp:v14.4.3"
+        deploy:
+          resources:
+           limits:
+             memory: 512M
         env_file:
             - .env
-        command: JLigierMirror -H ${DAQ_LIGIER_IP}:${DAQ_LIGIER_PORT} -X monitoring_ligier_1:5553 -t "${TAGS_TO_MIRROR}"
+        command: JLigierMirror -H ${DAQ_LIGIER_IP}:${DAQ_LIGIER_PORT} -X monitoring-ligier-1:5553 -t "${TAGS_TO_MIRROR}"
         volumes:
             - ./logs:/logs
         depends_on:
@@ -21,9 +28,13 @@ services:
 
     ligierlogmirror:
         image: "docker.km3net.de/jpp:v14.4.3"
+        deploy:
+          resources:
+           limits:
+             memory: 512M
         env_file:
             - .env
-        command: JLigierMirror -H ${LOG_LIGIER_IP}:${LOG_LIGIER_PORT} -X monitoring_ligier_1:5553 -t "MSG Born Died"
+        command: JLigierMirror -H ${LOG_LIGIER_IP}:${LOG_LIGIER_PORT} -X monitoring-ligier-1:5553 -t "MSG Born Died"
         volumes:
             - ./logs:/logs
         depends_on:
@@ -32,9 +43,13 @@ services:
 
     ligiertmchmirror:
         image: "docker.km3net.de/jpp:v14.4.3"
+        deploy:
+          resources:
+           limits:
+             memory: 512M
         env_file:
             - .env
-        command: JLigierMirror -H ${TMCH_LIGIER_IP}:${TMCH_LIGIER_PORT} -X monitoring_ligier_1:5553 -t IO_MONIT
+        command: JLigierMirror -H ${TMCH_LIGIER_IP}:${TMCH_LIGIER_PORT} -X monitoring-ligier-1:5553 -t IO_MONIT
         volumes:
             - ./logs:/logs
         depends_on:
@@ -44,6 +59,10 @@ services:
     backend:
         # build: ./backend
         image: "docker.km3net.de/km3mon-backend:${KM3MON_VERSION}"
+        deploy:
+          resources:
+           limits:
+             memory: 8192M
         env_file:
             - .env
         volumes:
@@ -57,9 +76,13 @@ services:
     reco:
         # build: ./reco
         image: "docker.km3net.de/km3mon-reco:${KM3MON_VERSION}"
+        deploy:
+          resources:
+           limits:
+             memory: 4096M
         env_file:
             - .env
-        command: monitoring_ligier_1 ${MONITORING_LIGIER_PORT}
+        command: monitoring-ligier-1 ${MONITORING_LIGIER_PORT}
         volumes:
             - ./reco:/reco
             - ./logs:/logs
@@ -71,6 +94,10 @@ services:
     frontend:
         # build: ./frontend
         image: "docker.km3net.de/km3mon-frontend:${KM3MON_VERSION}"
+        deploy:
+          resources:
+           limits:
+             memory: 1024M
         env_file:
             - .env
         ports:
@@ -84,8 +111,28 @@ services:
     livelog:
         # build: ./livelog
         image: "docker.km3net.de/km3mon-livelog:${KM3MON_VERSION}"
+        deploy:
+          resources:
+           limits:
+            memory: 1024M
         ports:
             - ${LOGGING_PORT}:9001
         volumes:
             - ./logs:/logs
         restart: unless-stopped
+
+    fibonaccifit:
+        image: "fibonaccifit"
+        deploy:
+          resources:
+           limits:
+             memory: 4096M
+        env_file:
+            - .env
+        command: monitoring-ligier-1 ${MONITORING_LIGIER_PORT}
+        volumes:
+            - ./logs:/logs
+            - ./plots:/plots
+            - ./data:/data
+            - ./fibonaccifit:/reco/src
+        restart: unless-stopped
-- 
GitLab