katbin/startup.sh
SphericalKat 5d05a87263
chore: prepare for prod
Signed-off-by: SphericalKat <amolele@gmail.com>
2021-08-14 01:19:00 +05:30

38 lines
604 B
Bash
Executable File

#!/usr/bin/env sh
log() {
printf "[%s] %s\n" "$1" "$2"
}
info() {
log "INFO" "$1"
}
error() {
log "ERROR" "$1"
}
migrate() {
info 'Performing migrations with "Ketbin.Release.migrate()"'
bin/ketbin eval "Ketbin.Release.migrate()"
LAST_EXIT=$?
if [ $LAST_EXIT = 0 ]; then
info 'Done performing migrations'
else
error "Unable to perform migrations, exit code $LAST_EXIT"
exit $LAST_EXIT
fi
}
start() {
info 'Starting the application'
bin/ketbin start
}
SLEEP_TIME=10
info "Sleeping for $SLEEP_TIME seconds for all services to be up"
sleep $SLEEP_TIME
migrate
start