mirror of
https://github.com/adferrand/docker-backuppc.git
synced 2023-11-05 04:40:26 +01:00
Correct various bugs on circus, in particular in passing env variables
This commit is contained in:
parent
a7fd5b6a68
commit
5dca16b89c
14
Dockerfile
14
Dockerfile
@ -7,9 +7,10 @@ ENV BACKUPPC_XS_VERSION 0.57
|
||||
ENV RSYNC_BPC_VERSION 3.0.9.12
|
||||
ENV PAR2_VERSION v0.8.0
|
||||
|
||||
RUN apk --no-cache --update add python3 rsync perl perl-archive-zip perl-xml-rss perl-cgi perl-file-listing expat samba-client iputils openssh openssl rrdtool msmtp lighttpd lighttpd-mod_auth gzip apache2-utils tzdata libstdc++ libgomp shadow \
|
||||
# Install backuppc runtime dependencies
|
||||
RUN apk --no-cache --update add python3 rsync bash perl perl-archive-zip perl-xml-rss perl-cgi perl-file-listing expat samba-client iputils openssh openssl rrdtool msmtp lighttpd lighttpd-mod_auth gzip apache2-utils tzdata libstdc++ libgomp shadow \
|
||||
# Install backuppc build dependencies
|
||||
&& apk --no-cache --update --virtual build-dependencies add gcc g++ libgcc autoconf automake make git patch perl-dev expat-dev curl wget \
|
||||
&& apk --no-cache --update --virtual build-dependencies add gcc g++ libgcc linux-headers autoconf automake make git patch perl-dev python3-dev expat-dev curl wget \
|
||||
# Install supervisor
|
||||
&& python3 -m ensurepip \
|
||||
&& pip3 install --upgrade pip circus \
|
||||
@ -32,8 +33,8 @@ RUN apk --no-cache --update add python3 rsync perl perl-archive-zip perl-xml-rss
|
||||
# Get BackupPC, it will be installed at runtime to allow dynamic upgrade of existing config/pool
|
||||
&& curl -o /root/BackupPC-$BACKUPPC_VERSION.tar.gz -L https://github.com/backuppc/backuppc/releases/download/$BACKUPPC_VERSION/BackupPC-$BACKUPPC_VERSION.tar.gz \
|
||||
# Prepare backuppc home
|
||||
&& mkdir -p /home/backuppc \
|
||||
# Mark the docker as not runned yet, to allow entrypoint to do its stuff
|
||||
&& mkdir -p /home/backuppc && cd /home/backuppc \
|
||||
# Mark the docker as not run yet, to allow entrypoint to do its stuff
|
||||
&& touch /firstrun \
|
||||
# Clean
|
||||
&& rm -rf /root/backuppc-xs /root/rsync-bpc /root/par2cmdline \
|
||||
@ -41,12 +42,15 @@ RUN apk --no-cache --update add python3 rsync perl perl-archive-zip perl-xml-rss
|
||||
|
||||
COPY files/lighttpd.conf /etc/lighttpd/lighttpd.conf
|
||||
COPY files/entrypoint.sh /entrypoint.sh
|
||||
COPY files/run.sh /run.sh
|
||||
COPY files/circus.ini /etc/circus.ini
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
WORKDIR /home/backuppc
|
||||
|
||||
VOLUME ["/etc/backuppc", "/home/backuppc", "/data/backuppc"]
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/bin/circusd", "/etc/circus.ini"]
|
||||
CMD ["/run.sh"]
|
||||
|
@ -3,6 +3,7 @@ endpoint = ipc:///var/circus/endpoint
|
||||
pubsub_endpoint = ipc:///var/circus/pubsub
|
||||
statsd = False
|
||||
httpd = False
|
||||
working_dir = /home/backuppc
|
||||
|
||||
[watcher:lighttpd]
|
||||
cmd = /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -D
|
||||
@ -13,3 +14,9 @@ stderr_stream.class = FancyStdoutStream
|
||||
cmd = /usr/local/BackupPC/bin/BackupPC
|
||||
stdout_stream.class = FancyStdoutStream
|
||||
stderr_stream.class = FancyStdoutStream
|
||||
uid = $(circus.env.backuppc_uuid)
|
||||
gid = $(circus.env.backuppc_guid)
|
||||
|
||||
[env:lighttpd]
|
||||
BACKUPPC_USERNAME = $BACKUPPC_USERNAME
|
||||
BACKUPPC_GROUPNAME = $BACKUPPC_GROUPNAME
|
||||
|
@ -1,8 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BACKUPPC_USERNAME=`getent passwd "${BACKUPPC_UUID:-1000}" | cut -d: -f1`
|
||||
BACKUPPC_GROUPNAME=`getent group "${BACKUPPC_GUID:-1000}" | cut -d: -f1`
|
||||
BACKUPPC_UUID="${BACKUPPC_UUID:-1000}"
|
||||
BACKUPPC_GUID="${BACKUPPC_GUID:-1000}"
|
||||
BACKUPPC_USERNAME=`getent passwd "$BACKUPPC_UUID" | cut -d: -f1`
|
||||
BACKUPPC_GROUPNAME=`getent group "$BACKUPPC_GUID" | cut -d: -f1`
|
||||
|
||||
if [ -f /firstrun ]; then
|
||||
echo 'First run of the container. BackupPC will be installed.'
|
||||
@ -15,11 +17,11 @@ if [ -f /firstrun ]; then
|
||||
|
||||
# Create backuppc user/group if needed
|
||||
if [ -z "$BACKUPPC_GROUPNAME" ]; then
|
||||
groupadd -r -g "${BACKUPPC_GUID:-1000}" backuppc
|
||||
groupadd -r -g "$BACKUPPC_GUID" backuppc
|
||||
BACKUPPC_GROUPNAME="backuppc"
|
||||
fi
|
||||
if [ -z "$BACKUPPC_USERNAME" ]; then
|
||||
useradd -r -d /home/backuppc -g "${BACKUPPC_GUID:-1000}" -u ${BACKUPPC_UUID:-1000} -M -N backuppc
|
||||
useradd -r -d /home/backuppc -g "$BACKUPPC_GUID" -u "$BACKUPPC_UUID" -M -N backuppc
|
||||
BACKUPPC_USERNAME="backuppc"
|
||||
else
|
||||
usermod -d /home/backuppc "$BACKUPPC_USERNAME"
|
||||
@ -92,8 +94,14 @@ if [ -f /firstrun ]; then
|
||||
rm -rf /root/BackupPC-$BACKUPPC_VERSION.tar.gz /root/BackupPC-$BACKUPPC_VERSION /firstrun
|
||||
fi
|
||||
|
||||
export BACKUPPC_UUID
|
||||
export BACKUPPC_GUID
|
||||
export BACKUPPC_USERNAME
|
||||
export BACKUPPC_GROUPNAME
|
||||
|
||||
# Executable bzip2 seems to have been moved into /usr/bin in latest Alpine version. Fix that.
|
||||
ln -s /usr/bin/bzip2 /bin/bzip2
|
||||
|
||||
# Exec given CMD in Dockerfile
|
||||
cd /home/backuppc
|
||||
exec "$@"
|
||||
|
8
files/run.sh
Executable file
8
files/run.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Ensure directory and necessary sockets exists
|
||||
mkdir -p /var/circus
|
||||
touch /var/circus/endpoint /var/circus/pubsub /var/circus/stats
|
||||
|
||||
# Launch circus
|
||||
/usr/bin/circusd /etc/circus.ini
|
@ -1,38 +0,0 @@
|
||||
[unix_http_server]
|
||||
file = /tmp/supervisor.sock
|
||||
username = dummy
|
||||
password = dummy
|
||||
|
||||
[supervisord]
|
||||
user=root
|
||||
logfile = /var/log/supervisord.log
|
||||
logfile_maxbytes = 50MB
|
||||
logfile_backups = 10
|
||||
loglevel = info
|
||||
pidfile = /tmp/supervisord.pid
|
||||
nodaemon = true
|
||||
minfds = 1024
|
||||
minprocs = 200
|
||||
|
||||
[rpcinterface:supervisor]
|
||||
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||
|
||||
[supervisorctl]
|
||||
serverurl = unix:///tmp/supervisor.sock
|
||||
username = dummy
|
||||
password = dummy
|
||||
|
||||
[program:lighttpd]
|
||||
command = /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf -D
|
||||
redirect_stderr = true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
stopasgroup = true
|
||||
killasgroup = true
|
||||
|
||||
[program:backuppc]
|
||||
command = /usr/local/BackupPC/bin/BackupPC
|
||||
redirect_stderr = true
|
||||
stdout_logfile = /dev/stdout
|
||||
stdout_logfile_maxbytes = 0
|
||||
user = %(ENV_BACKUPPC_USERNAME)s
|
Loading…
Reference in New Issue
Block a user