mastodon-docker/rootfs/etc/service/web/run

55 lines
1.2 KiB
Bash

#!/bin/bash
sleep 5
while [[ -e /state/.starting ]]; do
sleep 5
done
echo "web starting..."
rm -rf \
/mastodon/app/public/system \
/mastodon/app/public/assets \
/mastodon/app/public/packs \
/mastodon/log
if [[ ! -d /state/mastodon/system ]]; then
mkdir -p /state/mastodon/system
fi
if [[ ! -d /state/mastodon/assets ]]; then
mkdir -p /state/mastodon/assets
fi
if [[ ! -d /state/mastodon/packs ]]; then
mkdir -p /state/mastodon/packs
fi
if [[ ! -d /state/mastodon/log ]]; then
mkdir -p /state/mastodon/log
fi
chown mastodon:mastodon /state/mastodon /state/mastodon/*
ln -s /state/mastodon/system /mastodon/app/public/system
ln -s /state/mastodon/assets /mastodon/app/public/assets
ln -s /state/mastodon/packs /mastodon/app/public/packs
ln -s /state/mastodon/log /mastodon/app/log
cd /mastodon/app
envdir /state/envdir \
chpst -u mastodon:mastodon \
bash -i -c "
OTP_SECRET=precompile_placeholder
SECRET_KEY_BASE=precompile_placeholder
bundle exec rails assets:precompile
"
exec \
envdir /state/envdir \
chpst -u mastodon:mastodon \
bash -i -c "
bundle exec puma -C config/puma.rb
"