forked from 0xfurai/peekaping
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.bundle.sqlite.sh
More file actions
executable file
·42 lines (33 loc) · 983 Bytes
/
startup.bundle.sqlite.sh
File metadata and controls
executable file
·42 lines (33 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh
set -e
# Create env.js file for the web app
cat >/app/web/env.js <<EOF
/* generated each container start */
window.__CONFIG__ = {
API_URL: ""
};
EOF
# Security: Set appropriate permissions for web assets
chmod 644 /app/web/env.js
# Set environment variables for SQLite
export DB_TYPE=sqlite
export DB_NAME=/app/data/peekaping.db
# Set server configuration environment variables
export SERVER_PORT=${SERVER_PORT:-8034}
export CLIENT_URL=${CLIENT_URL:-http://localhost:8383}
export MODE=${MODE:-prod}
export TZ=${TZ:-UTC}
# Create data directory if it doesn't exist
mkdir -p /app/data
# Run database migrations
echo "Running database migrations..."
cd /app/server
if ./run-migrations.sh; then
echo "Migrations completed successfully!"
else
echo "Migration failed!"
exit 1
fi
# Start supervisor to manage both server and Caddy
echo "Starting supervisor to manage server and Caddy..."
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf