[ADD]Rsync, odoobackups CentOS7
This commit is contained in:
parent
bfd708d7c2
commit
48e26939b7
@ -5,3 +5,8 @@ services:
|
||||
rsyncvolumes:
|
||||
build: ./rsyncvolumes
|
||||
image: registry.yaltik.net/rsyncvolumes:base
|
||||
rsyncvolumesc7:
|
||||
build:
|
||||
context: ./rsyncvolumes
|
||||
dockerfile: Dockerfile.c7
|
||||
image: registry.yaltik.net/rsyncvolumes:basec7
|
||||
|
18
backups/rsyncvolumes/Dockerfile.c7
Normal file
18
backups/rsyncvolumes/Dockerfile.c7
Normal file
@ -0,0 +1,18 @@
|
||||
FROM centos:7
|
||||
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
ENV SOURCE /var/lib/docker/volumes
|
||||
ENV DEST /var/backups/
|
||||
|
||||
RUN yum -y install gettext rsync cronie
|
||||
|
||||
# Avoid overlayfs bug with tail
|
||||
VOLUME /var/log
|
||||
|
||||
WORKDIR /opt/backup
|
||||
COPY crontab ./crontab
|
||||
COPY rsync.template .
|
||||
COPY plan.tpl.py .
|
||||
COPY launch.c7.sh launch.sh
|
||||
|
||||
CMD bash launch.sh
|
5
backups/rsyncvolumes/launch.c7.sh
Normal file
5
backups/rsyncvolumes/launch.c7.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
envsubst < /opt/backup/rsync.template > /opt/backup/rsync.sh
|
||||
envsubst < /opt/backup/plan.tpl.py > /opt/backup/plan.py
|
||||
crontab ./crontab && touch /var/log/cron.log && crond && tail -f /var/log/cron.log
|
25
odoo/backups/Dockerfile.c7
Normal file
25
odoo/backups/Dockerfile.c7
Normal file
@ -0,0 +1,25 @@
|
||||
FROM registry.yaltik.net/odoocmd:yaltikc7
|
||||
MAINTAINER Yaltik - Fabien Bourgeois <fabien@yaltik.com>
|
||||
|
||||
ENV ODOO_ADMIN_PASSWORD admin
|
||||
ENV ODOO_DATABASES demo
|
||||
|
||||
WORKDIR /home/odoo
|
||||
USER root
|
||||
|
||||
RUN mkdir backups
|
||||
RUN yum install -y gettext cronie
|
||||
|
||||
# Avoid overlayfs bug with tail
|
||||
VOLUME /var/log
|
||||
|
||||
COPY crontab ./crontab
|
||||
|
||||
COPY backup.template .
|
||||
COPY plan.py .
|
||||
COPY launch.c7.sh launch.sh
|
||||
|
||||
RUN chown -R odoo:odoo .
|
||||
VOLUME /home/odoo/backups
|
||||
|
||||
CMD bash launch.sh
|
23
odoo/backups/launch.c7.sh
Normal file
23
odoo/backups/launch.c7.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -f
|
||||
echo '#!/bin/bash' > /home/odoo/backup.sh
|
||||
index=0
|
||||
IFS=':' read -ra ODOO_HOST <<< "$ODOO_HOST"
|
||||
IFS=':' read -ra ODOO_ADMIN_PASSWORD <<< "$ODOO_ADMIN_PASSWORD"
|
||||
IFS=':' read -ra ODOO_DATABASES <<< "$ODOO_DATABASES"
|
||||
IFS=':' read -ra ODOO_FMT <<< "$ODOO_FMT"
|
||||
IFS=':' read -ra ODOO_ALT <<< "$ODOO_ALT"
|
||||
for host in "${ODOO_HOST[@]}"
|
||||
do
|
||||
HOST=${host}
|
||||
ADMIN_PASSWORD=${ODOO_ADMIN_PASSWORD[$index]}
|
||||
DATABASES=${ODOO_DATABASES[$index]}
|
||||
FMT=${ODOO_FMT[$index]:='zip'}
|
||||
ALT=${ODOO_ALT[$index]:='no'}
|
||||
export HOST ADMIN_PASSWORD DATABASES FMT ALT
|
||||
envsubst < /home/odoo/backup.template >> /home/odoo/backup.sh
|
||||
((index++))
|
||||
done
|
||||
chown odoo:odoo /home/odoo/backup.sh
|
||||
crontab ./crontab && touch /var/log/cron.log && crond && tail -f /var/log/cron.log
|
@ -120,3 +120,9 @@ services:
|
||||
build:
|
||||
context: ./backups
|
||||
image: registry.yaltik.net/odoobackup:yaltik
|
||||
|
||||
odoobackupc7:
|
||||
build:
|
||||
context: ./backups
|
||||
dockerfile: Dockerfile.c7
|
||||
image: registry.yaltik.net/odoobackup:yaltikc7
|
||||
|
Loading…
Reference in New Issue
Block a user