|
@@ -2,20 +2,23 @@
|
|
|
|
|
|
set -eu -o pipefail
|
|
set -eu -o pipefail
|
|
|
|
|
|
-fqdn=$(hostname -f)
|
|
|
|
|
|
+readonly fqdn=$(hostname -f)
|
|
|
|
|
|
-chown -R cloudron.cloudron /app/data
|
|
|
|
|
|
+setup_ldap_source() {
|
|
|
|
+ # Wait for gogs to finish db setup, before we insert ldap source in db
|
|
|
|
+ while ! curl --fail http://localhost:3000/healthcheck; do
|
|
|
|
+ echo "Waiting for gogs to come up"
|
|
|
|
+ sleep 1
|
|
|
|
+ done
|
|
|
|
|
|
-# clean up old logs
|
|
|
|
-rm -rf /home/cloudron/gogs/log && mkdir -p /home/cloudron/gogs/log
|
|
|
|
-chown cloudron:cloudron /home/cloudron/gogs/log
|
|
|
|
|
|
+ # id, type, name, is_actived, cfg, allow_auto_register, created, updated
|
|
|
|
+ mysql -u"${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" -h mysql --database="${MYSQL_DATABASE}" \
|
|
|
|
+ -e "REPLACE INTO login_source VALUES (1,2,'cloudron',1,'{\"Name\":\"cloudron\",\"Host\":\"${LDAP_SERVER}\",\"Port\":${LDAP_PORT},\"UseSSL\":false,\"UserBase\":\"${LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"uid\",\"AttributeName\":\"\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u0026(objectClass=user)(uid=%s))\",\"AdminFilter\":\"(memberof=cn=admins,${LDAP_GROUPS_BASE_DN})\",\"Enabled\":true}',1,'2015-06-24 17:14:12','2015-06-24 17:25:03');"
|
|
|
|
+}
|
|
|
|
|
|
-# Dockerfile changes the ownership of this file to make it writable by cloudron user
|
|
|
|
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
sed -e "s/^Port .*/Port ${SSH_PORT}/" \
|
|
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
-e "s/^#ListenAddress .*/ListenAddress 0.0.0.0/" \
|
|
- -i /etc/ssh/sshd_config
|
|
|
|
-
|
|
|
|
-mkdir -p /home/cloudron/gogs/custom/conf
|
|
|
|
|
|
+ /etc/ssh/sshd_config > /run/gogs/sshd_config
|
|
|
|
|
|
sed -e "s/##HOSTNAME/${fqdn}/g" \
|
|
sed -e "s/##HOSTNAME/${fqdn}/g" \
|
|
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
|
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
|
@@ -28,21 +31,13 @@ sed -e "s/##HOSTNAME/${fqdn}/g" \
|
|
-e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \
|
|
-e "s/##MAIL_PORT/${MAIL_SMTP_PORT}/g" \
|
|
-e "s/##MAIL_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/g" \
|
|
-e "s/##MAIL_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/g" \
|
|
-e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \
|
|
-e "s/##SECRET_KEY/$(pwgen -1 -s)/g" \
|
|
- /home/cloudron/app.ini.template > "/home/cloudron/gogs/custom/conf/app.ini"
|
|
|
|
|
|
+ /home/cloudron/app.ini.template > "/run/gogs/app.ini"
|
|
|
|
|
|
-chown cloudron:cloudron /home/cloudron/gogs/custom/conf/app.ini
|
|
|
|
|
|
+chown cloudron:cloudron /run/gogs
|
|
|
|
|
|
-/usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gogs &
|
|
|
|
-
|
|
|
|
-# Wait for gogs to finish db setup, before we insert ldap source in db
|
|
|
|
-while ! curl --fail http://localhost:3000/healthcheck; do
|
|
|
|
- echo "Waiting for gogs to come up"
|
|
|
|
- sleep 1
|
|
|
|
-done
|
|
|
|
|
|
+chown -R cloudron.cloudron /app/data
|
|
|
|
|
|
-# id, type, name, is_actived, cfg, allow_auto_register, created, updated
|
|
|
|
-mysql -u"${MYSQL_USERNAME}" -p"${MYSQL_PASSWORD}" -h mysql --database="${MYSQL_DATABASE}" \
|
|
|
|
- -e "REPLACE INTO login_source VALUES (1,2,'cloudron',1,'{\"Name\":\"cloudron\",\"Host\":\"${LDAP_SERVER}\",\"Port\":${LDAP_PORT},\"UseSSL\":false,\"UserBase\":\"${LDAP_USERS_BASE_DN}\",\"AttributeUsername\":\"uid\",\"AttributeName\":\"\",\"AttributeSurname\":\"\",\"AttributeMail\":\"mail\",\"Filter\":\"(\\\\u0026(objectClass=user)(uid=%s))\",\"AdminFilter\":\"(memberof=cn=admins,${LDAP_GROUPS_BASE_DN})\",\"Enabled\":true}',1,'2015-06-24 17:14:12','2015-06-24 17:25:03');"
|
|
|
|
|
|
+( setup_ldap_source ) &
|
|
|
|
|
|
-wait
|
|
|
|
|
|
+exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i Gogs
|
|
|
|
|