summarylogtreecommitdiffstats
path: root/mastodon.install
diff options
context:
space:
mode:
authorCaleb Maclennan2018-08-14 07:37:03 +0300
committerCaleb Maclennan2018-08-14 07:38:17 +0300
commit99752b02deaf61ea61268b13cec17b6406b5ebe3 (patch)
tree0088c2b32c234433dd4ab805c49be6b6041e120d /mastodon.install
parent150c221af784a3db4598fba43dc05c0ba4ed7ba7 (diff)
downloadaur-99752b02deaf61ea61268b13cec17b6406b5ebe3.tar.gz
Sync packaging routine with stable package
Diffstat (limited to 'mastodon.install')
-rw-r--r--mastodon.install55
1 files changed, 53 insertions, 2 deletions
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.'
}