|
@@ -4,8 +4,46 @@ set -eu -o pipefail
|
|
|
|
|
|
fqdn=$(hostname -f)
|
|
|
|
|
|
-mkdir -p /home/cloudron/gogs/custom/conf
|
|
|
+chown -R cloudron.cloudron /app/data
|
|
|
+
|
|
|
+# Dockerfile changes the ownership of this file to make it writable by cloudron user
|
|
|
+sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
|
+ -e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
|
+ -i /etc/ssh/sshd_config
|
|
|
|
|
|
+/usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gogs &
|
|
|
+
|
|
|
+sleep 3
|
|
|
+
|
|
|
+if [[ ! -f /home/cloudron/gogs/custom/conf/app.ini ]]; then
|
|
|
+ echo "Triggering installation"
|
|
|
+
|
|
|
+ mkdir -p /home/cloudron/gogs/custom/conf
|
|
|
+ touch /home/cloudron/gogs/custom/conf/app.ini
|
|
|
+ chown cloudron:cloudron /home/cloudron/gogs/custom/conf/app.ini
|
|
|
+
|
|
|
+ # this creates the custom/conf/app.ini
|
|
|
+ curl -X POST http://localhost:3000/install \
|
|
|
+ --data db_type=MySQL \
|
|
|
+ --data-urlencode "db_host=${MYSQL_HOST}:${MYSQL_PORT}" \
|
|
|
+ --data "db_user=${MYSQL_USERNAME}" \
|
|
|
+ --data-urlencode "db_passwd=${MYSQL_PASSWORD}" \
|
|
|
+ --data "db_name=${MYSQL_DATABASE}" \
|
|
|
+ --data-urlencode "repo_root_path=/tmp" \
|
|
|
+ --data run_user=cloudron \
|
|
|
+ --data "domain=${fqdn}" \
|
|
|
+ --data http_port=3000 \
|
|
|
+ --data-urlencode "app_url=https://${fqdn}/" \
|
|
|
+ --data "smtp_host=${MAIL_SMTP_SERVER}" \
|
|
|
+ --data smtp_user= \
|
|
|
+ --data smtp_pwd= \
|
|
|
+ --data admin_name=admin \
|
|
|
+ --data admin_passwd=admin \
|
|
|
+ --data admin_confirm_passwd=admin \
|
|
|
+ --data-urlencode admin_email=girish@forwardbias.in
|
|
|
+fi
|
|
|
+
|
|
|
+# use GOGS_CONFIG maybe for this but not very documented
|
|
|
sed -e "s/##HOSTNAME/${fqdn}/g" \
|
|
|
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
|
|
-e "s/##MYSQL_HOST/${MYSQL_HOST}/g" \
|
|
@@ -16,14 +54,10 @@ sed -e "s/##HOSTNAME/${fqdn}/g" \
|
|
|
-e "s/##MAIL_SERVER/${MAIL_SMTP_SERVER}/g" \
|
|
|
-e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \
|
|
|
-e "s/##MAIL_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/g" \
|
|
|
+ -e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \
|
|
|
/home/cloudron/app.ini.template > "/home/cloudron/gogs/custom/conf/app.ini"
|
|
|
|
|
|
-chown -R cloudron.cloudron /app/data
|
|
|
-
|
|
|
-# Dockerfile changes the ownership of this file to make it writable by cloudron user
|
|
|
-sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
|
- -e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
|
- -i /etc/ssh/sshd_config
|
|
|
+supervisorctl restart gogs
|
|
|
|
|
|
-/usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gogs
|
|
|
+wait
|
|
|
|