Finalize with nginx.

This commit is contained in:
Glenn Y. Rolland 2014-08-13 13:28:11 +02:00
parent 5ee7581d7c
commit 99f5a16c47
9 changed files with 84 additions and 26 deletions

View file

@ -6,37 +6,52 @@ RUN apt-get update
# Install supervisor for managing services
RUN apt-get install -q -y supervisor cron openssh-server pwgen reprepro screen vim-tiny sudo
RUN service supervisor stop
ADD configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN apt-get install -q -y supervisor cron openssh-server pwgen reprepro screen vim-tiny sudo nginx
# Configure cron
# Install cron for managing regular tasks
ADD configs/supervisor-cron.conf /etc/supervisor/conf.d/cron.conf
RUN sed -i 's/\(session *required *pam_loginuid.so\)/#\1/' /etc/pam.d/cron
# Install ssh
ADD configs/supervisor-ssh.conf /etc/supervisor/conf.d/ssh.conf
# Install ssh (run/stop to create required directories)
RUN mkdir /var/run/sshd
RUN service ssh start ; sleep 1
#RUN service ssh start ; sleep 1
RUN service ssh stop
# Configure reprepro
ADD scripts/reprepro-import.sh /usr/local/sbin/reprepro-import
RUN chmod 755 /usr/local/sbin/reprepro-import
RUN mkdir -p /var/lib/reprepro/conf
ADD configs/reprepro-distributions /var/lib/reprepro/conf/distributions
# Configure nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/default
ADD configs/nginx-default.conf /etc/nginx/sites-enabled/default
# Setup root & sudo access
RUN echo "root:docker" | chpasswd
RUN echo %sudo ALL=NOPASSWD: ALL >> /etc/sudoers
# Configure supervisor
RUN service supervisor stop
ADD configs/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
ADD configs/supervisor-cron.conf /etc/supervisor/conf.d/cron.conf
ADD configs/supervisor-ssh.conf /etc/supervisor/conf.d/ssh.conf
ADD configs/supervisor-nginx.conf /etc/supervisor/conf.d/nginx.conf
# Finalize
ENV DEBIAN_FRONTEND newt
ADD scripts/start.sh /start.sh
RUN chmod 755 /start.sh
ADD scripts/start.sh /usr/local/sbin/start
RUN chmod 755 /usr/local/sbin/start
VOLUME ["/docker/keys", "/docker/incoming"]
EXPOSE 80
EXPOSE 22
CMD ["/bin/bash", "/start.sh"]
CMD ["/usr/local/sbin/start"]

View file

@ -1,16 +1,16 @@
DEBUG=0
ifeq ($(DEBUG),0)
RUNCMD=
else
RUNCMD=-i /bin/bash
endif
build:
docker build -t glenux/debian-repo .
run:
ID=$$(docker run -v $$(pwd)/keys:/docker/keys -d -t glenux/debian-repo $(RUNCMD)); \
ID=$$(docker run -v $$(pwd)/keys:/docker/keys -d -i -t glenux/debian-repo); \
(docker inspect $$ID |sed -n -e 's/.*"IPAddress": "\(.*\)".*/\1/p'); \
docker logs -f $$ID
test:
docker run -v $$(pwd)/keys:/docker/keys \
--rm=true \
-i -t glenux/debian-repo \
/bin/bash

0
TODO.md Normal file
View file

View file

@ -0,0 +1,16 @@
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
autoindex on;
location / {
try_files $uri $uri/ =404;
}
}

View file

@ -0,0 +1,17 @@
Origin: Glenn Y. Rolland
Label: Glenux Truc
Suite: unstable
Codename: sid
Version: 3.1
Architectures: i386 amd64 powerpc source
Components: main non-free contrib
Description: Glenux.Net Repository Unstable
Origin: Glenn Y. Rolland
Label: Glenux Truc
Suite: testing
Codename: wheezy
Version: 3.1
Architectures: i386 amd64 powerpc source
Components: main non-free contrib
Description: Glenux.Net Repository Testing

View file

@ -0,0 +1,4 @@
[program:nginx]
command=/usr/sbin/nginx
stdout_events_enabled=true
stderr_events_enabled=true

View file

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC19zZUOjrv/COz8v7J8LI4/kP/BI3xKDG4dsNxzW0ZGQw3ZC2dYZsvmOCNJJMbxzzFjwGzlfXoiqjDrFQ6aOZHrvudL29PE4/RYCn2DMZO5YwEnpkfXArPZ9pxpLbvY+tXReUF7+bRA56BDUEYYAVaP7QfLs1SFcLuHW9lBHEOrJD8oQWr7GvEVyVMRMOIEIngYDut3HwpKk1tweQk0GDG1JpBi4TUXEPQKIwP5aGpojLSM5w2/Q+0ohm4BKO9CFoLhL4Nptu57CuTcfSBoHt72Yg3dd9dVrao3vGRQiYmnxp3WUGGD//qzcRApHxSvoz20usfX/pDKks+f4UT+FUZ warbrain@dyction

View file

@ -1,8 +1,8 @@
#!/bin/sh
BASEDIR=$HOME/debian
INCOMING=$BASEDIR/incoming
OUTDIR=$HOME/public_html/debian
BASEDIR=/var/lib/reprepro
INCOMING=/docker/incoming
OUTDIR=/var/www/debian
#
# Make sure we're in the apt/ directory
@ -62,4 +62,4 @@ for i in $INCOMING/*.changes; do
# Finally delete the .changes file itself.
rm $i
done
chown -R www-data:www-data $OUTDIR

View file

@ -9,7 +9,9 @@
SSH_USERPASS=`pwgen -c -n -1 8`
mkdir /home/user
useradd -G sudo -d /home/user -s /bin/bash user
chown user /home/user
chown -R user /home/user
chown -R user /docker/incoming
echo "user:$SSH_USERPASS" | chpasswd
echo "ssh user password: $SSH_USERPASS"
@ -26,10 +28,13 @@ chown -R user /home/user/.ssh
# load cron
CRONFILE=`mktemp`
cat > $CRONFILE <<EOF
* * * * * echo "pif" >> /home/user/pif.log
* * * * * reprepro-import >> /var/log/reprepro.log
EOF
crontab -u user $CRONFILE
crontab -u root $CRONFILE
rm -f $CRONFILE
# run import once, to create the right directory structure
reprepro-import
supervisord -n