summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan2018-08-14 07:37:03 +0300
committerCaleb Maclennan2018-08-14 07:38:17 +0300
commit99752b02deaf61ea61268b13cec17b6406b5ebe3 (patch)
tree0088c2b32c234433dd4ab805c49be6b6041e120d
parent150c221af784a3db4598fba43dc05c0ba4ed7ba7 (diff)
downloadaur-99752b02deaf61ea61268b13cec17b6406b5ebe3.tar.gz
Sync packaging routine with stable package
-rw-r--r--.SRCINFO30
-rw-r--r--PKGBUILD110
-rw-r--r--mastodon-sidekiq.service4
-rw-r--r--mastodon-streaming.service4
-rw-r--r--mastodon-web.service5
-rw-r--r--mastodon.install55
-rw-r--r--mastodon.target3
7 files changed, 112 insertions, 99 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 6810cfc4f3ee..b7c3fd7c27db 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,41 +1,41 @@
# Generated by mksrcinfo v8
-# Tue Jun 19 15:26:05 UTC 2018
+# Tue Aug 14 04:38:12 UTC 2018
pkgbase = mastodon-git
- pkgdesc = A GNU Social-compatible microblogging server
+ pkgdesc = Free software social network server based on ActivityPub and OStatus
pkgver = 1.2.2_22_ga0ed88a9
- pkgrel = 0.4
- url = https://mastodon.social
+ pkgrel = 1
+ url = https://joinmastodon.org
install = mastodon.install
arch = i686
arch = x86_64
- license = AGPL-3.0
+ license = AGPL3
makedepends = yarn
- makedepends = ruby-bundler>=1.14.6
- makedepends = protobuf
+ makedepends = python2
+ makedepends = rsync
depends = ffmpeg
depends = imagemagick
depends = libpqxx
depends = libxml2
depends = libxslt
- depends = nodejs
+ depends = nodejs-lts-boron
depends = postgresql
depends = redis
- depends = ruby>=2.4.0
+ depends = ruby-bundler
+ depends = protobuf
provides = mastodon
conflicts = mastodon
conflicts = mastodon-docker
conflicts = mastodon-docker-git
- backup = etc/mastodon/env.production
source = git://github.com/tootsuite/mastodon.git#branch=master
source = mastodon-web.service
source = mastodon-sidekiq.service
source = mastodon-streaming.service
source = mastodon.target
- sha256sums = SKIP
- sha256sums = 2b3a22149ee88c4bacf83aa1958b06fc791057089737596b35b6e1968b1443aa
- sha256sums = 5f72e3ee2921f8b760bac614d910a3c36334ebfefdfd4ba0c9058e21d8537c73
- sha256sums = 5a7bd6a66b93480468483205a12640317f5df5de3b4b4b6fcee38976bff606e4
- sha256sums = 0920e862a1ad598022743381f2b0a38c3c745c7e1a6566c3fe51275bbef82e72
+ sha512sums = SKIP
+ sha512sums = b7b197e4badc4efd0e1ac5c41a8505c2c3ca03b6f2b690b6e78b66365bfab4c168b4034feb693787a3ab48cc29a0e6448895394db670a146399e7f91c6b473f1
+ sha512sums = 603a7877288c762855a29fd2399d3ff7d218a7f1b7d6378cad7f30048cdbfe2a13f2ed2b5c94cb683bdcaead8cd47243e564a2ae70d7f21fa33f295c5396f4f7
+ sha512sums = 90a0761b7709659bec6f29c366c503fdd348226cbb585cf4f6eaa065854e2027d08ab3b352eb13ad7c0e327d662f13bc00fb4163ea0c583ef55b1795ab2e0b31
+ sha512sums = c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb
pkgname = mastodon-git
diff --git a/PKGBUILD b/PKGBUILD
index 94f9e004be4f..330494bda0dc 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,47 +1,42 @@
# Maintainer: Caleb Maclennan <caleb@alerque.com>
+# Maintainer: Jean Lucas <jean@4ray.co>
pkgname=mastodon-git
pkgver=1.2.2_22_ga0ed88a9
_branch=master
-pkgrel=0.4
-pkgdesc="A GNU Social-compatible microblogging server"
-arch=('i686' 'x86_64')
-url="https://mastodon.social"
-license=('AGPL-3.0')
+pkgrel=1
+pkgdesc='Free software social network server based on ActivityPub and OStatus'
+arch=(i686 x86_64)
+url=https://joinmastodon.org
+license=(AGPL3)
+depends=(ffmpeg
+ imagemagick
+ libpqxx
+ libxml2
+ libxslt
+ nodejs-lts-boron
+ postgresql
+ redis
+ ruby-bundler
+ protobuf)
+makedepends=(yarn python2 rsync)
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}" "${pkgname%-git}-docker" "${pkgname%-git}-docker-git")
-makedepends=(
- 'yarn'
- 'ruby-bundler>=1.14.6'
- 'protobuf'
- )
-depends=(
- 'ffmpeg'
- 'imagemagick'
- 'libpqxx'
- 'libxml2'
- 'libxslt'
- 'nodejs'
- 'postgresql'
- 'redis'
- 'ruby>=2.4.0'
- )
-source=(
- "git://github.com/tootsuite/${pkgname%-git}.git#branch=$_branch"
- "mastodon-web.service"
- "mastodon-sidekiq.service"
- "mastodon-streaming.service"
- "mastodon.target"
- )
-backup=("etc/mastodon/env.production")
-sha256sums=('SKIP'
- '2b3a22149ee88c4bacf83aa1958b06fc791057089737596b35b6e1968b1443aa'
- '5f72e3ee2921f8b760bac614d910a3c36334ebfefdfd4ba0c9058e21d8537c73'
- '5a7bd6a66b93480468483205a12640317f5df5de3b4b4b6fcee38976bff606e4'
- '0920e862a1ad598022743381f2b0a38c3c745c7e1a6566c3fe51275bbef82e72')
install=mastodon.install
+source=("git://github.com/tootsuite/${pkgname%-git}.git#branch=$_branch"
+ "mastodon-web.service"
+ "mastodon-sidekiq.service"
+ "mastodon-streaming.service"
+ "mastodon.target"
+ )
+# backup=("etc/mastodon/env.production")
+sha512sums=('SKIP'
+ 'b7b197e4badc4efd0e1ac5c41a8505c2c3ca03b6f2b690b6e78b66365bfab4c168b4034feb693787a3ab48cc29a0e6448895394db670a146399e7f91c6b473f1'
+ '603a7877288c762855a29fd2399d3ff7d218a7f1b7d6378cad7f30048cdbfe2a13f2ed2b5c94cb683bdcaead8cd47243e564a2ae70d7f21fa33f295c5396f4f7'
+ '90a0761b7709659bec6f29c366c503fdd348226cbb585cf4f6eaa065854e2027d08ab3b352eb13ad7c0e327d662f13bc00fb4163ea0c583ef55b1795ab2e0b31'
+ 'c9820c2a83d08bd5d842a78e924682db97ebd5c7291b682603ad30dafcdcc5816c13e717ad39554f042b9d9ed71ab902ce3f604952264a900a72612ee8060acb')
_user=mastodon
-_homedir=/var/lib/mastodon
+_homedir=/var/lib/${pkgname%-git}
_shell=/bin/false
pkgver() {
@@ -49,51 +44,16 @@ pkgver() {
git describe --long --tags | sed 's/^v//;s/-/_/g'
}
-prepare() {
+build() {
cd "${pkgname%-git}"
bundle install --deployment --without development test
yarn install
}
-build() {
- cd "${pkgname%-git}"
- RAILS_ENV=production bundle exec rake mastodon:setup
-}
-
-post_install() {
- sed -i -e "/^PAPERCLIP_SECRET=\$/s/\$/$(rake secret)/" \
- -e "/^SECRET_KEY_BASE=\$/s/\$/$(rake secret)/" \
- -e "/^OTP_SECRET=\$/s/\$/$(rake secret)/" \
- -e "/^REDIS_HOST=redis\$/s/redis\$/localhost/" \
- -e "/^DB_HOST=db\$/s/redis\$/localhost/" \
- /etc/mastodon/env.production
-
- echo "1. Configure your instance:"
- echo " $ vim /etc/mastodon/env.production"
- echo ""
- echo "2. Create a postgres user for mastodon:"
- echo " $ sudo -u postgres psql"
- echo " > CREATE USER mastodon CREATEDB;"
- echo ""
- echo "3. Then setup the database for the first time:"
- echo " $ cd ~mastodon && sudo -u mastodon RAILS_ENV=production bundle exec rails db:setup"
- echo ""
- echo "4. Create an administrator account:"
- echo " $ cd ~mastodon && sudo -u mastodon RAILS_ENV=production bundle exec rails mastodon:make_admin USERNAME=<username>"
- echo ""
- echo "5. Enable and start instance:"
-}
-
-post_upgrade() {
- cd ~mastodon && sudo -u mastodon RAILS_ENV=production bundle exec rails db:migrate
-}
-
package() {
- cd "${pkgname%-git}"
-
- install -Dm 644 .env.production.sample ${pkgdir}/etc/mastodon/env.production
+ install -Dm 644 -t "$pkgdir"/usr/lib/systemd/system mastodon-{web,sidekiq,streaming}.service mastodon.target
+ install -d "${pkgdir}/${_homedir}"
+ rsync -av --exclude '.git' ${pkgname%-git}/ "${pkgdir}/${_homedir}/"
- for service in mastodon-{web,sidekiq,streaming}.service mastodon.target; do
- install -Dm644 "${srcdir}/${service}" "${pkgdir}/usr/lib/systemd/system/${service}"
- done
+ # install -Dm 644 .env.production.sample ${pkgdir}/etc/mastodon/env.production
}
diff --git a/mastodon-sidekiq.service b/mastodon-sidekiq.service
index 40fafd9815eb..1426f5448fe7 100644
--- a/mastodon-sidekiq.service
+++ b/mastodon-sidekiq.service
@@ -1,11 +1,11 @@
[Unit]
-Description=mastodon-sidekiq
+Description=Mastodon background queue service
After=network.target
[Service]
Type=simple
User=mastodon
-WorkingDirectory=/var/lib/mastodon/live
+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
diff --git a/mastodon-streaming.service b/mastodon-streaming.service
index dc7b5a9bebd8..0e615853807a 100644
--- a/mastodon-streaming.service
+++ b/mastodon-streaming.service
@@ -1,11 +1,11 @@
[Unit]
-Description=mastodon-streaming
+Description=Mastodon streaming API service
After=network.target
[Service]
Type=simple
User=mastodon
-WorkingDirectory=/var/lib/mastodon/live
+WorkingDirectory=/var/lib/mastodon
Environment="NODE_ENV=production"
Environment="PORT=4000"
ExecStart=/usr/bin/npm run start
diff --git a/mastodon-web.service b/mastodon-web.service
index 3cce1f0f9313..b3f8d80f367f 100644
--- a/mastodon-web.service
+++ b/mastodon-web.service
@@ -1,14 +1,15 @@
[Unit]
-Description=mastodon-web
+Description=Mastodon web workers service
After=network.target
[Service]
Type=simple
User=mastodon
-WorkingDirectory=/var/lib/mastodon/live
+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
diff --git a/mastodon.install b/mastodon.install
index 25ff428c8b12..fcaf495157c6 100644
--- a/mastodon.install
+++ b/mastodon.install
@@ -3,6 +3,57 @@ _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 group ${_user} > /dev/null ||
+ groupadd -r ${_user} > /dev/null
+ getent passwd ${_user} > /dev/null ||
+ useradd -rd ${_homedir} -g ${_user} -s ${_shell} ${_user} > /dev/null
+ chown -R ${_user}:${_user} ${_homedir}
+
+ # sed -i -e "/^PAPERCLIP_SECRET=\$/s/\$/$(rake secret)/" \
+ # -e "/^SECRET_KEY_BASE=\$/s/\$/$(rake secret)/" \
+ # -e "/^OTP_SECRET=\$/s/\$/$(rake secret)/" \
+ # -e "/^REDIS_HOST=redis\$/s/redis\$/localhost/" \
+ # -e "/^DB_HOST=db\$/s/redis\$/localhost/" \
+ # /etc/mastodon/env.production
+
+ cat <<- EOF
+ To setup Mastodon, enable and start PostgreSQL and Redis:
+ # systemctl enable --now postgresql redis
+ Create the Mastodon PostgreSQL user and grant it the ability to create databases with:
+ # su - postgres -s /bin/sh -c "createdb -d mastodon"
+ Then, run:
+ # 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:
+ # systemctl enable --now mastodon.target
+ EOF
+
+ # echo "1. Configure your instance:"
+ # echo " $ vim /etc/mastodon/env.production"
+ # echo ""
+ # echo "2. Create a postgres user for mastodon:"
+ # echo " $ sudo -u postgres psql"
+ # echo " > CREATE USER mastodon CREATEDB;"
+ # echo ""
+ # echo "3. Then setup the database for the first time:"
+ # echo " $ cd ~mastodon && sudo -u mastodon RAILS_ENV=production bundle exec rails db:setup"
+ # echo ""
+ # echo "4. Create an administrator account:"
+ # echo " $ cd ~mastodon && sudo -u mastodon RAILS_ENV=production bundle exec rails mastodon:make_admin USERNAME=<username>"
+ # echo ""
+ # echo "5. Enable and start instance:"
+}
+
+post_upgrade() {
+ chown -R ${_user}:${_user} ${_homedir}
+
+ cat <<- EOF
+ To upgrade the database schema, run:
+ # su - mastodon -s /bin/sh -c "RAILS_ENV=production bundle exec rails db:migrate"
+ To pre-compile assets, run:
+ # su - mastodon -s /bin/sh -c "RAILS_ENV=production bundle exec rails assets:precompile"
+ EOF
+}
+
+post_remove() {
+ echo 'You may want to remove the Mastodon user.'
}
diff --git a/mastodon.target b/mastodon.target
index ab7bf151938f..755f49ca1fa3 100644
--- a/mastodon.target
+++ b/mastodon.target
@@ -1,6 +1,7 @@
[Unit]
-Description=mastodon
+Description=Mastodon
Wants=mastodon-web.service mastodon-sidekiq.service mastodon-streaming.service
+Wants=postgresql.service redis.service
[Install]
WantedBy=multi-user.target