Projet

Général

Profil

0001-hobo-agent-use-systemd-service-16805.patch

Pierre Ducroquet, 27 mai 2022 10:45

Télécharger (4,13 ko)

Voir les différences:

Subject: [PATCH] hobo-agent: use systemd service (#16805)

note: based on patch from Christophe 2 years ago
 debian/agent/README.Debian   |  2 +-
 debian/agent/hobo-agent.conf | 26 --------------------------
 debian/control               |  3 +--
 debian/hobo-agent.dirs       |  1 -
 debian/hobo-agent.install    |  1 -
 debian/hobo-agent.postinst   |  4 ++--
 debian/hobo-agent.service    | 20 ++++++++++++++++++++
 7 files changed, 24 insertions(+), 33 deletions(-)
 delete mode 100644 debian/agent/hobo-agent.conf
 create mode 100644 debian/hobo-agent.service
debian/agent/README.Debian
2 2
=====================
3 3

  
4 4
1. Edit /etc/hobo-agent/settings.py (change BROKER_URL if distant)
5
2. Restart supervisor
5
2. Restart unit hobo-agent.service
debian/agent/hobo-agent.conf
1
[program:hobo-agent]
2
; Concurrency set to 1 because there is no lock around calls to hobo_notify
3
command=python3 /usr/bin/celery --app=hobo.agent.worker worker --hostname=agent.%%h --loglevel=INFO --concurrency=1 --max-tasks-per-child=100
4
environment=HOBO_AGENT_SETTINGS_FILE="/etc/hobo-agent/settings.py"
5
process_name=hobo-agent
6
user=hobo-agent
7
numprocs=1
8
stdout_logfile=/var/log/hobo-agent/stdout.log
9
stderr_logfile=/var/log/hobo-agent/stderr.log
10

  
11
autostart=true
12
autorestart=true
13
startsecs=10
14
; Need to wait for currently executing tasks to finish at shutdown.
15
; Increase this if you have very long running tasks.
16
stopwaitsecs = 600
17

  
18
; When resorting to send SIGKILL to the program to terminate it
19
; send SIGKILL to its whole process group instead,
20
; taking care of its children as well.
21
killasgroup=true
22

  
23
; if rabbitmq is supervised, set its priority higher
24
; so it starts first
25
priority=998
26

  
debian/control
48 48
Architecture: all
49 49
Depends: python3-hobo (= ${binary:Version}),
50 50
    python-celery-common,
51
    sudo,
52
    supervisor
51
    sudo
53 52
Description: Rapid Remote Deployment Agent
debian/hobo-agent.dirs
1 1
/etc/hobo-agent
2 2
/var/log/hobo-agent
3 3
/etc/sudoers.d
4
/etc/supervisor/conf.d
debian/hobo-agent.install
1 1
debian/agent/settings.py                       /etc/hobo-agent
2
debian/agent/hobo-agent.conf                   /etc/supervisor/conf.d
3 2
debian/agent/sudo-hobo-agent                   /etc/sudoers.d
debian/hobo-agent.postinst
27 27
    fi
28 28
    set -e
29 29
    if [ $START_HOBO_AGENT = 1 ]; then
30
      supervisorctl reread
31
      supervisorctl restart hobo-agent
30
      systemctl daemon-reload
31
      systemctl restart hobo-agent
32 32
    fi
33 33
  ;;
34 34

  
debian/hobo-agent.service
1
[Unit]
2
Description=Hobo Agent
3
After=network.target
4

  
5
[Service]
6
Environment=HOBO_AGENT_SETTINGS_FILE=/etc/%p/settings.py
7
Environment=LANG=C.UTF-8
8
User=%p
9
Group=%p
10
ExecStart=/usr/bin/python3 /usr/bin/celery worker --hostname=agent.%%h --app=hobo.agent.worker --concurrency=1 --maxtasksperchild=100
11
ExecReload=/bin/kill -HUP $MAINPID
12
KillSignal=SIGKILL
13
PrivateTmp=true
14
Restart=on-failure
15
RuntimeDirectory=hobo-agent
16
Type=simple
17
NotifyAccess=all
18

  
19
[Install]
20
WantedBy=multi-user.target
0
-