diff options
author | envolution | 2025-01-21 13:45:22 -0500 |
---|---|---|
committer | envolution | 2025-01-21 13:45:22 -0500 |
commit | aa56a2ce8a1a3b5bb5728cc214cb660324b01337 (patch) | |
tree | c0d678c980b87e61f259d9887a0eeeeeb1d1f867 | |
parent | 06f6f8b2416453749c5424e39fd8bd0440526dce (diff) | |
download | aur-owncast.tar.gz |
update web bundle packaging as per suggestions
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 54 | ||||
-rw-r--r-- | nginx.sample.conf | 19 | ||||
-rw-r--r-- | owncast.install | 20 | ||||
-rw-r--r-- | owncast.tempfiles.conf | 2 |
5 files changed, 80 insertions, 29 deletions
@@ -1,12 +1,14 @@ pkgbase = owncast pkgdesc = Self-hosted live video streaming (chat included) pkgver = 0.2.1 - pkgrel = 3 + pkgrel = 4 install = owncast.install arch = x86_64 license = MIT makedepends = git makedepends = go + makedepends = npm + makedepends = nvm depends = glibc options = emptydirs options = !strip @@ -14,9 +16,11 @@ pkgbase = owncast source = owncast.tempfiles.conf source = owncast.users.conf source = owncast.service - b2sums = fd9a0837e6df00e24891bed53c6c62648303efce48e3f57e73967e5d329f4146b01ea52bbcfcb52f8ddd480005b25c79be9383969ffe3da11ec00a9e640a4b37 - b2sums = 1cbb1583a031ebb62cc340e565da4562a1eee77e1ec01dffa6b99eb155c9ea7a8000cebf95093f1a5af197ab3b45e69bb13bfcbc81137d79b93c68f7d5ed5584 - b2sums = 157be9c742c578f9096b32b877dae28627783f55bf6c5ca575bfa60b8b329c3096e4e1ebacc2b1eac7f6804fa6692dac89360d4160921f867a1a3f14954b3d4a - b2sums = 4466d8017f264a7b7be432418ac6ba76c610459754ca85f10403a8f4577227588c26911738e3726349c3cdf1c041219a3c4d6840bfa4959f965678dfb97343ef + source = nginx.sample.conf + sha256sums = 99be2d22136304e14febeb3ff29cc5e38abb0c2ded59b408531564c59d9849cf + sha256sums = bba4d75a41a90d778928439bc8e1c21b359dcc45d0b909ba5171ac2fb2c05a3b + sha256sums = d822e9e1e4d6fb58c76ebcb2d5e30e4d4d79c7599c135365163c4f6074e33cb2 + sha256sums = 07b76935dec80397e0a5f8db4bc64dc7fec5c620388e1971e2961b7b6eeb352c + sha256sums = 608a36e7ac62b07d08091d547f909571ecf9cc33e8fc1578d64d064f61183675 pkgname = owncast @@ -1,38 +1,61 @@ # Maintainer: envolution +# Contributor: schlmm - packaging suggestions # Contributor: éclairevoyant # shellcheck shell=bash disable=SC2034,SC2154 pkgname=owncast pkgver=0.2.1 -pkgrel=3 +pkgrel=4 +_npmver=hydrogen pkgdesc='Self-hosted live video streaming (chat included)' arch=(x86_64) license=(MIT) depends=(glibc) -makedepends=(git go) +makedepends=(git go npm nvm) source=( "$pkgname-$pkgver.tar.gz::https://github.com/owncast/owncast/archive/refs/tags/v${pkgver}.tar.gz" owncast.tempfiles.conf owncast.users.conf owncast.service + nginx.sample.conf ) -b2sums=('fd9a0837e6df00e24891bed53c6c62648303efce48e3f57e73967e5d329f4146b01ea52bbcfcb52f8ddd480005b25c79be9383969ffe3da11ec00a9e640a4b37' - '1cbb1583a031ebb62cc340e565da4562a1eee77e1ec01dffa6b99eb155c9ea7a8000cebf95093f1a5af197ab3b45e69bb13bfcbc81137d79b93c68f7d5ed5584' - '157be9c742c578f9096b32b877dae28627783f55bf6c5ca575bfa60b8b329c3096e4e1ebacc2b1eac7f6804fa6692dac89360d4160921f867a1a3f14954b3d4a' - '4466d8017f264a7b7be432418ac6ba76c610459754ca85f10403a8f4577227588c26911738e3726349c3cdf1c041219a3c4d6840bfa4959f965678dfb97343ef') +sha256sums=('99be2d22136304e14febeb3ff29cc5e38abb0c2ded59b408531564c59d9849cf' + 'bba4d75a41a90d778928439bc8e1c21b359dcc45d0b909ba5171ac2fb2c05a3b' + 'd822e9e1e4d6fb58c76ebcb2d5e30e4d4d79c7599c135365163c4f6074e33cb2' + '07b76935dec80397e0a5f8db4bc64dc7fec5c620388e1971e2961b7b6eeb352c' + '608a36e7ac62b07d08091d547f909571ecf9cc33e8fc1578d64d064f61183675') + options=(emptydirs !strip) install=$pkgname.install +_ensure_local_nvm() { + which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload + export NVM_DIR="${srcdir}/.nvm" + source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] +} + prepare() { - cd "$pkgname-$pkgver" - sed -i '/rev-parse.*show-toplevel/{c\ - cd /usr/share/webapps/owncast\ - rm -rf web/node_modules web/package-lock.json - }' build/web/bundleWeb.sh - sed -i 's/npm.*silent.*install.*/npm install/' build/web/bundleWeb.sh + #select npm version + _ensure_local_nvm + nvm install --lts=${_npmver} + + #prepare web bundle + rm -rf bundleWeb && mkdir -p bundleWeb + cd "${pkgname}-${pkgver}" + cp build/web/bundleWeb.sh "$srcdir/bundleWeb" + sed -i "/rev-parse.*show-toplevel/c\ +cd \"${srcdir}/${pkgname}-${pkgver}\"\\ +rm -rf web/node_modules web/package-lock.json" "$srcdir/bundleWeb/bundleWeb.sh" + + #build with verbosity + sed -i 's/npm.*silent.*install.*/npm install/' "$srcdir/bundleWeb/bundleWeb.sh" } + build() { + #build frontend + bundleWeb/bundleWeb.sh + cd "$pkgname-$pkgver" # Build backend export CGO_CPPFLAGS="${CPPFLAGS}" @@ -46,10 +69,11 @@ package() { install -vDm644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" install -vDm644 $pkgname.users.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" install -vDm644 $pkgname.tempfiles.conf "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf" + install -vDm644 nginx.sample.conf -t "$pkgdir/usr/share/$pkgname/" + cd $pkgname-$pkgver - install -vdm755 "$pkgdir/usr/share/webapps/$pkgname/static" - cp -R web "$pkgdir/usr/share/webapps/$pkgname/" - install -Dm755 build/web/bundleWeb.sh -t "$pkgdir/usr/share/webapps/$pkgname" + install -vdm755 "$pkgdir/usr/share/webapps/$pkgname" + cp -R static/web/. "$pkgdir/usr/share/webapps/$pkgname" install -vDm755 $pkgname -t "$pkgdir/usr/bin/" install -vDm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/" } diff --git a/nginx.sample.conf b/nginx.sample.conf new file mode 100644 index 000000000000..9f1a9abba12c --- /dev/null +++ b/nginx.sample.conf @@ -0,0 +1,19 @@ +server { + # server_name "..." + root "/usr/share/webapps/owncast"; + location @proxy { + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Server $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_pass http://127.0.0.1:8080; + } + location / { + try_files $uri @proxy; + } +} diff --git a/owncast.install b/owncast.install index 2e8bd48982b1..13c690699809 100644 --- a/owncast.install +++ b/owncast.install @@ -11,18 +11,12 @@ post_install() { note 'Default admin login is at localhost:8080/admin with user = admin and password = abc123.' note 'It is highly recommended to change this from the default.' note '' - note "Owncast's webroot (front-end) is /usr/share/webapps/owncast/web" + note "Owncast's webroot (front-end) is /usr/share/webapps/owncast" note '' note "The backend service can be enabled (and started) by: systemctl enable --now start owncast" note '' - note "The frontend will need to be built by running: " - note ' $ sudo chown -R owncast:owncast /usr/share/webapps/owncast' - note ' $ sudo -u owncast /usr/share/webapps/owncast/bundleWeb.sh' - note '' - note 'You can test the front-end by running: ' - note ' $ sudo -u owncast npm run dev --prefix /usr/share/webapps/owncast/web' - note '' note 'for production environments use a proper webserver for the front-end (ie. apache/nginx)' + note 'a sample nginx config file is at /usr/share/owncast/nginx.sample.conf' note '' note 'for documentation, visit https://owncast.online/docs/' note '****************************************************************************************' @@ -32,6 +26,16 @@ post_upgrade() { post_install } +pre_upgrade() { + #old files from 0.2.1 rel 2/3 + if [ -d /usr/share/webapps/owncast/static ]; then + rm -rf /usr/share/webapps/owncast/static + fi + if [ -d /usr/share/webapps/owncast/web ]; then + rm -rf /usr/share/webapps/owncast/web + fi +} + post_remove() { # Check if the /var/lib/owncast/web directory exists if [ -d /usr/share/webapps/owncast ]; then diff --git a/owncast.tempfiles.conf b/owncast.tempfiles.conf index c74bed19177b..b89596015b18 100644 --- a/owncast.tempfiles.conf +++ b/owncast.tempfiles.conf @@ -1,3 +1,3 @@ d /var/lib/owncast 0755 owncast owncast - - d /var/lib/owncast/data 0700 owncast owncast - - -d /usr/share/webapps/owncast/web 0755 owncast owncast - - +d /usr/share/webapps/owncast 0755 owncast owncast - - |