File size: 1,172 Bytes
af1bee9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/bin/sh
# Starts the application inside a GitHub Codespace and prints how to sign in. Safe to run again:
# sh .devcontainer/start.sh
mkdir -p /data/logs
# The administrator's password is generated once and kept with the data of this Codespace.
if [ ! -s /data/demo-password.txt ]; then
python -c "import secrets; print('Demo-' + secrets.token_urlsafe(9))" > /data/demo-password.txt
fi
export FPT_BOOTSTRAP_ADMIN_USER=admin
export FPT_BOOTSTRAP_ADMIN_PASSWORD="$(cat /data/demo-password.txt)"
if curl -fsS http://127.0.0.1:8800/api/ready > /dev/null 2>&1; then
echo "The application is already running."
else
cd /app && setsid nohup /app/deploy/entrypoint.sh > /data/logs/app.log 2>&1 &
i=0
until curl -fsS http://127.0.0.1:8800/api/ready > /dev/null 2>&1; do
i=$((i + 1))
if [ "$i" -gt 90 ]; then
echo "The application did not start. Last lines of /data/logs/app.log:"
tail -n 30 /data/logs/app.log
exit 1
fi
sleep 2
done
fi
echo ""
echo " Patchwise is running."
echo " Open the PORTS tab, then the globe icon next to port 8800."
echo " Sign in with user: admin password: $(cat /data/demo-password.txt)"
echo ""
|