Overhaul, version bump to 2.8.0

This commit is contained in:
Jean Lucas 2019-04-12 22:45:33 -04:00
parent 3194de1fd3
commit 19f26fd599
8 changed files with 73 additions and 98 deletions

View file

@ -1,20 +1,21 @@
# Generated by mksrcinfo v8
# Sat Apr 13 17:30:44 UTC 2019
pkgbase = mastodon pkgbase = mastodon
pkgdesc = Free software social-network server based on ActivityPub and OStatus pkgdesc = Self-hosted social media and network server based on ActivityPub and OStatus
pkgver = 2.7.0 pkgver = 2.8.0
pkgrel = 1 pkgrel = 1
url = https://joinmastodon.org url = https://joinmastodon.org
install = mastodon.install install = mastodon.install
arch = x86_64 arch = x86_64
license = AGPL3 license = AGPL3
makedepends = git
makedepends = npm makedepends = npm
makedepends = python2
depends = ffmpeg depends = ffmpeg
depends = imagemagick depends = imagemagick
depends = libidn depends = libidn
depends = libpqxx depends = libpqxx
depends = libxml2 depends = libxml2
depends = libxslt depends = libxslt
depends = libyaml
depends = nodejs depends = nodejs
depends = postgresql depends = postgresql
depends = redis depends = redis
@ -22,18 +23,17 @@ pkgbase = mastodon
depends = protobuf depends = protobuf
depends = yarn depends = yarn
conflicts = mastodon-git conflicts = mastodon-git
options = !strip backup = etc/mastodon.conf
backup = etc/mastodon/environment source = https://github.com/tootsuite/mastodon/archive/v2.8.0.tar.gz
source = https://github.com/tootsuite/mastodon/archive/v2.7.0.tar.gz source = https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz
source = mastodon-web.service
source = mastodon-sidekiq.service
source = mastodon-streaming.service
source = mastodon.target source = mastodon.target
sha512sums = 1829f16a5f98d1815168c8ecfd80b75bb3489e7b3e5eb06a858b0d35bdecc5a4542f2a11276cc935f4f1f42a492ba14b96e045f09ea3092aacaac486e0756762 source = mastodon.sysusers.d
sha512sums = 532929aeeda9a0ccf72de0695a3381547cc389344e1e67f05ef1d7ce5c1ad57278b647423bb52d4a87069ad85479452533fbe3786e5e5c4b62730c6ef72ff267 source = mastodon.tmpfiles.d
sha512sums = 603a7877288c762855a29fd2399d3ff7d218a7f1b7d6378cad7f30048cdbfe2a13f2ed2b5c94cb683bdcaead8cd47243e564a2ae70d7f21fa33f295c5396f4f7 sha512sums = 247e5b8402b77d128fd990e251686237188305084c1893d77cdad20f265ce49750b1c2a10c9a40549d80406c37c4e515c763933ea01fb09f4e51d0a54965b6b0
sha512sums = 90a0761b7709659bec6f29c366c503fdd348226cbb585cf4f6eaa065854e2027d08ab3b352eb13ad7c0e327d662f13bc00fb4163ea0c583ef55b1795ab2e0b31 sha512sums = 1348147885ecaa6c25a0e97a47f79ca5e44f1a0829d3cb0ebecf9db0be4a89f23c3b16fa572c4d0b5f5d0b2624a7b66ebd912ff12144fc5469f2f342124190c2
sha512sums = c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb sha512sums = c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb
sha512sums = 4ee4210bde391e6dc782cb7c14f2cb968c95ad541aa0efcf843a811f8cc5f0d1067ee3c8346bb412aa9fd1dd5a8bd05a4524df7dc4a106957009853dd237074a
sha512sums = 73493680845e690d0cfd769fbbe68978c0a615602375078aea945ca1f1011404eb4b64972aec7a6e5efa720fb425d91b3f30025391c38ccf77e070ccb391e710
pkgname = mastodon pkgname = mastodon

View file

