You are not logged in.

#1 2021-07-27 17:34:43

aquilarubra
Member
From: Trieste, Italy
Registered: 2018-11-24
Posts: 45

issues with systemd socket activated service

Hello, I am trying to create a package for pgAdmin4, pip version. It should start socket activated.

The issue is that, after the socket correctly calls the service, the service keeps reloading the ExecStart script and the script cannot bind to the port because it sees it as already in use (the socket is listening on it). So, something is definitely wrong.

The script requires a bit of time to execute, as it also tries to update the installation, but even if I comment the updating line the behavior is same.

run.sh

#!/bin/sh

cd /usr/share
python -m venv pgadmin4
source /usr/share/pgadmin4/bin/activate
PIP_CONFIG_FILE=/dev/null pip install --isolated pgadmin4
pgadmin4

pgadmin4-pip.socket

[Unit]
Description=pgAdmin4 Pip Socket
PartOf=pgadmin4-pip.service

[Socket]
ListenStream=127.0.0.1:5050

[Install]
WantedBy=default.target

pgadmin4-pip.service

[Unit]
Description=pgAdmin4-pip Service
After=network.target pgadmin4-pip.socket
Requires=pgadmin4-pip.socket

[Service]
Type=simple
ExecStart=/usr/share/pgadmin4/run.sh
TimeoutStopSec=5

[Install]
WantedBy=default.target

If I use another port, for example 5051, for the socket, then the server starts correctly at port 5050. It seems that the socket does not release the port to the pgadmin script. Any idea?

Offline

#2 2021-07-30 17:29:51

loqs
Member
Registered: 2014-03-06
Posts: 13,940

Re: issues with systemd socket activated service

Does pgadmin4 support socket based activation?  How are you passing the socket file descriptor to pgadmin4?

Offline

Board footer

Powered by FluxBB