Loading start.sh +43 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,12 @@ set -eu # Create necessary directories mkdir -p /app/data/config /app/data/storage # Print debug information about repository structure echo "==> DEBUG: Repository structure at /app/code" find /app/code -type d -not -path "*/node_modules/*" -not -path "*/\.*" | sort echo "==> DEBUG: All package.json files in repository" find /app/code -name "package.json" -not -path "*/node_modules/*" | sort # Create config template file on first run if [[ ! -f /app/data/config/config.yaml ]]; then echo "==> First run - creating configuration template" Loading Loading @@ -85,6 +91,9 @@ sed -i \ # Find the correct server directory SERVER_DIR="" # More thorough search for server directory # Try specific paths first for dir in "/app/code/server" "/app/code/packages/server"; do if [ -f "$dir/package.json" ]; then SERVER_DIR="$dir" Loading @@ -92,6 +101,21 @@ for dir in "/app/code/server" "/app/code/packages/server"; do fi done # If not found, search for any directory containing package.json with "server" in its path if [ -z "$SERVER_DIR" ]; then SERVER_CANDIDATES=$(find /app/code -name "package.json" -not -path "*/node_modules/*" -path "*/server*" | sort) if [ -n "$SERVER_CANDIDATES" ]; then FIRST_CANDIDATE=$(echo "$SERVER_CANDIDATES" | head -n 1) SERVER_DIR=$(dirname "$FIRST_CANDIDATE") fi fi # Last resort - look for package.json in the monorepo root if [ -z "$SERVER_DIR" ] && [ -f "/app/code/package.json" ]; then echo "==> Using root package.json as server directory" SERVER_DIR="/app/code" fi if [ -z "$SERVER_DIR" ]; then echo "==> ERROR: Could not find server directory with package.json" echo " Server directory structure may have changed." Loading @@ -100,6 +124,10 @@ if [ -z "$SERVER_DIR" ]; then fi echo "==> Found server directory at $SERVER_DIR" echo "==> Contents of $SERVER_DIR:" ls -la "$SERVER_DIR" echo "==> Contents of package.json:" cat "$SERVER_DIR/package.json" # Change to server directory cd "$SERVER_DIR" Loading @@ -114,15 +142,26 @@ else echo "==> Skipping database migrations (script not found)" fi # Check for alternative start scripts if "serve" doesn't exist SERVE_SCRIPT="" for script in "serve" "start" "dev" "server"; do if grep -q "\"$script\"" package.json; then SERVE_SCRIPT="$script" break fi done # Change ownership to cloudron user chown -R cloudron:cloudron /app/data # Start the server echo "==> Starting Ente server" if grep -q "\"serve\"" package.json; then exec /usr/local/bin/gosu cloudron:cloudron NODE_ENV=production CONFIG_PATH=/app/data/config/config.yaml yarn run serve if [ -n "$SERVE_SCRIPT" ]; then echo "==> Starting Ente server with script: $SERVE_SCRIPT" exec /usr/local/bin/gosu cloudron:cloudron NODE_ENV=production CONFIG_PATH=/app/data/config/config.yaml yarn run "$SERVE_SCRIPT" else echo "==> ERROR: Could not find 'serve' script in package.json" echo "==> ERROR: Could not find any server script in package.json" echo " Available scripts:" grep -o '"[^"]*"\s*:\s*"[^"]*"' package.json | grep -o '"[^"]*"' | head -n 1 | tr -d '"' echo " Please check the ente repository structure." exit 1 fi No newline at end of file Loading
start.sh +43 −4 Original line number Diff line number Diff line Loading @@ -5,6 +5,12 @@ set -eu # Create necessary directories mkdir -p /app/data/config /app/data/storage # Print debug information about repository structure echo "==> DEBUG: Repository structure at /app/code" find /app/code -type d -not -path "*/node_modules/*" -not -path "*/\.*" | sort echo "==> DEBUG: All package.json files in repository" find /app/code -name "package.json" -not -path "*/node_modules/*" | sort # Create config template file on first run if [[ ! -f /app/data/config/config.yaml ]]; then echo "==> First run - creating configuration template" Loading Loading @@ -85,6 +91,9 @@ sed -i \ # Find the correct server directory SERVER_DIR="" # More thorough search for server directory # Try specific paths first for dir in "/app/code/server" "/app/code/packages/server"; do if [ -f "$dir/package.json" ]; then SERVER_DIR="$dir" Loading @@ -92,6 +101,21 @@ for dir in "/app/code/server" "/app/code/packages/server"; do fi done # If not found, search for any directory containing package.json with "server" in its path if [ -z "$SERVER_DIR" ]; then SERVER_CANDIDATES=$(find /app/code -name "package.json" -not -path "*/node_modules/*" -path "*/server*" | sort) if [ -n "$SERVER_CANDIDATES" ]; then FIRST_CANDIDATE=$(echo "$SERVER_CANDIDATES" | head -n 1) SERVER_DIR=$(dirname "$FIRST_CANDIDATE") fi fi # Last resort - look for package.json in the monorepo root if [ -z "$SERVER_DIR" ] && [ -f "/app/code/package.json" ]; then echo "==> Using root package.json as server directory" SERVER_DIR="/app/code" fi if [ -z "$SERVER_DIR" ]; then echo "==> ERROR: Could not find server directory with package.json" echo " Server directory structure may have changed." Loading @@ -100,6 +124,10 @@ if [ -z "$SERVER_DIR" ]; then fi echo "==> Found server directory at $SERVER_DIR" echo "==> Contents of $SERVER_DIR:" ls -la "$SERVER_DIR" echo "==> Contents of package.json:" cat "$SERVER_DIR/package.json" # Change to server directory cd "$SERVER_DIR" Loading @@ -114,15 +142,26 @@ else echo "==> Skipping database migrations (script not found)" fi # Check for alternative start scripts if "serve" doesn't exist SERVE_SCRIPT="" for script in "serve" "start" "dev" "server"; do if grep -q "\"$script\"" package.json; then SERVE_SCRIPT="$script" break fi done # Change ownership to cloudron user chown -R cloudron:cloudron /app/data # Start the server echo "==> Starting Ente server" if grep -q "\"serve\"" package.json; then exec /usr/local/bin/gosu cloudron:cloudron NODE_ENV=production CONFIG_PATH=/app/data/config/config.yaml yarn run serve if [ -n "$SERVE_SCRIPT" ]; then echo "==> Starting Ente server with script: $SERVE_SCRIPT" exec /usr/local/bin/gosu cloudron:cloudron NODE_ENV=production CONFIG_PATH=/app/data/config/config.yaml yarn run "$SERVE_SCRIPT" else echo "==> ERROR: Could not find 'serve' script in package.json" echo "==> ERROR: Could not find any server script in package.json" echo " Available scripts:" grep -o '"[^"]*"\s*:\s*"[^"]*"' package.json | grep -o '"[^"]*"' | head -n 1 | tr -d '"' echo " Please check the ente repository structure." exit 1 fi No newline at end of file