diff --git a/Dockerfile b/Dockerfile index 756135d..2f4a06a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,4 @@ FROM plexinc/pms-docker +COPY root / + ENTRYPOINT ["/init"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d2251e5 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,17 @@ +version: '2' + + plex: + image: kilhaasi/pms + container_name: pms + depends_on: + - plexdrv + volumes: + - /Video:/Video:shared + - /Transcode:/Transcode + - /Docker/Plex-Video/plex_cfg:/config + - /root/.rclone.conf:/root/.rclone.conf:RO + environment: + - TZ=DE + - BACKUP=gdrive:/Backup/pms.tar.gz + ports: + - 32400:32400 diff --git a/root/etc/cont-finish.d/99-plex-cfg-backup b/root/etc/cont-finish.d/99-plex-cfg-backup new file mode 100755 index 0000000..b1ca931 --- /dev/null +++ b/root/etc/cont-finish.d/99-plex-cfg-backup @@ -0,0 +1,7 @@ +#!/usr/bin/with-contenv bash +# Creating a backup of plex configuration + +cd /config +tar -cvzf /pms.tar.gz Library + +rclone move /pms.tar.gz $BACKUP --verbose --transfers 4 --checkers 20 --stats 10s diff --git a/root/etc/cont-init.d/.30-plex-cfg.swp b/root/etc/cont-init.d/.30-plex-cfg.swp new file mode 100644 index 0000000..5c2afbc Binary files /dev/null and b/root/etc/cont-init.d/.30-plex-cfg.swp differ diff --git a/root/etc/cont-init.d/30-plex-cfg b/root/etc/cont-init.d/30-plex-cfg new file mode 100755 index 0000000..aa17e72 --- /dev/null +++ b/root/etc/cont-init.d/30-plex-cfg @@ -0,0 +1,15 @@ +#!/usr/bin/with-contenv bash + +# Check, if a configuration directory exists +if [[ -d /config/Library ]] +then + echo "Configuration found, skipping restore of backup" +else + if rclone ls $BACKUP + then + echo "No configuration found, restoring backup..." + rclone copy $BACKUP /plexrestore --verbose --transfers 4 --checkers 20 --stats 10s + cd /config + tar -xvzf /plexrestore/* + fi +fi