philomena/docker/app/run-development

59 lines
1.7 KiB
Text
Raw Permalink Normal View History

#!/usr/bin/env sh
2019-12-03 19:36:50 +01:00
2022-02-06 19:27:01 +01:00
# Create S3 dirs
2022-02-11 01:18:47 +01:00
mkdir -p /srv/philomena/priv/static/system/images/thumbs
2022-02-06 19:27:01 +01:00
mkdir -p /srv/philomena/priv/s3/philomena
2022-02-09 03:32:12 +01:00
ln -sf /srv/philomena/priv/static/system/images/thumbs /srv/philomena/priv/s3/philomena/images
ln -sf /srv/philomena/priv/static/system/images /srv/philomena/priv/s3/philomena/adverts
ln -sf /srv/philomena/priv/static/system/images /srv/philomena/priv/s3/philomena/avatars
ln -sf /srv/philomena/priv/static/system/images /srv/philomena/priv/s3/philomena/badges
ln -sf /srv/philomena/priv/static/system/images /srv/philomena/priv/s3/philomena/tags
2022-02-06 19:27:01 +01:00
# For compatibility with musl libc
export CARGO_FEATURE_DISABLE_INITIAL_EXEC_TLS=1
2021-09-28 01:12:46 +02:00
export CARGO_HOME=/srv/philomena/.cargo
2020-10-26 22:01:29 +01:00
background() {
while :; do
mix run -e 'Philomena.Release.update_channels()' > /dev/null
mix run -e 'Philomena.Release.verify_artist_links()' > /dev/null
mix run -e 'Philomena.Release.update_stats()' > /dev/null
mix run -e 'Philomena.Release.clean_moderation_logs()' > /dev/null
mix run -e 'Philomena.Release.generate_autocomplete()' > /dev/null
2020-10-26 22:01:29 +01:00
sleep 300
done
}
2019-12-03 19:36:50 +01:00
# Always install assets
2020-02-11 04:27:09 +01:00
(
cd /srv/philomena/assets
2021-10-09 03:31:54 +02:00
npm install
2020-02-11 04:27:09 +01:00
)
2019-12-03 19:36:50 +01:00
# Always install mix dependencies
(cd /srv/philomena && mix deps.get)
# Sleep to allow OpenSearch to finish initializing
2019-12-03 19:36:50 +01:00
# if it's not done doing whatever it does yet
echo -n "Waiting for OpenSearch"
2019-12-03 19:36:50 +01:00
until wget --no-check-certificate -qO - http://opensearch:9200; do
2019-12-03 19:36:50 +01:00
echo -n "."
sleep 2
done
echo
# Try to create the database if it doesn't exist yet
createdb -h postgres -U postgres philomena_dev && mix ecto.setup_dev && mix reindex_all
2020-04-30 04:28:56 +02:00
# Explicitly compile deps to avoid racing
mix compile
2020-10-26 22:01:29 +01:00
# Run background jobs
background &
2019-12-03 19:36:50 +01:00
# Run the application
START_WORKER=true exec mix phx.server