Update start.sh to handle different repository structures
This commit is contained in:
parent
d11f21f13f
commit
528a6eed66
42
start.sh
42
start.sh
@ -83,16 +83,46 @@ sed -i \
|
|||||||
-e "s|%%S3_PREFIX%%|${S3_PREFIX:-ente/}|g" \
|
-e "s|%%S3_PREFIX%%|${S3_PREFIX:-ente/}|g" \
|
||||||
/app/data/config/config.yaml
|
/app/data/config/config.yaml
|
||||||
|
|
||||||
# Change to server directory
|
# Find the correct server directory
|
||||||
cd /app/code/server
|
SERVER_DIR=""
|
||||||
|
for dir in "/app/code/server" "/app/code/packages/server"; do
|
||||||
|
if [ -f "$dir/package.json" ]; then
|
||||||
|
SERVER_DIR="$dir"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Run database migrations
|
if [ -z "$SERVER_DIR" ]; then
|
||||||
echo "==> Running database migrations"
|
echo "==> ERROR: Could not find server directory with package.json"
|
||||||
NODE_ENV=production yarn run db-migrate
|
echo " Server directory structure may have changed."
|
||||||
|
echo " Please check the ente repository structure."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==> Found server directory at $SERVER_DIR"
|
||||||
|
|
||||||
|
# Change to server directory
|
||||||
|
cd "$SERVER_DIR"
|
||||||
|
|
||||||
|
# Run database migrations if the script exists
|
||||||
|
if grep -q "\"db-migrate\"" package.json; then
|
||||||
|
echo "==> Running database migrations"
|
||||||
|
NODE_ENV=production yarn run db-migrate || {
|
||||||
|
echo "==> WARNING: Database migration failed, but continuing anyway"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo "==> Skipping database migrations (script not found)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Change ownership to cloudron user
|
# Change ownership to cloudron user
|
||||||
chown -R cloudron:cloudron /app/data
|
chown -R cloudron:cloudron /app/data
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
echo "==> Starting Ente server"
|
echo "==> Starting Ente server"
|
||||||
exec /usr/local/bin/gosu cloudron:cloudron NODE_ENV=production CONFIG_PATH=/app/data/config/config.yaml yarn run serve
|
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
|
||||||
|
else
|
||||||
|
echo "==> ERROR: Could not find 'serve' script in package.json"
|
||||||
|
echo " Please check the ente repository structure."
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
x
Reference in New Issue
Block a user