]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blame - start.sh
Support uploading whole folder trees
[perso/Immae/Projets/Nodejs/Surfer.git] / start.sh
CommitLineData
b72caa69
JZ
1#!/bin/bash
2
3set -eu
4
5export NODE_ENV=production
6
824da8dd
JZ
7if [[ ! -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
22fi
23
24echo "=> Ensure permissions"
d2742441
JZ
25chown -R cloudron:cloudron /app/data
26
824da8dd
JZ
27echo "=> Start the server"
28exec /usr/local/bin/gosu cloudron:cloudron node /app/code/server.js /app/data/surfer_root /app/data/.surfer.json