Implement proper Cloudron structure with supervisor
This commit is contained in:
26
start.sh
26
start.sh
@ -3,10 +3,10 @@ set -eu
|
||||
|
||||
echo "Starting Keila on Cloudron"
|
||||
|
||||
# Copy Keila release to /app/data on first run
|
||||
# Initialize Keila data directory by copying from /app/pkg
|
||||
if [[ ! -d "/app/data/keila" ]]; then
|
||||
echo "==> Initializing Keila installation"
|
||||
cp -r /opt/app /app/data/keila
|
||||
cp -r /app/pkg /app/data/keila
|
||||
chown -R cloudron:cloudron /app/data/keila
|
||||
fi
|
||||
|
||||
@ -17,13 +17,12 @@ if [[ ! -f "/app/data/secret_key_base" ]]; then
|
||||
chown cloudron:cloudron /app/data/secret_key_base
|
||||
fi
|
||||
|
||||
# Set environment variables
|
||||
# Set environment variables for supervisor
|
||||
export SECRET_KEY_BASE=$(cat /app/data/secret_key_base)
|
||||
export DB_URL="${CLOUDRON_POSTGRESQL_URL}"
|
||||
export URL_HOST="${CLOUDRON_APP_DOMAIN}"
|
||||
export URL_SCHEMA="https"
|
||||
export URL_PORT="443"
|
||||
export PORT="4000"
|
||||
|
||||
# Configure SMTP
|
||||
export MAILER_SMTP_HOST="${CLOUDRON_MAIL_SMTP_SERVER}"
|
||||
@ -37,10 +36,8 @@ export USER_CONTENT_DIR="/app/data/uploads"
|
||||
mkdir -p /app/data/uploads
|
||||
chown cloudron:cloudron /app/data/uploads
|
||||
|
||||
# Disable registration for security (admin can create users)
|
||||
# Disable registration for security
|
||||
export DISABLE_REGISTRATION="true"
|
||||
|
||||
# Set database pool size
|
||||
export DATABASE_POOL_SIZE="10"
|
||||
|
||||
# Create root user credentials file if not exists
|
||||
@ -55,19 +52,8 @@ if [[ ! -f "/app/data/root_credentials" ]]; then
|
||||
chmod 600 /app/data/root_credentials
|
||||
fi
|
||||
|
||||
echo "==> Creating nginx temp directories"
|
||||
mkdir -p /tmp/nginx/body /tmp/nginx/fastcgi /tmp/nginx/proxy /tmp/nginx/scgi /tmp/nginx/uwsgi
|
||||
|
||||
echo "==> Starting nginx"
|
||||
nginx -t
|
||||
nginx
|
||||
|
||||
echo "==> Running database migrations"
|
||||
cd /app/data/keila
|
||||
sudo -u cloudron -E /app/data/keila/bin/keila eval "Keila.Release.migrate()"
|
||||
|
||||
echo "==> Starting Keila application"
|
||||
cd /app/data/keila
|
||||
# Change the internal port since nginx listens on 4000
|
||||
export PORT="4001"
|
||||
exec sudo -u cloudron -E /app/data/keila/bin/keila start
|
||||
echo "==> Starting supervisor"
|
||||
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon
|
Reference in New Issue
Block a user