summarylogtreecommitdiffstats
path: root/mastodon.install
blob: 49fa91191d3f9b13a66a870f700e08492100fd57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
post_install() {
  echo "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:
# sudo -u postgres createuser -d mastodon
Then, run:
# cd /var/lib/mastodon
# sudo chown mastodon:mastodon -R .
# sudo -u mastodon corepack enable --install-directory . yarn
# sudo -u mastodon RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider PATH=./:$PATH bundle exec rails mastodon:setup
Finally, enable and start all the required services:
# systemctl enable --now mastodon.target"
}

post_upgrade() {
  cd /var/lib/mastodon

  echo "For the 4.2 to 4.3 update, generate new encryption secrets:
# sudo -u mastodon sh -c \"cd /var/lib/mastodon && RAILS_ENV=production bin/rails db:encryption:init\"
And add them and MASTODON_USE_LIBVIPS=true to /etc/mastodon.conf"

  echo "Setting ownership of mastodon files"
  find -path ./public/system -prune -o -exec chown -h mastodon:mastodon {} +
  echo "Upgrading database schema"
  sudo -u mastodon RAILS_ENV=production bundle exec rails db:migrate
  echo "Precompiling assets"
  sudo -u mastodon corepack enable --install-directory . yarn
  sudo -u mastodon RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider PATH=./:$PATH bundle exec rails assets:precompile
}