summarylogtreecommitdiffstats
path: root/mastodon.install
blob: 15fdf50f37851d27d68392e9c53c520c8fc5237e (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
post_install() {
	echo "##########################################"
	echo "### Mastodon Installation Instructions ###"
	echo "##########################################"
	echo
	echo "### To setup Mastodon, enable and start PostgreSQL and Redis ###"
	echo "systemctl enable --now postgresql redis"
	echo
	echo "### Create the Mastodon PostgreSQL user and grant it the ability to create databases with ###"
	echo "sudo -u postgres createuser -d mastodon"
	echo
	echo "### Then, run the following commands ###"
	echo "cd /var/lib/mastodon"
	echo "sudo chown mastodon:mastodon -R ."
	echo "sudo -u mastodon corepack enable --install-directory . yarn"
	echo "sudo -u mastodon RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider PATH=./:$PATH bundle exec rails mastodon:setup"
	echo
	echo "Afterwards, check if your nginx is properly setup. Please orient yourself on this file: https://github.com/mastodon/mastodon/blob/main/dist/nginx.conf"
	echo "Other Reverse Proxy are _not_ supported by upstream. Use them on your own and expect them to not work or fail after updates"
	echo
	echo "And if you want an working search, it is highly recommended to also install OpenSearch and setup that package before continuing here"
	echo
	echo "### Finally, enable and start all the required services ###"
	echo "systemctl enable --now mastodon.target"
}

post_upgrade() {
	echo "#####################################"
	echo "### Mastodon Upgrade Instructions ###"
	echo "#####################################"
	echo
	echo "### No matter which version you're coming from, First go into the mastodon directory and set the ownership (all commands as root)###"
	echo "cd /var/lib/mastodon; find -path ./public/system -prune -o -exec chown -h mastodon:mastodon {} +"
	echo
	echo "#########################################"
	echo "### For people who are already at 4.4 ###"
	echo "#########################################"
	echo
	echo "### Precompile the assets ###"
	echo "sudo -u mastodon RAILS_ENV=production bundle exec rails assets:precompile"
	echo
	echo "### And restart all services ###"
	echo "systemctl daemon-reload; systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming"
	echo
	echo "#####################################"
	echo "### For people upgrading from 4.3 ###"
	echo "#####################################"
	echo
	echo "### Precompile the assets ###"
	echo "sudo -u mastodon RAILS_ENV=production bundle exec rails assets:precompile"
	echo
	echo "### Migrate the Database (Step 1) ###"
	echo "sudo -u mastodon SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production bundle exec rails db:migrate"
	echo
	echo "### Now restart the mastodon services ###"
	echo "systemctl daemon-reload; systemctl restart mastodon-web mastodon-sidekiq mastodon-streaming"
	echo
	echo "### Migrate the Database (Step 2) ###"
	echo "sudo -u mastodon RAILS_ENV=production bundle exec rails db:migrate"
	echo
	echo "### If you use OpenSearch, you also have to do this ###"
	echo "sudo -u mastodon RAILS_ENV=production bin/tootctl search deploy --only-mapping --only=accounts"
}