2021-04-16 04:35:17 +02:00
|
|
|
#!/usr/bin/env sh
|
2019-12-03 19:36:50 +01:00
|
|
|
|
2020-10-26 22:01:29 +01:00
|
|
|
background() {
|
|
|
|
while :; do
|
|
|
|
mix run -e 'Philomena.Release.update_channels()'
|
2020-11-26 21:21:24 +01:00
|
|
|
mix run -e 'Philomena.Release.verify_artist_links()'
|
2020-10-26 22:01:29 +01:00
|
|
|
mix run -e 'Philomena.Release.update_stats()'
|
|
|
|
|
|
|
|
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
|
|
|
|
# workaround for #31
|
|
|
|
npm install || (chown -R root:root node_modules && npm install)
|
|
|
|
)
|
2019-12-03 19:36:50 +01:00
|
|
|
|
|
|
|
# Always install mix dependencies
|
|
|
|
(cd /srv/philomena && mix deps.get)
|
|
|
|
|
|
|
|
# Sleep to allow Elasticsearch to finish initializing
|
|
|
|
# if it's not done doing whatever it does yet
|
|
|
|
echo -n "Waiting for Elasticsearch"
|
|
|
|
|
2019-12-03 23:56:26 +01:00
|
|
|
until wget -qO - elasticsearch: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
|
2021-04-16 04:35:17 +02:00
|
|
|
createdb -h postgres -U postgres philomena_dev && mix ecto.setup_dev && mix reindex_all
|
2020-04-30 04:28:56 +02:00
|
|
|
|
2020-10-26 22:01:29 +01:00
|
|
|
# Run background jobs
|
|
|
|
background &
|
|
|
|
|
2019-12-03 19:36:50 +01:00
|
|
|
# Run the application
|
2020-10-26 22:01:29 +01:00
|
|
|
START_WORKER=true mix phx.server
|