]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blob - start.sh
Move root folder to /app/data/surfer_root to not clash with the config file
[perso/Immae/Projets/Nodejs/Surfer.git] / start.sh
1 #!/bin/bash
2
3 set -eu
4
5 export NODE_ENV=production
6
7 if [[ ! -d "/app/data/surfer_root" ]]; then
8 echo "=> Migrating root folder from /app/data to /app/data/surfer_root"
9
10 mkdir -p /app/data/surfer_root
11 for file in `find /app/data -maxdepth 1 -mindepth 1 -type f -printf "%f\n"`; do
12 echo " => Moving /app/data/${file}"
13 mv "/app/data/${file}" /app/data/surfer_root
14 done
15
16 for dir in `find /app/data -maxdepth 1 -mindepth 1 -type d -printf "%f\n"`; do
17 if [[ "$dir" != "surfer_root" ]]; then
18 echo " => Moving /app/data/${dir}"
19 mv "/app/data/${dir}" /app/data/surfer_root
20 fi
21 done
22 fi
23
24 echo "=> Ensure permissions"
25 chown -R cloudron:cloudron /app/data
26
27 echo "=> Start the server"
28 exec /usr/local/bin/gosu cloudron:cloudron node /app/code/server.js /app/data/surfer_root /app/data/.surfer.json