concourse-app/start.sh

41 lines
1.7 KiB
Bash
Executable File

#! /bin/bash
set -e
# Verify init with keys
if ! [ -f /app/data/.initialized ]; then
echo "First time init!"
ssh-keygen -t rsa -f /app/data/tsa_host_key -N ''
ssh-keygen -t rsa -f /app/data/worker_key -N ''
ssh-keygen -t rsa -f /app/data/session_signing_key -N ''
cp /app/data/worker_key.pub /app/data/authorized_worker_keys
touch /app/data/.initialized
echo "Done with init. Starting"
else
echo "Already initialized. Starting"
fi
# Chown necessary directories here since these are volumes
chown -R cloudron:cloudron /app/data /run
export CONCOURSE_EXTERNAL_URL=$APP_ORIGIN
export CONCOURSE_POSTGRES_HOST=$POSTGRESQL_HOST
export CONCOURSE_POSTGRES_PORT=$POSTGRESQL_PORT
export CONCOURSE_POSTGRES_USER=$POSTGRESQL_USERNAME
export CONCOURSE_POSTGRES_PASSWORD=$POSTGRESQL_PASSWORD
export CONCOURSE_POSTGRES_DATABASE=$POSTGRESQL_DATABASE
export CONCOURSE_GENERIC_OAUTH_DISPLAY_NAME="Cloudron"
export CONCOURSE_GENERIC_OAUTH_CLIENT_ID=$OAUTH_CLIENT_ID
export CONCOURSE_GENERIC_OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
export CONCOURSE_GENERIC_OAUTH_AUTH_URL=${API_ORIGIN}/api/v1/oauth/dialog/authorize
export CONCOURSE_GENERIC_OAUTH_TOKEN_URL=${API_ORIGIN}/api/v1/oauth/token
export CONCOURSE_TSA_BIND_PORT=$TSA_PORT
export CONCOURSE_TSA_HOST_KEY=/app/data/tsa_host_key
export CONCOURSE_TSA_AUTHORIZED_KEYS=/app/data/authorized_worker_keys
export CONCOURSE_SESSION_SIGNING_KEY=/app/data/session_signing_key
#exec /usr/local/bin/gosu cloudron:cloudron /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon --logfile /run/logs/supervisord.log -i Concourse
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon --logfile /run/logs/supervisord.log -i Concourse