diff options
author | Jean Lucas | 2018-06-19 15:29:37 -0400 |
---|---|---|
committer | Jean Lucas | 2018-06-19 15:34:22 -0400 |
commit | ddc9ac904614632feea9869a224a63742571bcdb (patch) | |
tree | f2d4100bf0096abaa173ee07aae3944fc789ec19 | |
parent | 3b73891dac8a4bdff4090eb99d740fc2ab6abf57 (diff) | |
download | aur-ddc9ac904614632feea9869a224a63742571bcdb.tar.gz |
Package overhaul
-rw-r--r-- | .SRCINFO | 41 | ||||
-rw-r--r-- | PKGBUILD | 51 | ||||
-rw-r--r-- | mastodon-sidekiq.service | 16 | ||||
-rw-r--r-- | mastodon-streaming.service | 16 | ||||
-rw-r--r-- | mastodon-web.service | 17 | ||||
-rw-r--r-- | mastodon.install | 22 | ||||
-rw-r--r-- | mastodon.target | 6 |
7 files changed, 141 insertions, 28 deletions
@@ -1,19 +1,42 @@ # Generated by mksrcinfo v8 -# Fri Apr 21 12:13:11 UTC 2017 +# Tue Jun 19 19:34:09 UTC 2018 pkgbase = mastodon - pkgdesc = A GNU Social-compatible microblogging server - pkgver = 1.2.2 - pkgrel = 0.1 - url = https://mastodon.social + pkgdesc = Your self-hosted, globally interconnected microblogging community + pkgver = 2.4.2 + pkgrel = 1 + url = https://joinmastodon.org install = mastodon.install arch = i686 arch = x86_64 license = AGPL-3.0 + makedepends = yarn + makedepends = ruby-bundler + makedepends = protobuf + makedepends = git + makedepends = python2 + depends = ffmpeg + depends = imagemagick + depends = libpqxx + depends = libxml2 + depends = libxslt + depends = nodejs + depends = postgresql + depends = redis + depends = ruby conflicts = mastodon-git - conflicts = mastodon-docker - conflicts = mastodon-docker-git - source = https://github.com/tootsuite/mastodon/archive/v1.2.2.tar.gz - sha256sums = 2b859962acae63788ff4f72ec90edf1e9f9b3332387f6c44b3a47dcfb494b6f5 + backup = var/lib/mastodon/.env.production + source = https://github.com/tootsuite/mastodon/archive/v2.4.2.zip + source = mastodon-web.service + source = mastodon-sidekiq.service + source = mastodon-streaming.service + source = mastodon.target + source = mastodon.install + sha512sums = 429f7f6513ae0a0bdb96c9fa5a30bb4cf446410227e092cef14fd29022865732cad65551bf789a28737236560c9228e9c2729a0210ea4af542eee6a710694c82 + sha512sums = fd3caabd6f15510b963002d767b44ef0bd2c68d5bfb4de79af50ae29090cee9f0b464f0cc786311367b0c45a98445c9caea79da4cbd7edbf5237fdcc091a7886 + sha512sums = e656a3e06f1a50301477bea141915bd0a07525dc419d460d5fe3775c3332c890ea9594c034f7550eebc00e6766216bf0c09a991a0a6ea0a1e4a39b86fbb6ea09 + sha512sums = b072901e7143f403ed52d960af134f5cc047af6cc0a8fbf9b7c8594aa7465d94afb2d3088c1c8278e6c649b83863c4246b71ff324723207f0d496d44024a0aca + sha512sums = 25c59dc2eab340f92962c6881c2b2d0214bc63a088a4432e20831632a29c4dab54fcdc1b06b3eafc01ed1790dcfaf21900a1d32e9ac40bdbf737b773b7abb7ee + sha512sums = f335537a7a1669f75c83e55157667fa3cae7fc4d1c0075e61e81801cbcfd9f312f3e475cba8d73ff460bdb4ac4114979f0de0f2eed2d91417c8460f5c3d14182 pkgname = mastodon @@ -1,16 +1,41 @@ -# Maintainer: Caleb Maclennan <caleb@alerque.com> +# Maintainer: Jean Lucas <jean@4ray.co> pkgname=mastodon -pkgver=1.2.2 -pkgrel=0.1 -pkgdesc="A GNU Social-compatible microblogging server" -arch=('i686' 'x86_64') -url="https://mastodon.social" -license=('AGPL-3.0') -conflicts=("${pkgname}-git" "${pkgname}-docker" "${pkgname}-docker-git") -source=("https://github.com/tootsuite/${pkgname}/archive/v${pkgver}.tar.gz") -sha256sums=('2b859962acae63788ff4f72ec90edf1e9f9b3332387f6c44b3a47dcfb494b6f5') +pkgver=2.4.2 +pkgrel=1 +pkgdesc='Your self-hosted, globally interconnected microblogging community' +arch=(i686 x86_64) +url=https://joinmastodon.org +license=(AGPL-3.0) +depends=(ffmpeg imagemagick libpqxx libxml2 libxslt nodejs postgresql redis ruby) +makedepends=(yarn ruby-bundler protobuf git python2) +conflicts=(mastodon-git) +backup=(var/lib/mastodon/.env.production) install=mastodon.install -_user=mastodon -_homedir=/var/lib/mastodon -_shell=/bin/false +source=(https://github.com/tootsuite/mastodon/archive/v$pkgver.zip + mastodon-web.service + mastodon-sidekiq.service + mastodon-streaming.service + mastodon.target + mastodon.install) +sha512sums=(429f7f6513ae0a0bdb96c9fa5a30bb4cf446410227e092cef14fd29022865732cad65551bf789a28737236560c9228e9c2729a0210ea4af542eee6a710694c82 + fd3caabd6f15510b963002d767b44ef0bd2c68d5bfb4de79af50ae29090cee9f0b464f0cc786311367b0c45a98445c9caea79da4cbd7edbf5237fdcc091a7886 + e656a3e06f1a50301477bea141915bd0a07525dc419d460d5fe3775c3332c890ea9594c034f7550eebc00e6766216bf0c09a991a0a6ea0a1e4a39b86fbb6ea09 + b072901e7143f403ed52d960af134f5cc047af6cc0a8fbf9b7c8594aa7465d94afb2d3088c1c8278e6c649b83863c4246b71ff324723207f0d496d44024a0aca + 25c59dc2eab340f92962c6881c2b2d0214bc63a088a4432e20831632a29c4dab54fcdc1b06b3eafc01ed1790dcfaf21900a1d32e9ac40bdbf737b773b7abb7ee + f335537a7a1669f75c83e55157667fa3cae7fc4d1c0075e61e81801cbcfd9f312f3e475cba8d73ff460bdb4ac4114979f0de0f2eed2d91417c8460f5c3d14182) + +build() { + cd $srcdir/mastodon-$pkgver + bundle install --deployment --without development test + yarn install --pure-lockfile + + msg "Enable and start the Redis server now, and create the Mastodon PostgreSQL user now using 'sudo -u postgres createuser -d mastodon', or the next step will fail." + RAILS_ENV=production bundle exec rails mastodon:setup +} + +package() { + install -d $pkgdir/{var/lib,usr/lib/systemd/system} + cp -r $srcdir/mastodon-$pkgver $pkgdir/var/lib/mastodon + cp $srcdir/mastodon-{web,sidekiq,streaming}.service mastodon.target $pkgdir/usr/lib/systemd/system +} diff --git a/mastodon-sidekiq.service b/mastodon-sidekiq.service new file mode 100644 index 000000000000..df3b2ac91d4b --- /dev/null +++ b/mastodon-sidekiq.service @@ -0,0 +1,16 @@ +[Unit] +Description=Mastodon background queue service +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/var/lib/mastodon/live +Environment="RAILS_ENV=production" +Environment="DB_POOL=5" +ExecStart=/usr/bin/bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/mastodon-streaming.service b/mastodon-streaming.service new file mode 100644 index 000000000000..ac2d9a7963f7 --- /dev/null +++ b/mastodon-streaming.service @@ -0,0 +1,16 @@ +[Unit] +Description=Mastodon streaming API service +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/var/lib/mastodon/live +Environment="NODE_ENV=production" +Environment="PORT=4000" +ExecStart=/usr/bin/npm run start +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/mastodon-web.service b/mastodon-web.service new file mode 100644 index 000000000000..90cd31c0d930 --- /dev/null +++ b/mastodon-web.service @@ -0,0 +1,17 @@ +[Unit] +Description=Mastodon web workers service +After=network.target + +[Service] +Type=simple +User=mastodon +WorkingDirectory=/var/lib/mastodon/live +Environment="RAILS_ENV=production" +Environment="PORT=3000" +ExecStart=/usr/bin/bundle exec puma -C config/puma.rb +ExecReload=/bin/kill -SIGUSR1 $MAINPID +TimeoutSec=15 +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/mastodon.install b/mastodon.install index 25ff428c8b12..8634de8ff73e 100644 --- a/mastodon.install +++ b/mastodon.install @@ -1,8 +1,18 @@ -_user=mastodon -_homedir=/var/lib/mastodon -_shell=/bin/false - post_install() { - getent group ${_user} > /dev/null || groupadd ${_user} > /dev/null - getent passwd ${_user} > /dev/null || useradd -d ${_homedir} -g ${_user} -s ${_shell} ${_user} > /dev/null + getent passwd mastodon > /dev/null || + useradd -rd /var/lib/mastodon -s /sbin/nologin mastodon + chown -R mastodon:mastodon /var/lib/mastodon + + echo 'Enable mastodon.target to have all the Mastodon services start at boot.' +} + +post_upgrade() { + chown -R mastodon:mastodon /var/lib/mastodon + + echo "To upgrade the database schema, run 'sudo -u mastodon RAILS_ENV=production bundle exec rails db:migrate'. +To pre-compile updated assets, run 'sudo -u mastodon RAILS_ENV=production bundle exec rails assets:precompile'." +} + +post_remove() { + echo 'You may want to remove the mastodon user.' } diff --git a/mastodon.target b/mastodon.target new file mode 100644 index 000000000000..6c5017e6ae27 --- /dev/null +++ b/mastodon.target @@ -0,0 +1,6 @@ +[Unit] +Description=Mastodon +Wants=mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service redis.service + +[Install] +WantedBy=multi-user.target |