infra/codestorage/hg-ssh

Paddy 2015-10-11 Parent:eeaf3e97ed44 Child:121585c71fd7

1:2f4a2a20ad6d Go to Latest

infra/codestorage/hg-ssh/Dockerfile

Update to be more modular. We updated our Mercurial serving architecture to be a bit more modular. The main difference is that we now are based off the secondbit/hg-repo-sync image, and don't need to do as much setup to get the basics (Mercurial, folders, etc.) We now have a pullkeys.ssh script, which pulls down the SSH keys stored in a specified GCS bucket, and creates users for them. This allows us to update who has push access, without modifying the docker image. We also have a custom run.sh script now, instead of starting sshd directly, because we need to do a few things when starting this up: 1. Modify the permissions on the mounted directories while we're root so SSH users can write and read the committed files. We have to do this at start time instead of at image build time because Kubernetes' volumes don't respect the permissions set at build time. 2. Pull all the repos backed up to GCS to local disk, which means that startup automatically picks up at the last known state. This script is built into the image by secondbit/hg-repo-sync. 3. Pull all the SSH keys from GCS, using the new script. This creates the new users and lets us SSH into the server, while keeping the user definitions separate from the image itself. 4. Finally, start the SSH daemon.

History
paddy@1 1 FROM secondbit/hg-repo-sync
paddy@1 2 MAINTAINER Paddy "<paddy@secondbit.org>"
paddy@0 3
paddy@0 4 ADD create_user.sh /usr/local/bin/helpers/create_user.sh
paddy@0 5 RUN chmod +x /usr/local/bin/helpers/create_user.sh
paddy@1 6 ADD run.sh /usr/local/bin/helpers/run-ssh.sh
paddy@1 7 RUN chmod +x /usr/local/bin/helpers/run-ssh.sh
paddy@1 8 ADD pullkeys.sh /usr/local/bin/helpers/pullkeys.sh
paddy@1 9 RUN chmod +x /usr/local/bin/helpers/pullkeys.sh
paddy@0 10
paddy@0 11 RUN mkdir /var/run/sshd
paddy@0 12
paddy@0 13 # install required packages
paddy@0 14 RUN apt-get -y update
paddy@1 15 RUN apt-get -y install openssh-server
paddy@0 16
paddy@0 17 #ADD sshd_config /etc/ssh/sshd_config
paddy@0 18 RUN sed -ri 's/session required pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd
paddy@0 19 RUN sed -ri 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
paddy@0 20 RUN sed -ri 's/PermitRootLogin without-password/PermitRootLogin no/g' /etc/ssh/sshd_config
paddy@0 21
paddy@0 22 EXPOSE 22
paddy@0 23
paddy@1 24 CMD ["/usr/local/bin/helpers/run-ssh.sh"]