diff --git a/install.sh b/install.sh index 35d2a66..8bb6d25 100644 --- a/install.sh +++ b/install.sh @@ -23,7 +23,3 @@ bundle install \ -j$(getconf _NPROCESSORS_ONLN) \ --deployment --without development test yarn install --pure-lockfile --ignore-engines - -OTP_SECRET=precompile_placeholder \ -SECRET_KEY_BASE=precompile_placeholder \ -bundle exec rails assets:precompile diff --git a/rootfs/etc/service/web/run b/rootfs/etc/service/web/run index 51c4cc7..90ccf8f 100644 --- a/rootfs/etc/service/web/run +++ b/rootfs/etc/service/web/run @@ -7,7 +7,46 @@ 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 \