Gogs actually needs sshd

This commit is contained in:
Girish Ramakrishnan 2015-04-28 19:29:12 -07:00
parent 9a436eacfb
commit 7c79e9e268
5 changed files with 41 additions and 7 deletions

View file

@ -1,9 +1,10 @@
FROM girish/base:0.2.0 FROM girish/base:0.2.0
USER cloudron RUN apt-get update && \
apt-get install -y openssh-server && \
rm -r /var/cache/apt /var/lib/apt/lists
# gogs uses this env to detect current user ADD supervisor/ /etc/supervisor/conf.d/
ENV USER cloudron
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 && \
@ -13,5 +14,10 @@ RUN cd /tmp && \
ADD app.ini.template /home/cloudron/app.ini.template ADD app.ini.template /home/cloudron/app.ini.template
ADD start.sh /home/cloudron/start.sh ADD start.sh /home/cloudron/start.sh
# disable pam authentication for sshd
RUN sed 's/UsePAM yes/UsePAM no/' -i /etc/ssh/sshd_config
RUN sed 's/UsePrivilegeSeparation yes/UsePrivilegeSeparation no/' -i /etc/ssh/sshd_config
RUN echo "UseDNS no" >> /etc/ssh/sshd_config
CMD [ "/home/cloudron/start.sh" ] CMD [ "/home/cloudron/start.sh" ]

View file

@ -10,9 +10,9 @@ ROOT = /app/data
SCRIPT_TYPE = bash SCRIPT_TYPE = bash
[server] [server]
PROTOCOL = https PROTOCOL = http
DOMAIN = ##HOSTNAME DOMAIN = ##HOSTNAME
ROOT_URL = %(PROTOCOL)s://%(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 feature when not available
@ -29,6 +29,11 @@ NAME = ##MYSQL_DATABASE
USER = ##MYSQL_USERNAME USER = ##MYSQL_USERNAME
PASSWD = ##MYSQL_PASSWORD PASSWD = ##MYSQL_PASSWORD
[admin]
[security]
INSTALL_LOCK = true
[mailer] [mailer]
ENABLED = true ENABLED = true
; Name displayed in mail title ; Name displayed in mail title
@ -37,7 +42,7 @@ SUBJECT = %(APP_NAME)s
; Gmail: smtp.gmail.com:587 ; Gmail: smtp.gmail.com:587
; QQ: smtp.qq.com:25 ; 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. ; 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 HOST = ##MAIL_SERVER:##MAIL_PORT
; Do not verify the certificate of the server. Only use this for self-signed certificates ; Do not verify the certificate of the server. Only use this for self-signed certificates
SKIP_VERIFY = SKIP_VERIFY =
; Use client certificate ; Use client certificate

View file

@ -14,10 +14,16 @@ sed -e "s/##HOSTNAME/${fqdn}/g" \
-e "s/##MYSQL_PASSWORD/${MYSQL_PASSWORD}/g" \ -e "s/##MYSQL_PASSWORD/${MYSQL_PASSWORD}/g" \
-e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/g" \ -e "s/##MYSQL_DATABASE/${MYSQL_DATABASE}/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_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/g" \ -e "s/##MAIL_FROM/${MAIL_SMTP_USERNAME}@${MAIL_DOMAIN}/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 chown -R cloudron.cloudron /app/data
/home/cloudron/gogs/gogs web # 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

9
supervisor/gogs.conf Normal file
View file

@ -0,0 +1,9 @@
[program:gogs]
directory=/home/cloudron/gogs
command=/home/cloudron/gogs/gogs web
user=cloudron
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
environment=USER="cloudron"

8
supervisor/sshd.conf Normal file
View file

@ -0,0 +1,8 @@
[program:sshd]
directory=/
command=/usr/sbin/sshd -D
user=root
autostart=true
autorestart=true
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log