Skip to content

Instantly share code, notes, and snippets.

@jsm222
Last active November 15, 2024 04:19
Show Gist options
  • Save jsm222/df6bb7c045859cf1972015e78ad4cc4b to your computer and use it in GitHub Desktop.
Save jsm222/df6bb7c045859cf1972015e78ad4cc4b to your computer and use it in GitHub Desktop.
Mastodon on FreeBSD
Not a script but notes, includes simple rc.d scripts which overrides check_process
pkg install -y ImageMagick7-nox11 ffmpeg postgresql15-server libxml2 libxslt git protobuf node16 pkgconf autoconf bison libyaml readline lzlib libffi gdbm nginx redis postgresql15-server \
postgresql15-contrib py39-certbot libidn2 icu ruby30 sudo ruby30-gems rubygem-bundler gmake
corepack enable
yarn set version classic
pw useradd mastodon -d /usr/local/www/mastodon -m -s /nonexistent
sysrc postgresql_enable="YES"
service postgresql initdb
service postgresql start
sudo -u postgres psql -c "CREATE USER mastodon CREATEDB;"
cd ~mastodon
sudo -u mastodon git clone https://github.com/mastodon/mastodon.git live
cd live
git checkout v4.0.1 #or any current tag
sudo -u mastodon git checkout v4.0.1
sudo -u mastodon bundle config deployment 'true'
sudo -u mastodon bundle config without 'development test'
pkg install -y ImageMagick7-nox11 ffmpeg postgresql15-server libxml2 libxslt git protobuf node16 pkgconf autoconf bison libyaml readline lzlib libffi gdbm nginx redis postgresql15-server \
postgresql15-contrib py39-certbot libidn2 icu ruby sudo rubygem-bundler gmake
corepack enable
yarn set version classic
pw useradd mastodon -d /usr/local/www/mastodon -m -s /nonexistent
sysrc postgresql_enable="YES"
service postgresql initdb
service postgresql start
sudo -u postgres psql -c "CREATE USER mastodon CREATEDB;"
cd ~mastodon
sudo -u mastodon git clone https://github.com/mastodon/mastodon.git live
cd live
git checkout v4.0.1 #or any current tag
sudo -u mastodon git checkout v4.0.1
sudo -u mastodon bundle config deployment 'true'
sudo -u mastodon bundle config without 'development test'
sudo -u mastodon bundle install -j `sysctl -n hw.ncpu`
sudo -u mastodon yarn install --pure-lockfile
#set requirepass in /usr/local/etc/redis.conf
sysrc redis_enable="YES"
service redis restart
sudo -u mastodon RAILS_ENV=production bundle exec rake mastodon:setup
cat /usr/local/etc/rc.d/mastodon-web
#!/bin/sh
. /etc/rc.subr
rcvar=mastodon_web_enable
name=mastodon_web
check_process() {
pgrep -f -d ' ' 'ruby30: puma'
}
mastodon_web_env=RAILS_ENV="production" PORT=3000
mastodon_web_user=mastodon
mastodon_web_chdir=/usr/local/www/mastodon/live
command="/usr/local/bin/bundle"
command_args="exec puma -C config/puma.rb >/dev/null 2>&1 &"
load_rc_config $name
run_rc_command "$1"
cat /usr/local/etc/rc.d/mastodon-sidekiq
#!/bin/sh
. /etc/rc.subr
check_process() {
pgrep -f -d ' ' 'ruby30: sidekiq'
}
name=mastodon_sidekiq
mastodon_sidekiq_env=RAILS_ENV=production DB_POOL=25
mastodon_sidekiq_user=mastodon
mastodon_sidekiq_chdir=/usr/local/www/mastodon/live
rcvar=rmastodon_sidekiq_enable
command="/usr/local/bin/bundle"
command_args="exec sidekiq -c 25 > /dev/null 2>&1 &"
load_rc_config $name
run_rc_command "$1"
cat /usr/local/etc/rc.d/mastodon-streaming
#!/bin/sh
. /etc/rc.subr
check_process() {
pgrep -f '/usr/local/bin/node \./streaming'
}
name=mastodon_streaming
mastodon_streaming_env=NODE_ENV="production" PORT=4000 STREAMING_CLUSTER_NUM=1
mastodon_streaming_chdir=/usr/local/www/mastodon/live
rcvar=rmastodon_streaming_enable
command="/usr/local/bin/node"
command_args="./streaming > /dev/null 2>&1 &"
load_rc_config $name
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment