chore: add Cloudron PackageTemplate, helper script; add .gitattributes/.editorconfig; refine .gitignore; improve workspace scripts
This commit is contained in:
39
CloudronPackages/PackageTemplate/start.sh
Normal file
39
CloudronPackages/PackageTemplate/start.sh
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
log() { echo "[start] $(date -Is) $*"; }
|
||||
abort() { echo "[start] ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# Defaults
|
||||
: "${APP_PORT:=__HTTP_PORT__}"
|
||||
|
||||
log "Starting __APP_TITLE__ on port ${APP_PORT}"
|
||||
|
||||
# Example: ensure /app/data exists and is writable
|
||||
mkdir -p /app/data
|
||||
chown -R cloudron:cloudron /app/data || true
|
||||
|
||||
# Example addon integration (uncomment and adapt as needed)
|
||||
# if [[ -n "${CLOUDRON_POSTGRESQL_URL:-}" ]]; then
|
||||
# log "Detected PostgreSQL addon"
|
||||
# # Use $CLOUDRON_POSTGRESQL_* env vars
|
||||
# fi
|
||||
|
||||
# if [[ -n "${CLOUDRON_REDIS_URL:-}" ]]; then
|
||||
# log "Detected Redis addon"
|
||||
# fi
|
||||
|
||||
# If your app needs config generation, do it here
|
||||
# cat > /app/data/config.yaml <<'YAML'
|
||||
# key: value
|
||||
# YAML
|
||||
|
||||
# Example: start a simple HTTP server (placeholder)
|
||||
# Replace with your actual app start command
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
log "Launching placeholder server: python3 -m http.server ${APP_PORT}"
|
||||
exec python3 -m http.server "${APP_PORT}" --bind 0.0.0.0
|
||||
else
|
||||
abort "No application command configured. Replace placeholder with your app's start command."
|
||||
fi
|
||||
|
Reference in New Issue
Block a user