From 824da8dd5ab3f3104a6d4dbe8d7b18d8c8436cef Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Thu, 17 May 2018 16:17:28 +0200 Subject: Move root folder to /app/data/surfer_root to not clash with the config file --- start.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/start.sh b/start.sh index 6d36f6d..562eb84 100755 --- a/start.sh +++ b/start.sh @@ -4,6 +4,25 @@ set -eu export NODE_ENV=production +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 -exec /usr/local/bin/gosu cloudron:cloudron node /app/code/server.js /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 -- cgit v1.2.3