@ -1,10 +1,11 @@
# Maintainer: Fredrick Brennan <copypaste@kittens.ph> # Maintainer: Jean Lucas <jean@4ray.co>
# Contributor: Jean Lucas <jean@4ray.co> # Contributor: Fredrick Brennan <copypaste@kittens.ph>
pkgname=mastodon pkgname=mastodon
pkgver=2.7.0 pkgver=2.8.0
_node=10.15.3
pkgrel=1 pkgrel=1
pkgdesc='Free software social-network server based on ActivityPub and OStatus' pkgdesc='Self-hosted social media and network server based on ActivityPub and OStatus'
arch=(x86_64) arch=(x86_64)
url=https://joinmastodon.org url=https://joinmastodon.org
license=(AGPL3) license=(AGPL3)
@ -14,41 +15,71 @@ depends=(ffmpeg
libpqxx libpqxx
libxml2 libxml2
libxslt libxslt
libyaml
nodejs nodejs
postgresql postgresql
redis redis
ruby-bundler ruby-bundler
protobuf protobuf
yarn) yarn)
makedepends=(git npm python2) makedepends=(npm)
conflicts=(mastodon-git) conflicts=(mastodon-git)
backup=(etc/mastodon/environment) backup=(etc/mastodon.conf)
install=mastodon.install install=mastodon.install
options=('!strip')
source=(https://github.com/tootsuite/mastodon/archive/v$pkgver.tar.gz source=(https://github.com/tootsuite/mastodon/archive/v$pkgver.tar.gz
mastodon-web.service https://nodejs.org/dist/v$_node/node-v$_node-linux-x64.tar.xz
mastodon-sidekiq.service mastodon.target
mastodon-streaming.service mastodon.sysusers.d
mastodon.target) mastodon.tmpfiles.d)
sha512sums=('1829f16a5f98d1815168c8ecfd80b75bb3489e7b3e5eb06a858b0d35bdecc5a4542f2a11276cc935f4f1f42a492ba14b96e045f09ea3092aacaac486e0756762' sha512sums=('247e5b8402b77d128fd990e251686237188305084c1893d77cdad20f265ce49750b1c2a10c9a40549d80406c37c4e515c763933ea01fb09f4e51d0a54965b6b0'
'532929aeeda9a0ccf72de0695a3381547cc389344e1e67f05ef1d7ce5c1ad57278b647423bb52d4a87069ad85479452533fbe3786e5e5c4b62730c6ef72ff267' '1348147885ecaa6c25a0e97a47f79ca5e44f1a0829d3cb0ebecf9db0be4a89f23c3b16fa572c4d0b5f5d0b2624a7b66ebd912ff12144fc5469f2f342124190c2'
'603a7877288c762855a29fd2399d3ff7d218a7f1b7d6378cad7f30048cdbfe2a13f2ed2b5c94cb683bdcaead8cd47243e564a2ae70d7f21fa33f295c5396f4f7' 'c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb'
'90a0761b7709659bec6f29c366c503fdd348226cbb585cf4f6eaa065854e2027d08ab3b352eb13ad7c0e327d662f13bc00fb4163ea0c583ef55b1795ab2e0b31' '4ee4210bde391e6dc782cb7c14f2cb968c95ad541aa0efcf843a811f8cc5f0d1067ee3c8346bb412aa9fd1dd5a8bd05a4524df7dc4a106957009853dd237074a'
'c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb') '73493680845e690d0cfd769fbbe68978c0a615602375078aea945ca1f1011404eb4b64972aec7a6e5efa720fb425d91b3f30025391c38ccf77e070ccb391e710')
prepare() {
cd mastodon-$pkgver
# Allow use of any bundler
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
# Allow use of higher Node minor versions
sed -i 's/"node": "/&^/' package.json
}
build() { build() {
cd mastodon-$pkgver cd mastodon-$pkgver
rm Gemfile.lock bundle install \
bundle lock --update -j$(getconf _NPROCESSORS_ONLN) \
bundle install --deployment --without development test --deployment --without development test
yarn config set ignore-engines true
yarn install --pure-lockfile yarn install --pure-lockfile
} }
package() { package() {
install -d "$pkgdir"/{var/lib,etc/mastodon} install -d "$pkgdir"/{var/lib,etc}
cp -a mastodon-$pkgver "$pkgdir"/var/lib/mastodon cp -a mastodon-$pkgver "$pkgdir"/var/lib/mastodon
ln -s /etc/mastodon/environment "$pkgdir"/var/lib/mastodon/.env
touch "$pkgdir"/etc/mastodon/environment # Put the config file in /etc and link to it
install -Dm 644 -t "$pkgdir"/usr/lib/systemd/system mastodon-{web,sidekiq,streaming}.service mastodon.target touch "$pkgdir"/etc/mastodon.conf
ln -s /etc/mastodon.conf "$pkgdir"/var/lib/mastodon/.env.production
# Add stable Node binary for use with mastodon-streaming
cp node-v$_node-linux-x64/bin/node "$pkgdir"/var/lib/mastodon
install -Dm 644 mastodon.target -t "$pkgdir"/usr/lib/systemd/system
install -Dm 644 mastodon.sysusers.d "$pkgdir"/usr/lib/sysusers.d/mastodon.conf
install -Dm 644 mastodon.tmpfiles.d "$pkgdir"/usr/lib/tmpfiles.d/mastodon.conf
cd mastodon-$pkgver/dist
# Fix path discrepancies
for f in mastodon-*.service; do
sed -e '0,/home/s/home/var\/lib/' \
-e 's/\/live//' \
-e 's/=\/usr\/bin/=\/var\/lib\/mastodon/' \
-e 's/home\/mastodon\/.rbenv\/shims/usr\/bin/' \
-i $f
done
install -Dm 644 mastodon-*.service -t "$pkgdir"/usr/lib/systemd/system
} }

