Skip to content
Snippets Groups Projects
Commit 550ca694 authored by Pierre Ozoux's avatar Pierre Ozoux
Browse files

Those will be modularized

parent d2654b1c
No related branches found
No related tags found
No related merge requests found
[Unit]
Description=Back up data from %i
[Service]
Type=oneshot
TimeoutStartSec=3000
WorkingDirectory=/data/domains/%i/
EnvironmentFile=/etc/environment
ExecStartPre=-/bin/docker kill clean-%i
ExecStartPre=-/bin/docker rm clean-%i
ExecStartPre=-/bin/docker kill backup-%i
ExecStartPre=-/bin/docker rm backup-%i
ExecStartPre=/bin/bash -euxc ' \
/bin/docker run \
--rm \
--name clean-%i \
-e PASSPHRASE \
-v /root:/root \
indiepaas/duplicity \
remove-older-than 10D \
sftp://${BACKUP_DESTINATION}//data/%i'
ExecStartPre=/bin/bash -euxc '/data/domains/%i/BACKUP'
ExecStart=/bin/bash -euxc ' \
/bin/docker run \
--rm \
--name backup-%i \
-e PASSPHRASE \
-h backup.container \
--cpu-shares=40 \
-v /dev/random:/dev/random \
-v /dev/urandom:/dev/urandom \
-v /root:/root \
-v /data/domains/%i:/backup indiepaas/duplicity \
--volsize 500 \
--full-if-older-than 7D \
--asynchronous-upload \
--encrypt-key ${ENCRYPT_KEY} \
/backup \
sftp://${BACKUP_DESTINATION}//data/%i'
[Unit]
Description=Hourly backup of www and mysql content.
# Dependency binding
BindsTo=u@%i.service
[Timer]
OnActiveSec=20
OnUnitActiveSec=60min
AccuracySec=50min
[Unit]
Description=Git pull on every git repo
[Service]
Type=oneshot
TimeoutStartSec=0
ExecStart=/bin/bash -euxc ' \
for directory in `find /data/domains/ -mindepth 3 -name .git -type d -prune -not -path "*/owncloud/data/*"`;do \
cd $directory; cd ..;\
git pull; \
done'
[Unit]
Description=Git pull every 5 minutes
[Timer]
OnBootSec=5min
OnUnitActiveSec=5min
[Install]
WantedBy=multi-user.target
[Unit]
Description=%p-%i
# Requirements
Requires=docker.service
# Dependency ordering
After=docker.service
[Service]
Restart=always
RestartSec=10
TimeoutStartSec=60
TimeoutStopSec=15
WorkingDirectory=/media/diskb/backup/
ExecStartPre=-/opt/bin/docker-compose rm -f
ExecStart=/opt/bin/docker-compose up
ExecStop=/opt/bin/docker-compose stop
[Install]
WantedBy=multi-user.target
......@@ -3,11 +3,9 @@ Description=%p-%i
# Requirements
Requires=docker.service
Requires=b-u@%i.timer
# Dependency ordering
After=docker.service
Before=b-u@%i.timer
[Service]
Restart=always
......@@ -21,4 +19,3 @@ ExecStop=/opt/bin/docker-compose stop
[Install]
WantedBy=multi-user.target
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment