mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
44 lines
889 B
Bash
Executable file
44 lines
889 B
Bash
Executable file
#!/bin/bash
|
|
|
|
background() {
|
|
while :; do
|
|
mix run -e 'Philomena.Release.update_channels()'
|
|
mix run -e 'Philomena.Release.verify_user_links()'
|
|
mix run -e 'Philomena.Release.update_stats()'
|
|
|
|
sleep 300
|
|
done
|
|
}
|
|
|
|
# Always install assets
|
|
(
|
|
cd /srv/philomena/assets
|
|
# workaround for #31
|
|
npm install || (chown -R root:root node_modules && npm install)
|
|
)
|
|
|
|
# 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"
|
|
|
|
until wget -qO - elasticsearch:9200; do
|
|
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
|
|
|
|
# Reindex
|
|
mix reindex_all
|
|
|
|
# Run background jobs
|
|
background &
|
|
|
|
# Run the application
|
|
START_WORKER=true mix phx.server
|