diff --git a/user/mastodon/APKBUILD b/user/mastodon/APKBUILD deleted file mode 100644 index 954ff0b..0000000 --- a/user/mastodon/APKBUILD +++ /dev/null @@ -1,202 +0,0 @@ -# Contributor: Antoine Martin (ayakael) -# Maintainer: Antoine Martin (ayakael) -pkgname=mastodon -_pkgname=$pkgname -pkgver=4.2.10 -_gittag=v$pkgver -pkgrel=1 -pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus" -arch="x86_64" -url="https://github.com/mastodon/mastodon" -license="AGPL-3.0-only" -depends=" - $pkgname-assets=$pkgver-r$pkgrel - ffmpeg - file - gcompat - imagemagick - nodejs - npm - protobuf - py3-elasticsearch - redis - ruby3.2 - ruby3.2-bundler - yarn - " -makedepends=" - gnu-libiconv-dev - icu-dev - libffi-dev - libidn-dev - libxml2-dev - libxslt-dev - openssl-dev - postgresql-dev - protobuf-dev - ruby3.2-dev - yaml-dev - zlib-dev - " -install=" - $pkgname.pre-install - $pkgname.post-upgrade - $pkgname.post-install - " -source=" - mastodon-$_gittag.tar.gz::https://github.com/mastodon/mastodon/archive/$_gittag.tar.gz - mastodon.initd - mastodon.web.initd - mastodon.sidekiq.initd - mastodon.streaming.initd - mastodon.logrotate - bin-wrapper.in - " -subpackages="$pkgname-openrc $pkgname-assets::noarch" -options="!check" # No test suite - -_prefix="usr/lib/bundles/$_pkgname" - -export BUNDLE_DEPLOYMENT=true -export BUNDLE_FORCE_RUBY_PLATFORM=true -export BUNDLE_FROZEN=true -export BUNDLE_JOBS=${JOBS:-2} - -prepare() { - default_prepare - - # Allow use of any bundler - sed -i -e '/BUNDLED/,+1d' Gemfile.lock - - # Allow use of higher Node versions - sed -i 's/"node": .*"/"node": ">=14.15"/' package.json - - mkdir -p "$srcdir"/gem-cache -} - -build() { - local bundle_without='exclude development' - - msg "Installing Ruby gems..." - bundle config --local build.nokogiri --use-system-libraries \ - --with-xml2-include=/usr/include/libxml2 \ - --with-xslt-include=/usr/include/libxslt - bundle config --local build.ffi --enable-system-libffi - bundle config --local build.idn --enable-system-libidn - bundle config --local path "vendor/bundle" - bundle config --local set deployment 'false' - bundle config --local set without "$bundle_without" - - bundle install --no-cache -j"$(getconf _NPROCESSORS_ONLN)" - - msg "Installing npm modules..." - yarn install --production --frozen-lockfile - - ( - msg "Compiling assets..." - export NODE_ENV=production - export RAILS_ENV=production - export NODE_OPTIONS="--openssl-legacy-provider" - - OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile - ) - - msg "Cleaning assets gems..." - bundle config --local without "$bundle_without" - bundle clean - - # Create executables in bin/*. - # See also https://github.com/bundler/bundler/issues/6149. - bundle binstubs --force bundler puma sidekiq -} - -package() { - local destdir="$pkgdir"/$_prefix - local datadir="$pkgdir/var/lib/gitlab" - # directory creation - install -dm 755 \ - "$destdir" \ - "$datadir" \ - "$pkgdir"/etc/init.d - - - # Install application files. - rmdir "$destdir" - cp -a "$builddir" "$destdir" - - install -m755 -t "$destdir"/bin/ \ - bin/bundle \ - bin/rails \ - bin/rake \ - bin/sidekiq \ - bin/sidekiqmon \ - bin/tootctl \ - bin/puma - - cd "$destdir"/vendor/bundle/ruby/*/ - - # Remove tests, documentations and other useless files. - find gems/ \( -name 'doc' \ - -o -name 'spec' \ - -o -name 'test' \) \ - -type d -maxdepth 2 -exec rm -fr "{}" + - find gems/ \( -name 'README*' \ - -o -name 'CHANGELOG*' \ - -o -name 'CONTRIBUT*' \ - -o -name '*LICENSE*' \ - -o -name 'Rakefile' \ - -o -name '.*' \) \ - -type f -delete - - # Remove assets, they are already compiled. - rm -r gems/doorkeeper-*/app/assets - rm -r gems/pghero-*/app/assets - - # Remove build logs and cache. - rm -rf build_info/ cache/ - find extensions/ \( -name gem_make.out -o -name mkmf.log \) -delete - - cat > "$datadir"/.profile <<-EOF - export RAILS_ENV=production - export NODE_ENV=production - export EXECJS_RUNTIME=Disabled - EOF - - # Install wrapper scripts to /usr/bin. - local name; for name in rake rails tootctl; do - sed "s/__COMMAND__/$name/g" "$srcdir"/bin-wrapper.in \ - > "$builddir"/mastodon-$name - install -m755 -D "$builddir"/mastodon-$name "$pkgdir"/usr/bin/mastodon-$name - done - - # Put the config file in /etc and link to it - touch "$pkgdir"/etc/mastodon.conf - ln -s /etc/mastodon.conf "$destdir"/.env.production - ln -s /usr/bin/node "$destdir"/node - - for file in $_pkgname $_pkgname.sidekiq $_pkgname.web $_pkgname.streaming; do - install -m755 -D "$srcdir"/$file.initd "$pkgdir"/etc/init.d/$file - done - - # Removing all prebuilt artifacts - rm -R "$destdir"/node_modules/*/prebuilds 2>&1 || true - - install -m644 -D "$srcdir"/$_pkgname.logrotate \ - "$pkgdir"/etc/logrotate.d/$_pkgname -} - -assets() { - depends="" - - amove $_prefix/public/assets -} - -sha512sums=" -1fe5417136bc020a83b83eaccef7f1f46c13fc8318681f12ba556b1b6b03e25ef7b6335c28f4e6722101e97b63020cbd0d3fbacdaf9b3b5a4b73c3cf3e230813 mastodon-v4.2.10.tar.gz -d49fea9451c97ccefe5e35b68e4274aeb427f9d1e910b89c1f6c810489c3bec1ccff72952fdaef95abf944b8aff0da84a52347540d36ff1fba5ccc19e1d935c6 mastodon.initd -eefe12a31268245f802222c0001dac884e03adb0d301e53a1512a3cd204836ca03ad083908cd14d146cf0dce99e3a4366570efd0e40a9a490ccd381d4c63c32f mastodon.web.initd -8fc9249c01693bb02b8d1a6177288d5d3549addde8c03eb35cc7a32dde669171872ebc2b5deb8019dc7a12970098f1af707171fa41129be31b04e1dc1651a777 mastodon.sidekiq.initd -03433a2f58600ca0d58e7c3713df2146ccdfc92033ccfe801dbd38bac39b66d6297f2b5ca02300caa36455b484eab2caa68c912c2f72150203bfa0e106c375fc mastodon.streaming.initd -83b3bae5b6fdb4d0dbc1cbe546c62c0aa77397b97d1a5d5377af032466677de188065b556710c0d96576bbae89cc76800f1ffb8cd718155eb2784da818f27619 mastodon.logrotate -dfd0e43ac6c28387bd4aa57fd98ae41aeb5a098b6deb3e44b89f07818e2470773b025364afee7ef6fd0f664cb86bbbbe8796c9f222f5436c256a787282fbe3e1 bin-wrapper.in -" diff --git a/user/mastodon/bin-wrapper.in b/user/mastodon/bin-wrapper.in deleted file mode 100644 index eb1d637..0000000 --- a/user/mastodon/bin-wrapper.in +++ /dev/null @@ -1,15 +0,0 @@ - -#!/bin/sh - -BUNDLE_DIR='/usr/lib/bundles/mastodon' -export RAILS_ENV='production' -export NODE_ENV='production' -export EXECJS_RUNTIME='Disabled' - -cd $BUNDLE_DIR - -if [ "$(id -un)" != 'mastodon' ]; then - exec su mastodon -c '"$0" "$@"' -- bin/__COMMAND__ "$@" -else - exec bin/__COMMAND__ "$@" -fi diff --git a/user/mastodon/mastodon.initd b/user/mastodon/mastodon.initd deleted file mode 100644 index 1454603..0000000 --- a/user/mastodon/mastodon.initd +++ /dev/null @@ -1,41 +0,0 @@ -#!/sbin/openrc-run - -name="Mastodon" -description="Meta script for starting/stopping all the Mastodon components" - -subservices="mastodon.sidekiq mastodon.streaming mastodon.web" - -depend() { - need redis postgresql - use net -} - -start() { - local ret=0 - - ebegin "Starting all Mastodon components" - local svc; for svc in $subservices; do - service $svc start || ret=1 - done - eend $ret -} - -stop() { - local ret=0 - - ebegin "Stopping all Mastodon components" - local svc; for svc in $subservices; do - service $svc stop || ret=1 - done - eend $ret -} - -status() { - local ret=0 - - local svc; for svc in $subservices; do - echo "$svc:" - service $svc status || ret=1 - done - eend $ret -} diff --git a/user/mastodon/mastodon.logrotate b/user/mastodon/mastodon.logrotate deleted file mode 100644 index cbfecfc..0000000 --- a/user/mastodon/mastodon.logrotate +++ /dev/null @@ -1,11 +0,0 @@ -/var/log/mastodon/*.log { - compress - copytruncate - delaycompress - maxsize 10M - minsize 1M - missingok - sharedscripts - rotate 10 - weekly -} diff --git a/user/mastodon/mastodon.post-install b/user/mastodon/mastodon.post-install deleted file mode 100644 index 9387d45..0000000 --- a/user/mastodon/mastodon.post-install +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -set -eu - -if [ "${0##*.}" = 'post-upgrade' ]; then - cat >&2 <<-EOF - * - * To finish Mastodon upgrade run: - * - * mastodon-rails db:migrate - * - EOF -else - cat >&2 <<-EOF - * - * 1. Adjust settings in /etc/mastodon.conf - * - * 2. Create database for Mastodon: - * - * psql -c "CREATE ROLE mastodon PASSWORD 'top-secret' INHERIT LOGIN;" - * psql -c "CREATE DATABASE mastodon OWNER mastodon ENCODING 'UTF-8';" - * psql -d mastodon -c "CREATE EXTENSION pg_trgm; CREATE EXTENSION btree_gist;" - * psql -c "ALTER DATABASE name OWNER TO new_owner;" - * - * 3. Run "mastodon-rake db:migrate" - * - EOF -fi diff --git a/user/mastodon/mastodon.post-upgrade b/user/mastodon/mastodon.post-upgrade deleted file mode 120000 index 0fcc8b2..0000000 --- a/user/mastodon/mastodon.post-upgrade +++ /dev/null @@ -1 +0,0 @@ -mastodon.post-install \ No newline at end of file diff --git a/user/mastodon/mastodon.pre-install b/user/mastodon/mastodon.pre-install deleted file mode 100644 index c869177..0000000 --- a/user/mastodon/mastodon.pre-install +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# It's very important to set user/group correctly. - -mastodon_dir='/var/lib/mastodon' - -if ! getent group mastodon 1>/dev/null; then - echo '* Creating group mastodon' 1>&2 - - addgroup -S mastodon -fi - -if ! id mastodon 2>/dev/null 1>&2; then - echo '* Creating user mastodon' 1>&2 - - adduser -DHS -G mastodon -h "$mastodon_dir" -s /bin/sh \ - -g "added by apk for mastodon" mastodon - passwd -u mastodon 1>/dev/null # unlock -fi - -if ! id -Gn mastodon | grep -Fq redis; then - echo '* Adding user mastodon to group redis' 1>&2 - - addgroup mastodon redis -fi - -if [ "$(id -gn mastodon)" != 'mastodon' ]; then - cat >&2 <<-EOF - !! - !! User mastodon has primary group $(id -gn mastodon). We strongly recommend to change - !! mastodon's primary group to mastodon. - !! - EOF - - # Add it at least as a supplementary group. - adduser mastodon mastodon -fi - -user_home="$(getent passwd mastodon | cut -d: -f6)" - -if [ "$user_home" != "$mastodon_dir" ]; then - cat >&2 <<-EOF - !! - !! User mastodon has home directory in $user_home, but this package assumes - !! $mastodon_dir. Although it's possible to use a different directory, - !! it's really not easy. - !! - !! Please change mastodon's home directory to $mastodon_dir, or adjust settings - !! and move files yourself. Otherwise Mastodon will not work! - !! - EOF -fi - -exit 0 - diff --git a/user/mastodon/mastodon.sidekiq.initd b/user/mastodon/mastodon.sidekiq.initd deleted file mode 100644 index 98c0377..0000000 --- a/user/mastodon/mastodon.sidekiq.initd +++ /dev/null @@ -1,32 +0,0 @@ -#!/sbin/openrc-run - -name="Mastodon background workers Service" -root="/usr/lib/bundles/mastodon" -pidfile="/run/mastodon-sidekiq.pid" -logfile="/var/log/mastodon/sidekiq.log" - -depend() { - use net - need redis -} - -start() { - ebegin "Starting Mastodon background workers" - - cd $root - - start-stop-daemon --start --background \ - --chdir "${root}" \ - --user="mastodon" \ - --make-pidfile --pidfile="${pidfile}" \ - -1 "${logfile}" -2 "${logfile}" \ - --exec /usr/bin/env -- RAILS_ENV=production DB_POOL=25 MALLOC_ARENA_MAX=2 bundle exec sidekiq -c 25 - eend $? -} - -stop() { - ebegin "Stopping Mastodon background workers" - start-stop-daemon --stop \ - --pidfile=${pidfile} \ - eend $? -} diff --git a/user/mastodon/mastodon.streaming.initd b/user/mastodon/mastodon.streaming.initd deleted file mode 100644 index b41adc2..0000000 --- a/user/mastodon/mastodon.streaming.initd +++ /dev/null @@ -1,33 +0,0 @@ -#!/sbin/openrc-run - -name="Mastodon streaming API service" -root="/usr/lib/bundles/mastodon" -pidfile="/run/mastodon-streaming.pid" -logfile="/var/log/mastodon/streaming.log" - -depend() { - use net -} - -start() { - ebegin "Starting Mastodon streaming API" - - cd $root - - start-stop-daemon --start \ - --background --quiet \ - --chdir "${root}" \ - --user="mastodon" \ - --make-pidfile --pidfile="${pidfile}" \ - --stdout "${logfile}" --stderr "${logfile}" \ - --exec /usr/bin/env -- NODE_ENV=production PORT=4000 /usr/bin/node ./streaming/index.js - eend $? -} - -stop() { - ebegin "Stopping Mastodon streaming API" - start-stop-daemon --stop \ - --pidfile="${pidfile}" \ - eend $? -} - diff --git a/user/mastodon/mastodon.web.initd b/user/mastodon/mastodon.web.initd deleted file mode 100644 index 42eace6..0000000 --- a/user/mastodon/mastodon.web.initd +++ /dev/null @@ -1,29 +0,0 @@ -#!/sbin/openrc-run - -name="Mastodon Web Service" -root="/usr/lib/bundles/mastodon" -pidfile="/run/mastodon-web.pid" -logfile="/var/log/mastodon/web.log" - -depend() { - use net -} - -start() { - ebegin "Starting Mastodon web workers" - cd $root - start-stop-daemon --start --background \ - --chdir "${root}" \ - --user="mastodon" \ - --pidfile="${pidfile}" --make-pidfile \ - --stdout="${logfile}" --stderr="${logfile}" \ - --exec /usr/bin/env -- RAILS_ENV=production PORT=3000 bundle exec puma -C config/puma.rb - eend $? -} - -stop() { - ebegin "Stopping Mastodon web workers" - start-stop-daemon --stop \ - --pidfile=${pidfile} \ - eend $? -}