forked from cloudron-apps/gitea-app
Make it work
This commit is contained in:
parent
7c79e9e268
commit
9bb0664688
5 changed files with 74 additions and 43 deletions
|
@ -9,6 +9,7 @@ ADD supervisor/ /etc/supervisor/conf.d/
|
||||||
RUN cd /tmp && \
|
RUN cd /tmp && \
|
||||||
wget https://github.com/gogits/gogs/releases/download/v0.6.1/linux_amd64.zip && \
|
wget https://github.com/gogits/gogs/releases/download/v0.6.1/linux_amd64.zip && \
|
||||||
unzip linux_amd64.zip -d /home/cloudron && \
|
unzip linux_amd64.zip -d /home/cloudron && \
|
||||||
|
chown -R cloudron:cloudron /home/cloudron/gogs && \
|
||||||
rm linux_amd64.zip
|
rm linux_amd64.zip
|
||||||
|
|
||||||
ADD app.ini.template /home/cloudron/app.ini.template
|
ADD app.ini.template /home/cloudron/app.ini.template
|
||||||
|
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Automated installs
|
||||||
|
------------------
|
||||||
|
https://github.com/gogits/gogs/issues/145#issuecomment-41863670
|
||||||
|
https://github.com/geerlingguy/ansible-role-gogs/issues/1
|
|
@ -1,10 +1,15 @@
|
||||||
; App name that shows on every page title
|
|
||||||
APP_NAME = Gogs: Go Git Service
|
|
||||||
; Change it if you run locally
|
|
||||||
RUN_USER = cloudron
|
RUN_USER = cloudron
|
||||||
; Either "dev", "prod" or "test", default is "dev"
|
|
||||||
RUN_MODE = prod
|
RUN_MODE = prod
|
||||||
|
|
||||||
|
[database]
|
||||||
|
DB_TYPE = mysql
|
||||||
|
HOST = ##MYSQL_HOST:##MYSQL_PORT
|
||||||
|
NAME = ##MYSQL_DATABASE
|
||||||
|
USER = ##MYSQL_USERNAME
|
||||||
|
PASSWD = ##MYSQL_PASSWORD
|
||||||
|
SSL_MODE =
|
||||||
|
PATH =
|
||||||
|
|
||||||
[repository]
|
[repository]
|
||||||
ROOT = /app/data
|
ROOT = /app/data
|
||||||
SCRIPT_TYPE = bash
|
SCRIPT_TYPE = bash
|
||||||
|
@ -15,43 +20,25 @@ DOMAIN = ##HOSTNAME
|
||||||
ROOT_URL = https://%(DOMAIN)s/
|
ROOT_URL = https://%(DOMAIN)s/
|
||||||
HTTP_ADDR =
|
HTTP_ADDR =
|
||||||
HTTP_PORT = 3000
|
HTTP_PORT = 3000
|
||||||
; Disable SSH feature when not available
|
|
||||||
DISABLE_SSH = false
|
DISABLE_SSH = false
|
||||||
SSH_PORT = ##SSH_PORT
|
SSH_PORT = ##SSH_PORT
|
||||||
; Landing page for non-logged users, can be "home" or "explore"
|
; Landing page for non-logged users, can be "home" or "explore"
|
||||||
LANDING_PAGE = explore
|
LANDING_PAGE = explore
|
||||||
|
|
||||||
[database]
|
[mailer]
|
||||||
; Either "mysql", "postgres" or "sqlite3", it's your choice
|
ENABLED = true
|
||||||
DB_TYPE = mysql
|
HOST = ##MAIL_SERVER:##MAIL_PORT
|
||||||
HOST = ##MYSQL_HOST:##MYSQL_PORT
|
USER =
|
||||||
NAME = ##MYSQL_DATABASE
|
PASSWD =
|
||||||
USER = ##MYSQL_USERNAME
|
FROM = ##MAIL_FROM
|
||||||
PASSWD = ##MYSQL_PASSWORD
|
|
||||||
|
|
||||||
[admin]
|
[admin]
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
INSTALL_LOCK = true
|
INSTALL_LOCK = true
|
||||||
|
SECRET_KEY = ##SECRET_KEY
|
||||||
|
|
||||||
[mailer]
|
[service]
|
||||||
ENABLED = true
|
DISABLE_REGISTRATION = false
|
||||||
; Name displayed in mail title
|
SHOW_REGISTRATION_BUTTON = false
|
||||||
SUBJECT = %(APP_NAME)s
|
|
||||||
; Mail server
|
|
||||||
; Gmail: smtp.gmail.com:587
|
|
||||||
; QQ: smtp.qq.com:25
|
|
||||||
; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used.
|
|
||||||
HOST = ##MAIL_SERVER:##MAIL_PORT
|
|
||||||
; Do not verify the certificate of the server. Only use this for self-signed certificates
|
|
||||||
SKIP_VERIFY =
|
|
||||||
; Use client certificate
|
|
||||||
USE_CERTIFICATE = false
|
|
||||||
CERT_FILE =
|
|
||||||
KEY_FILE =
|
|
||||||
; Mail from address, RFC 5322. This can be just an email address, or the "Name" <email@example.com> format
|
|
||||||
FROM = ##MAIL_FROM
|
|
||||||
; Mailer user name and password
|
|
||||||
USER =
|
|
||||||
PASSWD =
|
|
||||||
|
|
||||||
|
|
50
start.sh
50
start.sh
|
@ -4,8 +4,46 @@ set -eu -o pipefail
|
||||||
|
|
||||||
fqdn=$(hostname -f)
|
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" \
|
sed -e "s/##HOSTNAME/${fqdn}/g" \
|
||||||
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
-e "s/##SSH_PORT/${SSH_PORT}/g" \
|
||||||
-e "s/##MYSQL_HOST/${MYSQL_HOST}/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_SERVER/${MAIL_SMTP_SERVER}/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" \
|
||||||
/home/cloudron/app.ini.template > "/home/cloudron/gogs/custom/conf/app.ini"
|
/home/cloudron/app.ini.template > "/home/cloudron/gogs/custom/conf/app.ini"
|
||||||
|
|
||||||
chown -R cloudron.cloudron /app/data
|
supervisorctl restart gogs
|
||||||
|
|
||||||
# Dockerfile changes the ownership of this file to make it writable by cloudron user
|
wait
|
||||||
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
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,11 @@ command=/home/cloudron/gogs/gogs web
|
||||||
user=cloudron
|
user=cloudron
|
||||||
autostart=true
|
autostart=true
|
||||||
autorestart=true
|
autorestart=true
|
||||||
stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
; https://veithen.github.io/2015/01/08/supervisord-redirecting-stdout.html
|
||||||
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
stdout_logfile=/dev/stdout
|
||||||
environment=USER="cloudron"
|
stdout_logfile_maxbytes=0
|
||||||
|
stderr_logfile=/dev/stderr
|
||||||
|
stderr_logfile_maxbytes=0
|
||||||
|
; stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
||||||
|
; stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
||||||
|
environment=HOME="/home/cloudron",USER="cloudron"
|
||||||
|
|
Loading…
Reference in a new issue