pleroma-docker/entrypoint.sh

52 lines
926 B
Bash
Raw Permalink Normal View History

#!/bin/ash
# shellcheck shell=dash
2018-08-20 17:06:34 -04:00
set -e
2019-08-25 17:29:34 -04:00
log() {
echo -e "\n#> $@\n" 1>&2
}
if [ -n "$BUILDTIME" ]; then
2019-08-25 17:29:34 -04:00
log "Getting rebar..."
mix local.rebar --force
2019-08-25 16:39:22 -04:00
2019-08-25 17:29:34 -04:00
log "Getting hex..."
mix local.hex --force
2018-12-24 17:20:17 -05:00
2019-08-25 17:29:34 -04:00
log "Getting dependencies..."
2018-12-24 17:20:17 -05:00
mix deps.get
2019-08-25 16:39:22 -04:00
2019-08-25 17:29:34 -04:00
log "Precompiling..."
2018-12-24 17:20:17 -05:00
mix compile
exit 0
2018-12-24 17:20:17 -05:00
fi
2019-08-25 17:29:34 -04:00
log "Syncing changes and patches..."
2019-01-10 13:49:47 -05:00
rsync -av /custom.d/ /home/pleroma/pleroma/
2019-08-25 17:29:34 -04:00
log "Recompiling..."
2019-01-10 13:49:47 -05:00
mix compile
2019-08-25 17:29:34 -04:00
log "Waiting for postgres..."
2019-01-10 13:32:40 -05:00
while ! pg_isready -U pleroma -d postgres://db:5432/pleroma -t 1; do
sleep 1s
done
2019-08-25 18:58:22 -04:00
log "Performing sanity checks..."
if ! touch /uploads/.sanity-check; then
log "\
The uploads datadir is NOT writable by `id -u`:`id -g`!\n\
This will break all upload functionality.\n\
Please fix the permissions and try again.\
"
exit 1
fi
rm /uploads/.sanity-check
2019-08-25 17:29:34 -04:00
log "Migrating database..."
2018-08-20 17:06:34 -04:00
mix ecto.migrate
2018-12-24 17:20:17 -05:00
2019-08-25 17:29:34 -04:00
log "Liftoff o/"
2018-08-20 17:06:34 -04:00
exec mix phx.server