feat: install-shop-service.sh для установки systemd unit

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
shop
2026-05-17 13:25:57 +03:00
parent da77b1f8da
commit b44419aebd
4 changed files with 113 additions and 20 deletions
+17 -9
View File
@@ -33,16 +33,24 @@ if command -v pg_isready >/dev/null; then
}
fi
if systemctl is-active --quiet shop 2>/dev/null; then
if [ -f /etc/systemd/system/shop.service ]; then
systemctl daemon-reload
systemctl restart shop
sleep 1
curl -sf http://127.0.0.1:3000/health && echo || {
echo "shop не отвечает — смотрите: journalctl -u shop -n 30"
sleep 2
if curl -sf http://127.0.0.1:3000/health; then
echo ""
echo "OK"
systemctl reload caddy 2>/dev/null || true
else
echo "shop не отвечает — journalctl -u shop -n 30"
exit 1
}
systemctl reload caddy 2>/dev/null || true
echo "OK"
fi
elif [ "$(id -u)" -eq 0 ]; then
echo "Служба shop не установлена — устанавливаем..."
bash "$SCRIPT_DIR/install-shop-service.sh"
else
echo "Служба shop не установлена. См. deploy/shop.service"
echo "WorkingDirectory в unit должен совпадать с: $SHOP_ROOT"
echo "Служба shop не установлена. Выполните от root:"
echo " sudo bash $SHOP_ROOT/scripts/install-shop-service.sh"
echo "WorkingDirectory: $SHOP_ROOT"
exit 1
fi