new file: sidecar/Dockerfile
new file: sidecar/Jenkinsfile new file: sidecar/start.sh Added sidecar image to load databases into ramdisk and periodically back them up
This commit is contained in:
parent
055d6e1f84
commit
cacd9ca4c2
26
sidecar/Dockerfile
Normal file
26
sidecar/Dockerfile
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Base on latest (edge) alpine image
|
||||||
|
FROM harbor.ervine.dev/library/x86_64/alpine/alpine-3.11
|
||||||
|
|
||||||
|
MAINTAINER “Jonathan Ervine” <docker@ervine.org>
|
||||||
|
|
||||||
|
# Install updates
|
||||||
|
ENV LANG='en_US.UTF-8' \
|
||||||
|
LANGUAGE='en_US.UTF-8' \
|
||||||
|
TERM='xterm' \
|
||||||
|
VERSION='develop' \
|
||||||
|
WATCHER_USER='mediaservice' \
|
||||||
|
WATCHER_GROUP='mediaservice' \
|
||||||
|
WATCHER_UID='1003' \
|
||||||
|
WATCHER_GID='1003'
|
||||||
|
|
||||||
|
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
|
||||||
|
apk -U update && \
|
||||||
|
apk -U upgrade && \
|
||||||
|
apk -U add nfs-utils e2fsprogs util-linux&& \
|
||||||
|
rm -rf /tmp/src && \
|
||||||
|
rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
COPY start.sh /usr/local/bin/start.sh
|
||||||
|
RUN chmod 755 /usr/local/bin/start.sh
|
||||||
|
|
||||||
|
CMD [ "/usr/local/bin/start.sh" ]
|
||||||
24
sidecar/Jenkinsfile
vendored
Normal file
24
sidecar/Jenkinsfile
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
node("docker-node") {
|
||||||
|
docker.withRegistry('https://harbor.ervine.dev', 'jenkins-to-harbor') {
|
||||||
|
|
||||||
|
git branch: "3.11.3", url: "ssh://git@git.ervine.org:2222/jonny/x86_64-alpine-watcher/sidecar", credentialsId: 'jenkins-to-git'
|
||||||
|
|
||||||
|
sh "git rev-parse HEAD > .git/commit-id"
|
||||||
|
def commit_id = readFile('.git/commit-id').trim()
|
||||||
|
println commit_id
|
||||||
|
|
||||||
|
try {
|
||||||
|
stage "build"
|
||||||
|
def app = docker.build "library/x86_64/alpine/watcher-sidecar"
|
||||||
|
|
||||||
|
stage "publish"
|
||||||
|
app.push("${env.BUILD_NUMBER}")
|
||||||
|
app.push("3.11.3")
|
||||||
|
app.push("latest")
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
currentBuild.result = 'FAILURE'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
sidecar/start.sh
Normal file
23
sidecar/start.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
##
|
||||||
|
## Script to automate the copy of Watcher databases
|
||||||
|
##
|
||||||
|
echo -e 'Starting the sidecar container to periodically backup the sonarr databases'
|
||||||
|
echo -e 'Create the ramdisk file'
|
||||||
|
dd if=/dev/zero of=/ramdisk/image.ext4 count=0 bs=1 seek=400M
|
||||||
|
echo -e 'Create filesystem on ramdisk file'
|
||||||
|
mkfs.ext4 /ramdisk/image.ext4
|
||||||
|
echo -e 'Mount the ramdisk file to /mnt/watcher-ramdisk-mount'
|
||||||
|
mount /ramdisk/image.ext4 /mnt/watcher-ramdisk-mount
|
||||||
|
echo -e 'Copy the config from the remote share to the ramdisk'
|
||||||
|
cp -fvp /watcher-config/*.* /mnt/watcher-ramdisk-mount
|
||||||
|
echo -e 'Set up the filesystem freeze, copy, unfreeze loop'
|
||||||
|
while true; do
|
||||||
|
sleep 890
|
||||||
|
date
|
||||||
|
sync /mnt/watcher-ramdisk-mount/*.*
|
||||||
|
fsfreeze --freeze /mnt/watcher-ramdisk-mount
|
||||||
|
sleep 10
|
||||||
|
cp -fvp /mnt/watcher-ramdisk-mount/*.* /watcher-config/
|
||||||
|
fsfreeze --unfreeze /mnt/watcher-ramdisk-mount
|
||||||
|
done
|
||||||
Loading…
Reference in New Issue
Block a user