Ergo deployment improvements, new Ergo update and Ergo removal scripts
Signed-off-by: Georg Pfuetzenreuter <georg@lysergic.dev>
This commit is contained in:
parent
b3f17a4721
commit
9ad1234cc4
@ -21,6 +21,34 @@ cd /opt/ergo/ergo-git
|
|||||||
sudo -u ergo make build
|
sudo -u ergo make build
|
||||||
sudo -u ergo chmod +x ergo
|
sudo -u ergo chmod +x ergo
|
||||||
ln -s /opt/ergo/ergo-git/ergo /opt/ergo/ergo
|
ln -s /opt/ergo/ergo-git/ergo /opt/ergo/ergo
|
||||||
|
cat <<'EOF' >/etc/systemd/system/ergo.service
|
||||||
|
[Unit]
|
||||||
|
Description=Ergo IRCd
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=ergo
|
||||||
|
Group=ergo
|
||||||
|
ExecStart=/opt/ergo/ergo run --conf /opt/ergo/ircd.yaml
|
||||||
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
Restart=on-failure
|
||||||
|
LimitNOFILE=1048576
|
||||||
|
SyslogIdentifier=ergo
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
sudo -u ergo cp /opt/ergo/ergo-git/default.yaml /opt/ergo/ircd.yaml
|
||||||
|
sudo -u ergo mkdir /opt/ergo/tls
|
||||||
|
sed -i 's/path: ircd.db/path: \/opt\/ergo\/ircd.db/' /opt/ergo/ircd.yaml
|
||||||
|
sed -i 's/cert: fullchain.pem/cert: \/opt\/ergo\/tls\/fullchain.pem/' /opt/ergo/ircd.yaml
|
||||||
|
sed -i 's/key: privkey.pem/key: \/opt\/ergo\/tls\/privkey.pem/' /opt/ergo/ircd.yaml
|
||||||
|
sed -i 's/path: languages/path: \/opt\/ergo\/ergo-git\/languages/' /opt/ergo/ircd.yaml
|
||||||
|
sudo -u ergo /opt/ergo/ergo initdb --conf /opt/ergo/ircd.yaml
|
||||||
|
sudo -u ergo /opt/ergo/ergo mkcerts --conf /opt/ergo/ircd.yaml
|
||||||
|
systemctl enable ergo.service
|
||||||
|
systemctl start ergo.service
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "This is currently only compatible with Go 1.16.6 or higher. Consider deploy_go.sh."
|
echo "This is currently only compatible with Go 1.16.6 or higher. Consider deploy_go.sh."
|
||||||
|
19
scripts/sh/remove_ergo.sh
Executable file
19
scripts/sh/remove_ergo.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if [ ! /opt/ergo ]
|
||||||
|
echo
|
||||||
|
then
|
||||||
|
read -p "Remove Ergo? This will kill running Ergo services and cause data loss. " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
echo "Removing Ergo"
|
||||||
|
systemctl disable --now ergo.service || true
|
||||||
|
rm -f /etc/systemd/system/ergo.service
|
||||||
|
rm -rf /opt/ergo
|
||||||
|
userdel -f ergo
|
||||||
|
groupdel -f ergo
|
||||||
|
echo "OK"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Could not find a compatible installation of Ergo."
|
||||||
|
fi
|
26
scripts/sh/update_ergo.sh
Executable file
26
scripts/sh/update_ergo.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
GOVER=`go version | { read _ _ v _; echo ${v#go}; }`
|
||||||
|
echo "Detected Go $GOVER"
|
||||||
|
GOVER_REQ="1.16.0"
|
||||||
|
if [ "$(printf '%s\n' "$GOVER_REQ" "$GOVER" | sort -V | head -n1)" = "$GOVER_REQ" ]
|
||||||
|
then
|
||||||
|
if [ -f /opt/ergo/ergo-git/ergo ]
|
||||||
|
then
|
||||||
|
read -p "Update Ergo on this system? This will immediately stop Ergo if it is running. " -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
systemctl stop ergo.service
|
||||||
|
cd /opt/ergo/ergo-git
|
||||||
|
rm -f ergo
|
||||||
|
git pull
|
||||||
|
sudo -u ergo make build
|
||||||
|
sudo -u ergo /opt/ergo/ergo-git/ergo upgradedb --conf /opt/ergo/ircd.yaml
|
||||||
|
systemctl start ergo.service
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Ergo does not seem to be installed. Consider deploy_ergo.sh."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "This is currently only compatible with Go $GOVER_REQ or higher. Consider deploy_go.sh."
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user