Hey #MastoAdmin critters: Want to switch to OpenRC on your Masto box? I translated the init scripts to openrc style!
Web:
#!/sbin/openrc-run
description='mastodon-web'
supervisor=supervise-daemon
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
command_user=mastodon
supervise_daemon_args='--chdir /home/mastodon/live'
export RAILS_ENV=production
export PORT=3000
export LD_PRELOAD=libjemalloc.so
command=/home/mastodon/.rbenv/shims/bundle
command_args='exec puma -C config/puma.rb'
depend() {
after net
}
reload() {
kill -SIGUSR1 $(cat $pidfile)
}
Sidekiq:
#!/sbin/openrc-run
description='mastodon-sidekiq'
supervisor=supervise-daemon
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
command_user=mastodon
supervise_daemon_args='--chdir /home/mastodon/live'
export RAILS_ENV=production
export DB_POOL=25
export MALLOC_ARENA_MAX=2
export LD_PRELOAD=libjemalloc.so
command=/home/mastodon/.rbenv/shims/bundle
command_args='exec sidekiq -c 25'
depend() {
after net
}
Streaming:
#!/sbin/openrc-run
description='mastodon-streaming'
supervisor=supervise-daemon
command_background=true
pidfile="/run/${RC_SVCNAME}.pid"
command_user=mastodon
supervise_daemon_args='--chdir /home/mastodon/live'
export NODE_ENV=production
export PORT=4000
export STREAMING_CLUSTER_NUM=1
command=/usr/local/bin/node
command_args='./streaming'
depend() {
after net
}


