From d994a23eacf32625bc9e26aff704546d50d698e8 Mon Sep 17 00:00:00 2001 From: dogukanoksuz Date: Mon, 20 Nov 2023 13:03:35 +0300 Subject: [PATCH] fix: Workflows --- .gitignore | 1 - build/debian/control | 8 ++++++ build/debian/postinst | 36 ++++++++++++++++++++++++ build/rhel/website.spec | 62 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 1 deletion(-) create mode 100644 build/debian/control create mode 100644 build/debian/postinst create mode 100644 build/rhel/website.spec diff --git a/.gitignore b/.gitignore index f5a296b..7313c32 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ coverage .next/ out/ dist/ -build # misc .DS_Store diff --git a/build/debian/control b/build/debian/control new file mode 100644 index 0000000..be378cf --- /dev/null +++ b/build/debian/control @@ -0,0 +1,8 @@ +Package: liman-website +Version: %VERSION% +Section: utils +Architecture: amd64 +Priority: optional +Maintainer: Doğukan Öksüz +Description: Liman Website Service +Depends: nodejs \ No newline at end of file diff --git a/build/debian/postinst b/build/debian/postinst new file mode 100644 index 0000000..cdb43a9 --- /dev/null +++ b/build/debian/postinst @@ -0,0 +1,36 @@ +#!/bin/bash + +if [ ! -d "/liman/website" ]; then + mkdir -p /liman/website +fi + +chmod -R 770 /liman/website +chown -R root:root /liman/website + +if [ -f "/usr/lib/systemd/system/liman-website.service" ]; then + rm -rf /usr/lib/systemd/system/liman-website.service 2>/dev/null || true + systemctl disable liman-website.service 2>/dev/null || true + systemctl stop liman-website.service 2>/dev/null || true + systemctl daemon-reload 2>/dev/null || true +fi + +echo """ +[Unit] +Description=Liman Website Service +After=network.target +StartLimitIntervalSec=0 +[Service] +Type=simple +Restart=always +RestartSec=1 +User=liman +WorkingDirectory=/liman/website +ExecStart=/usr/bin/node server.js + +[Install] +WantedBy=multi-user.target +""" > /usr/lib/systemd/system/liman-website.service + +systemctl daemon-reload +systemctl enable liman-website.service +systemctl restart liman-website.service \ No newline at end of file diff --git a/build/rhel/website.spec b/build/rhel/website.spec new file mode 100644 index 0000000..86c7116 --- /dev/null +++ b/build/rhel/website.spec @@ -0,0 +1,62 @@ +Name: liman-website +Version: %VERSION% +Release: 0 +License: MIT +Prefix: /liman/website +Summary: Liman Website Service +Group: Applications/System +BuildArch: x86_64 +Depends: nodejs + +%description +Liman Website Service + +%pre + +%prep + +%build + +%install +cp -rfa %{_app_dir} %{buildroot} + +%post -p /bin/bash +chmod -R 770 /liman/website +chown -R root:root /liman/website + +if [ -f "/usr/lib/systemd/system/liman-website.service" ]; then + rm -rf /usr/lib/systemd/system/liman-website.service 2>/dev/null || true + systemctl disable liman-website.service 2>/dev/null || true + systemctl stop liman-website.service 2>/dev/null || true + systemctl daemon-reload 2>/dev/null || true +fi + +echo """ +[Unit] +Description=Liman Website Service +After=network.target +StartLimitIntervalSec=0 +[Service] +Type=simple +Restart=always +RestartSec=1 +User=liman +WorkingDirectory=/liman/website +ExecStart=/usr/bin/node server.js + +[Install] +WantedBy=multi-user.target +""" > /usr/lib/systemd/system/liman-website.service + +systemctl daemon-reload +systemctl enable liman-website.service +systemctl restart liman-website.service + +%clean + +%files +%defattr(0770, root, root) +/liman/website/* +/liman/website/.env.example + +%define _unpackaged_files_terminate_build 0 \ No newline at end of file