diff options
author | Liao Junxuan | 2023-12-12 20:01:45 +0800 |
---|---|---|
committer | Liao Junxuan | 2023-12-12 20:03:16 +0800 |
commit | a3105b3954ccdce07e43083515408d1ee9ab32fd (patch) | |
tree | bd5ef9e9e9dc3928acc021ba18f7b71be3df0b53 | |
download | aur-a3105b3954ccdce07e43083515408d1ee9ab32fd.tar.gz |
add chatbot-ui-git
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | PKGBUILD | 56 | ||||
-rw-r--r-- | chatbot-ui.service | 45 | ||||
-rw-r--r-- | sysusers.conf | 1 |
4 files changed, 121 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..6d4e00763b0a --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = chatbot-ui-git + pkgdesc = An open source ChatGPT UI. + pkgver = r292.596d183 + pkgrel = 2 + url = https://github.com/mckaywrigley/chatbot-ui + arch = any + license = MIT + makedepends = git + makedepends = npm + depends = nodejs + options = !emptydirs + source = git+https://github.com/mckaywrigley/chatbot-ui.git + source = sysusers.conf + source = chatbot-ui.service + sha256sums = SKIP + sha256sums = 4de4e4d3bac91214398da078b3f2b5d72182b7e6a69c9124eb19713827942958 + sha256sums = 45dcb629ff221cd36d0f4c22cd5d886924233ada9b342bb0e59546fb35d1bea6 + +pkgname = chatbot-ui-git diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..983958c833b5 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,56 @@ +# Maintainer: Junxuan Liao <mikeljx at 126 dot com> + +_pkgname=chatbot-ui +pkgname=$_pkgname-git +pkgver=r292.596d183 +pkgrel=2 +pkgdesc="An open source ChatGPT UI." +arch=('any') +url='https://github.com/mckaywrigley/chatbot-ui' +license=('MIT') +depends=('nodejs') +makedepends=('git' 'npm') +source=("git+$url.git" + "sysusers.conf" + "chatbot-ui.service") +options=(!emptydirs) +sha256sums=('SKIP' + '4de4e4d3bac91214398da078b3f2b5d72182b7e6a69c9124eb19713827942958' + '45dcb629ff221cd36d0f4c22cd5d886924233ada9b342bb0e59546fb35d1bea6') + +pkgver() { + cd "${srcdir}/${_pkgname}" + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" +} + +prepare() { + cd "${_pkgname}" +} + +build() { + cd "${_pkgname}" + npm install + npm run build +} + +package() { + cd "${_pkgname}" + + install -m0755 -d "${pkgdir}/usr/share/webapps/${pkgname}" + + # install application parts + cp -a node_modules .next public next.config.js next-i18next.config.js "${pkgdir}/usr/share/webapps/${pkgname}" + install -m0644 package*.json -t "${pkgdir}/usr/share/webapps/${pkgname}" + + # Setup config files in /etc. + install -m0755 -d "${pkgdir}/etc/webapps/${pkgname}" + touch "${pkgdir}/etc/webapps/${pkgname}/.env.local" + + ln -s "/etc/webapps/${pkgname}/.env.local" "${pkgdir}/usr/share/webapps/${pkgname}/.env.local" + + # Configure chatbot-ui user and some directories writable for that user. + install -Dm0644 ${srcdir}/sysusers.conf "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + + # Install systemd service file. + install -Dm0644 -t "${pkgdir}/usr/lib/systemd/system/" "${srcdir}"/chatbot-ui.service +} diff --git a/chatbot-ui.service b/chatbot-ui.service new file mode 100644 index 000000000000..5c0354db1107 --- /dev/null +++ b/chatbot-ui.service @@ -0,0 +1,45 @@ +[Unit] +Description=An open source ChatGPT UI +After=network.target + +[Service] +Type=exec + +Environment=NODE_ENV=production + +User=chatbot-ui +Group=chatbot-ui + +WorkingDirectory=/usr/share/webapps/chatbot-ui-git +ExecStart=/usr/bin/node node_modules/.bin/next start + +CapabilityBoundingSet= +NoNewPrivileges=true +PrivateDevices=true +RemoveIPC=true +LockPersonality=true + +ProtectControlGroups=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectKernelLogs=true +ProtectClock=true +ProtectHostname=true +ProtectProc=noaccess + +RestrictRealtime=true +RestrictSUIDSGID=true +RestrictNamespaces=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 + +ProtectSystem=strict +ProtectHome=true +PrivateTmp=true +# ReadWritePaths=/var/lib/hedgedoc /run/hedgedoc + +SystemCallArchitectures=native +SystemCallFilter=@system-service @pkey + +[Install] +WantedBy=multi-user.target + diff --git a/sysusers.conf b/sysusers.conf new file mode 100644 index 000000000000..1ec361105a6e --- /dev/null +++ b/sysusers.conf @@ -0,0 +1 @@ +u chatbot-ui - "chatbot-ui user" |