X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=start.sh;h=0a13477eec2c6ddd750bad1539925b9274996ca1;hb=cf286c1be0b9053e1839a29a762aa5ce71bf62cd;hp=18055858bc1679ddb5c4040ea5325cff76a65ad2;hpb=fb372a32db34ec511fa64ccd35c1d536a2c1b3e0;p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git diff --git a/start.sh b/start.sh index 1805585..0a13477 100755 --- a/start.sh +++ b/start.sh @@ -3,6 +3,27 @@ set -eu export NODE_ENV=production +export TOKENSTORE_FILE=/app/data/tokens.json -forever start --workingDir /app/code app.js /app/data -forever logs -f 0 \ No newline at end of file +if [[ ! -d "/app/data/surfer_root" ]]; then + echo "=> Migrating root folder from /app/data to /app/data/surfer_root" + + mkdir -p /app/data/surfer_root + for file in `find /app/data -maxdepth 1 -mindepth 1 -type f -printf "%f\n"`; do + echo " => Moving /app/data/${file}" + mv "/app/data/${file}" /app/data/surfer_root + done + + for dir in `find /app/data -maxdepth 1 -mindepth 1 -type d -printf "%f\n"`; do + if [[ "$dir" != "surfer_root" ]]; then + echo " => Moving /app/data/${dir}" + mv "/app/data/${dir}" /app/data/surfer_root + fi + done +fi + +echo "=> Ensure permissions" +chown -R cloudron:cloudron /app/data + +echo "=> Start the server" +exec /usr/local/bin/gosu cloudron:cloudron node /app/code/server.js /app/data/surfer_root /app/data/.surfer.json