Fix missing things from the nats server package

Signed-off-by: Johan Bernhardsson <johan.bernhardsson@redpill-linpro.com>
This commit is contained in:
Johan Bernhardsson 2025-05-15 10:46:43 +02:00
parent be2c1f4f84
commit 8a4e470797

View File

@ -50,6 +50,9 @@ else
fi
sed "/# Talk Signaling Server/d" /etc/hosts >/dev/null 2>&1
sed "/127.0.1.1 $SUBDOMAIN/d" /etc/hosts >/dev/null 2>&1
systemctl stop nats-server
systemctl disable nats-server
deluser nats
nextcloud_occ_no_check config:app:delete spreed stun_servers
nextcloud_occ_no_check config:app:delete spreed turn_servers
nextcloud_occ_no_check config:app:delete spreed signaling_servers
@ -70,6 +73,7 @@ else
/etc/apt/sources.list.d/morph027-janus.list \
/etc/apt/sources.list.d/morph027-nats-server.list \
/etc/apt/sources.list.d/morph027-coturn.list \
/lib/systemd/system/nats-server.service \
"$VMLOGS"/talk_apache_error.log \
"$VMLOGS"/talk_apache_access.log \
"$VMLOGS"/turnserver.log \
@ -297,7 +301,48 @@ curl -sL -o "/etc/apt/trusted.gpg.d/morph027-nats-server.asc" "https://packaging
echo "deb https://packaging.gitlab.io/nats-server nats main" > /etc/apt/sources.list.d/morph027-nats-server.list
apt-get update -q4 & spinner_loading
install_if_not nats-server
getent passwd nats >/dev/null 2>&1 || adduser \
--system \
--shell /usr/sbin/nologin \
--gecos 'High-Performance server for NATS, the cloud native messaging system.' \
--group \
--disabled-password \
--no-create-home \
nats
chown nats:nats /etc/nats/nats.conf
# Check if nats systemd service is in the package or not
if [ ! -f "/lib/systemd/system/nats-server.service" ];
then
# Generate nats systemd service
cat << NATS_SYSTEMD > /lib/systemd/system/nats-server.service
[Unit]
Description=NATS messaging server
Documentation=https://docs.nats.io/nats-server/
After=network-online.target
[Service]
ExecStart=/usr/bin/nats-server --config /etc/nats/nats.conf
User=nats
Group=nats
Restart=on-failure
[Install]
WantedBy=multi-user.target
NATS_SYSTEMD
if [ -f "/lib/systemd/system/nats-server.service" ];
then
print_text_in_color "$IGreen" "NATS systemd service was successfully created."
else
print_text_in_color "$IRed" "Unable to create NATS systemd service , exiting..."
print_text_in_color "$IRed" "Please report this issue here $ISSUES"
exit 1
fi
else
print_text_in_color "$IGreen" "Nats systemd service is already in place, continuing"
fi
start_if_stopped nats-server
check_command systemctl enable nats-server