View file

@ -1,16 +0,0 @@
[Unit]
Description=Mastodon background queue service
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/var/lib/mastodon
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

View file

@ -1,16 +0,0 @@
[Unit]
Description=Mastodon streaming API service
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/var/lib/mastodon
Environment="NODE_ENV=production"
Environment="PORT=4000"
ExecStart=/usr/bin/npm run start
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target

View file

@ -1,17 +0,0 @@
[Unit]
Description=Mastodon web workers service
After=network.target
[Service]
Type=simple
User=mastodon
WorkingDirectory=/var/lib/mastodon
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

View file

@ -1,12 +1,8 @@
post_install() { post_install() {
getent passwd mastodon > /dev/null ||
useradd -rd /var/lib/mastodon mastodon
chown -R mastodon:mastodon /var/lib/mastodon
echo "To setup Mastodon, enable and start PostgreSQL and Redis: echo "To setup Mastodon, enable and start PostgreSQL and Redis:
# systemctl enable --now postgresql redis # systemctl enable --now postgresql redis
Create the Mastodon PostgreSQL user and grant it the ability to create databases with: Create the Mastodon PostgreSQL user and grant it the ability to create databases with:
# su - postgres -s /bin/sh -c \"createdb -d mastodon\" # su - postgres -s /bin/sh -c \"createuser -d mastodon\"
Then, run: Then, run:
# su - mastodon -s /bin/sh -c \"cd '/var/lib/mastodon'; RAILS_ENV=production bundle exec rails mastodon:setup\" # su - mastodon -s /bin/sh -c \"cd '/var/lib/mastodon'; RAILS_ENV=production bundle exec rails mastodon:setup\"
Finally, enable and start all the required services: Finally, enable and start all the required services:
@ -14,14 +10,8 @@ Finally, enable and start all the required services:
} }
post_upgrade() { post_upgrade() {
chown -R mastodon:mastodon /var/lib/mastodon
echo "To upgrade the database schema, run: echo "To upgrade the database schema, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails db:migrate\" # su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails db:migrate\"
To pre-compile assets, run: To pre-compile assets, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails assets:precompile\"" # su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails assets:precompile\""
} }
post_remove() {
echo 'You may want to remove the Mastodon user.'
}

1
mastodon.sysusers.d Normal file
View file

@ -0,0 +1 @@
u mastodon - "Mastodon user" /var/lib/mastodon

2
mastodon.tmpfiles.d Normal file
View file

@ -0,0 +1,2 @@
Z /var/lib/mastodon - mastodon mastodon
z /etc/mastodon.conf 0600 mastodon mastodon