77 lines
2.1 KiB
Bash
77 lines
2.1 KiB
Bash
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
echo "Starting OpenObserve Cloudron app..."
|
|
|
|
# Initialize /app/data from /tmp/data on first run
|
|
if [ ! -d "/app/data/logs" ]; then
|
|
echo "Initializing data directory..."
|
|
cp -r /tmp/data/* /app/data/
|
|
fi
|
|
|
|
# Set proper permissions
|
|
chown -R cloudron:cloudron /app/data
|
|
|
|
# Generate default configuration if it doesn't exist
|
|
if [ ! -f "/app/data/config.yaml" ]; then
|
|
echo "Creating default configuration..."
|
|
cat > /app/data/config.yaml << EOF
|
|
# OpenObserve configuration for Cloudron
|
|
common:
|
|
data_dir: "/app/data"
|
|
data_wal_dir: "/app/data/wal"
|
|
data_stream_dir: "/app/data/stream_stats"
|
|
local_mode: true
|
|
local_mode_storage: "disk"
|
|
|
|
http:
|
|
port: 5080
|
|
|
|
grpc:
|
|
port: 5081
|
|
|
|
auth:
|
|
root_user_email: "${ZO_ROOT_USER_EMAIL:-admin@${CLOUDRON_APP_DOMAIN:-localhost}}"
|
|
ext_auth_providers: "oidc"
|
|
|
|
log:
|
|
level: "info"
|
|
EOF
|
|
chown cloudron:cloudron /app/data/config.yaml
|
|
fi
|
|
|
|
# Set environment variables for OpenObserve
|
|
export ZO_DATA_DIR="/app/data"
|
|
export ZO_LOCAL_MODE_STORAGE="disk"
|
|
export ZO_WEB_URL="${CLOUDRON_APP_ORIGIN}"
|
|
export ZO_HTTP_PORT="5080"
|
|
export ZO_GRPC_PORT="5081"
|
|
export ZO_ROOT_USER_EMAIL="${ZO_ROOT_USER_EMAIL:-admin@${CLOUDRON_APP_DOMAIN:-localhost}}"
|
|
export ZO_ROOT_USER_PASSWORD="${ZO_ROOT_USER_PASSWORD:-openobserve123}"
|
|
export ZO_LOG_LEVEL="info"
|
|
|
|
# OIDC Configuration if available
|
|
if [ -n "${CLOUDRON_OIDC_IDENTIFIER:-}" ]; then
|
|
echo "Configuring OIDC authentication..."
|
|
export ZO_OIDC_ENABLED="true"
|
|
export ZO_OIDC_CLIENT_ID="${CLOUDRON_OIDC_CLIENT_ID}"
|
|
export ZO_OIDC_CLIENT_SECRET="${CLOUDRON_OIDC_CLIENT_SECRET}"
|
|
export ZO_OIDC_ISSUER_URL="${CLOUDRON_OIDC_IDENTIFIER}"
|
|
export ZO_OIDC_REDIRECT_URL="${CLOUDRON_APP_ORIGIN}/api/v1/auth/oidc/callback"
|
|
fi
|
|
|
|
# SMTP Configuration
|
|
if [ -n "${CLOUDRON_MAIL_SMTP_SERVER:-}" ]; then
|
|
echo "Configuring SMTP..."
|
|
export ZO_SMTP_HOST="${CLOUDRON_MAIL_SMTP_SERVER}"
|
|
export ZO_SMTP_PORT="${CLOUDRON_MAIL_SMTP_PORT}"
|
|
export ZO_SMTP_USERNAME="${CLOUDRON_MAIL_SMTP_USERNAME}"
|
|
export ZO_SMTP_PASSWORD="${CLOUDRON_MAIL_SMTP_PASSWORD}"
|
|
fi
|
|
|
|
echo "Starting nginx..."
|
|
/usr/sbin/nginx
|
|
|
|
echo "Starting OpenObserve..."
|
|
exec /app/code/openobserve |