From 8817ddba0addcdbab70a59c8f1fa11b04175bb60 Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 14 Apr 2022 00:27:03 +0200 Subject: [PATCH] Add flame --- README.MD | 14 +++++ ressources/flame/debmaker | 54 +++++++++++++++++++ ressources/flame/rootfs/DEBIAN/changelog | 0 ressources/flame/rootfs/DEBIAN/conffiles | 1 + ressources/flame/rootfs/DEBIAN/control | 8 +++ ressources/flame/rootfs/DEBIAN/postinst | 5 ++ ressources/flame/rootfs/etc/default/flame | 5 ++ .../usr/lib/systemd/system/flame.service | 13 +++++ .../flame/rootfs/usr/share/flame/.gitkeep | 0 .../flame/rootfs/var/lib/flame/.gitkeep | 0 10 files changed, 100 insertions(+) create mode 100755 ressources/flame/debmaker create mode 100644 ressources/flame/rootfs/DEBIAN/changelog create mode 100644 ressources/flame/rootfs/DEBIAN/conffiles create mode 100644 ressources/flame/rootfs/DEBIAN/control create mode 100755 ressources/flame/rootfs/DEBIAN/postinst create mode 100644 ressources/flame/rootfs/etc/default/flame create mode 100644 ressources/flame/rootfs/usr/lib/systemd/system/flame.service create mode 100644 ressources/flame/rootfs/usr/share/flame/.gitkeep create mode 100644 ressources/flame/rootfs/var/lib/flame/.gitkeep diff --git a/README.MD b/README.MD index 115e1d2..56d1492 100644 --- a/README.MD +++ b/README.MD @@ -46,6 +46,7 @@ To enter in temporary filesystem - [adguardhome](#adguardhome) ([site](https://adguard.com/fr/adguard-home/overview.html)) ([src](https://github.com/AdguardTeam/AdguardHome)) - [authelia](#authelia) ([site](https://www.authelia.com/)) ([src](https://github.com/authelia/authelia)) - [element-web](#element-web) ([site](https://element.io/)) ([src](https://github.com/vector-im/element-web)) + - [flame](#flame) ([site](https://github.com/pawelmalak/flame)) ([src](https://github.com/pawelmalak/flame)) - [gitea](#gitea) ([site](https://gitea.io)) ([src](https://github.com/go-gitea/gitea/)) - [glpi](#glpi) ([site](http://glpi-project.org/)) ([src](https://github.com/glpi-project/glpi)) - [gotify](#gotify) ([site](https://gotify.net/)) ([src](https://github.com/gotify)) @@ -104,6 +105,19 @@ a2ensite element-web systemctl restart apache2 ``` +#### flame + +```bash +apt install -y wget ca-certificates +wget -qO - https://deb.lgy.fr/install.sh | bash +apt-get update +apt-get install -y flame + +#Edit /etc/default/flame and change SECRET and PASSWORD + +systemctl enable --now flame +``` + #### gitea ```bash diff --git a/ressources/flame/debmaker b/ressources/flame/debmaker new file mode 100755 index 0000000..e9b501f --- /dev/null +++ b/ressources/flame/debmaker @@ -0,0 +1,54 @@ +#!/bin/bash + +VERSION=2.3.0 + +[ -e ./lib/function.sh ] && source ./lib/function.sh + +APP=flame +DEPOT=https://github.com/pawelmalak/flame.git +GIT_VERSION=v${VERSION} +DEB_VERSION=${VERSION}-$(date +%Y%m%d%H%M) +DEBIAN_VERSION_CODENAME=bullseye +IMAGE_SIZE=3 + +STEP="envinit prebuild build makedeb" + +envinit() { + apt-get update + if [ $(dpkg -l | grep -e 'ii nodejs ' | wc -l) -eq 1 ]; + then + apt-get dist-upgrade -y + else + apt install -y --no-install-recommends git wget ca-certificates dpkg fakeroot build-essential nodejs npm + fi +} + +prebuild(){ + [ -e /tmp/git ] && rm -fr /tmp/git + [ -e /tmp/${APP} ] || mkdir /tmp/${APP} + git clone --depth 1 -b ${GIT_VERSION} ${DEPOT} /tmp/git + cp -r /tmp/git/. /tmp/${APP} +} + +build() { + cd /tmp/${APP}/ + npm install mkdirp + npm run dev-init + cd client + npm run build + rm -fr ../public/* + mv build/* ../public/ +} + +makedeb(){ + PATH_DEB=/tmp/src/rootfs + + cp -fr /tmp/${APP}/* ${PATH_DEB}/usr/share/flame/ + mv ${PATH_DEB}/usr/share/flame/data ${PATH_DEB}/var/lib/${APP}/data + mv ${PATH_DEB}/usr/share/flame/public ${PATH_DEB}/var/lib/${APP}/public + ln -fs /var/lib/${APP}/data ${PATH_DEB}/usr/share/${APP}/data + ln -fs /var/lib/${APP}/public ${PATH_DEB}/usr/share/${APP}/public + + sed -i "s/%VERSION%/$DEB_VERSION/" ${PATH_DEB}/DEBIAN/control + fakeroot dpkg-deb -Z gzip --build ${PATH_DEB} /tmp/dist +} diff --git a/ressources/flame/rootfs/DEBIAN/changelog b/ressources/flame/rootfs/DEBIAN/changelog new file mode 100644 index 0000000..e69de29 diff --git a/ressources/flame/rootfs/DEBIAN/conffiles b/ressources/flame/rootfs/DEBIAN/conffiles new file mode 100644 index 0000000..c8bfc7d --- /dev/null +++ b/ressources/flame/rootfs/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/default/flame diff --git a/ressources/flame/rootfs/DEBIAN/control b/ressources/flame/rootfs/DEBIAN/control new file mode 100644 index 0000000..0fad2ae --- /dev/null +++ b/ressources/flame/rootfs/DEBIAN/control @@ -0,0 +1,8 @@ +Package: flame +Version: %VERSION% +Section: base +Priority: optional +Architecture: all +Depends:nodejs +Maintainer: Thomas Legay +Description: flame diff --git a/ressources/flame/rootfs/DEBIAN/postinst b/ressources/flame/rootfs/DEBIAN/postinst new file mode 100755 index 0000000..c22cc6a --- /dev/null +++ b/ressources/flame/rootfs/DEBIAN/postinst @@ -0,0 +1,5 @@ +#!/bin/bash + +id flame &> /dev/null || useradd flame -r -s /bin/false + +chown -R flame:flame /var/lib/flame diff --git a/ressources/flame/rootfs/etc/default/flame b/ressources/flame/rootfs/etc/default/flame new file mode 100644 index 0000000..5bc878f --- /dev/null +++ b/ressources/flame/rootfs/etc/default/flame @@ -0,0 +1,5 @@ +PORT=5005 +NODE_ENV=production +VERSION=2.3.0 +PASSWORD=flame_password +SECRET=e02eb43d69953658c6d07311d6313f2d4467672cb881f96b29368ba1f3f4da4b diff --git a/ressources/flame/rootfs/usr/lib/systemd/system/flame.service b/ressources/flame/rootfs/usr/lib/systemd/system/flame.service new file mode 100644 index 0000000..2a7fb93 --- /dev/null +++ b/ressources/flame/rootfs/usr/lib/systemd/system/flame.service @@ -0,0 +1,13 @@ +[Unit] +Description=Flame server +After=multi-user.target + +[Service] +User=flame +Group=flame +EnvironmentFile=/etc/default/flame +ExecStart=/usr/bin/node server.js +WorkingDirectory=/usr/share/flame + +[Install] +WantedBy=multi-user.target diff --git a/ressources/flame/rootfs/usr/share/flame/.gitkeep b/ressources/flame/rootfs/usr/share/flame/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ressources/flame/rootfs/var/lib/flame/.gitkeep b/ressources/flame/rootfs/var/lib/flame/.gitkeep new file mode 100644 index 0000000..e69de29