second initial commit
This commit is contained in:
17
conf.d/mastodon
Normal file
17
conf.d/mastodon
Normal file
@@ -0,0 +1,17 @@
|
||||
USER=mastodon
|
||||
USERHOME="/home/mastodon"
|
||||
INSTALLROOT="${USERHOME}/live"
|
||||
RBENV_ROOT="${USERHOME}/.rbenv"
|
||||
PATH="${RBENV_ROOT}/bin:${RBENV_ROOT}/shims:$PATH"
|
||||
|
||||
# these are tuned to rather small values from defaults to suite
|
||||
# compact instance feel free to experiment
|
||||
DB_POOL=5
|
||||
SIDEKIQ_WORKERS=5
|
||||
|
||||
WEB_BIND=127.0.0.1
|
||||
WEB_PORT=3000
|
||||
# should be 0 (single process) or >1
|
||||
WEB_CONCURRENCY=1
|
||||
WEB_MAX_THREADS=2
|
||||
|
||||
14
init.d/mastodon-all
Normal file
14
init.d/mastodon-all
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
. /etc/conf.d/mastodon
|
||||
|
||||
name="Mastodon meta service"
|
||||
|
||||
depend() {
|
||||
provide mastodon
|
||||
}
|
||||
|
||||
start() {
|
||||
echo
|
||||
}
|
||||
|
||||
35
init.d/mastodon-sidekiq
Normal file
35
init.d/mastodon-sidekiq
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
. /etc/conf.d/mastodon
|
||||
|
||||
name="Mastodon background workers Service"
|
||||
|
||||
pidfile="${INSTALLROOT}/worker.pid"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
need mastodon
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting Mastodon background workers"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--chdir "${INSTALLROOT}" \
|
||||
--user="${USER}" \
|
||||
--pidfile="${pidfile}" \
|
||||
-3 logger \
|
||||
-4 logger \
|
||||
-b -m \
|
||||
--exec /usr/bin/env -- RAILS_ENV=production DB_POOL=${DB_POOL} \
|
||||
bundle exec sidekiq -c ${SIDEKIQ_WORKERS} -q default,8 -q scheduler,1 -q mailers,1 -q push,6 -q ingress,4 -q pull,1 -q fasp
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Mastodon background workers"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${pidfile} \
|
||||
eend $?
|
||||
}
|
||||
|
||||
47
init.d/mastodon-streaming
Normal file
47
init.d/mastodon-streaming
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
. /etc/conf.d/mastodon
|
||||
|
||||
name="Mastodon streaming API service"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
need mastodon
|
||||
}
|
||||
PORT="${SVCNAME#*.}"
|
||||
|
||||
|
||||
checkconfig() {
|
||||
if [ "$PORT" = "$SVCNAME" ]; then
|
||||
eerror "You cannot call this init script directly. Yo
|
||||
must create a symbolic link to it with the port number:"
|
||||
eerror " ln -s /etc/init.d/mastodon-streaming /etc
|
||||
eerror "And then call it instead:"
|
||||
eerror " /etc/init.d/mastodon-streaming.4000 start
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return 1
|
||||
ebegin "Starting Mastodon streaming API"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--background --quiet \
|
||||
--chdir "${INSTALLROOT}" \
|
||||
--user="${USER}" \
|
||||
--make-pidfile --pidfile=${INSTALLROOT}/streaming.pid \
|
||||
--exec /usr/bin/env -- NODE_ENV=production PORT="$PORT" \
|
||||
/usr/bin/node ./streaming
|
||||
eend $? "Failed to start mastodon streaming service"
|
||||
}
|
||||
|
||||
stop() {
|
||||
checkconfig || return 1
|
||||
ebegin "Stopping Mastodon streaming API"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${INSTALLROOT}/streaming.pid \
|
||||
eend $?
|
||||
}
|
||||
|
||||
37
init.d/mastodon-web
Normal file
37
init.d/mastodon-web
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
. /etc/conf.d/mastodon
|
||||
|
||||
name="Mastodon Web Service"
|
||||
pidfile="${root}/web.pid"
|
||||
|
||||
depend() {
|
||||
use net
|
||||
need mastodon
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting Mastodon web workers"
|
||||
|
||||
start-stop-daemon --start \
|
||||
--chdir "${INSTALLROOT}" \
|
||||
--user="${USER}" \
|
||||
--pidfile="${pidfile}" \
|
||||
-3 logger \
|
||||
-4 logger \
|
||||
-b -m \
|
||||
--exec /usr/bin/env -- RAILS_ENV=production PORT=${WEB_PORT}
|
||||
MAX_THREADS=${WEB_MAX_THREADS} WEB_CONCURRENCY=${WEB_CONCURRE
|
||||
BIND=${WEB_BIND} bundle \
|
||||
exec puma -C config/puma.rb
|
||||
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping Mastodon web workers"
|
||||
start-stop-daemon --stop \
|
||||
--pidfile=${pidfile} \
|
||||
eend $?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user