From ba74d60a9c38ff0f38a449263b7a6dfbe53083d7 Mon Sep 17 00:00:00 2001 From: Scott Wallace Date: Sun, 20 Oct 2019 10:13:56 +0100 Subject: [PATCH] Move Cloudplow to Docker --- .../media_server/files/cloudplow.service | 17 ----- .../media_server/files/cloudplow_config.json | 61 ---------------- .../media_server/files/docker-compose.yaml | 15 ++++ .ansible/roles/media_server/tasks/main.yaml | 69 +------------------ 4 files changed, 17 insertions(+), 145 deletions(-) delete mode 100644 .ansible/roles/media_server/files/cloudplow.service delete mode 100644 .ansible/roles/media_server/files/cloudplow_config.json diff --git a/.ansible/roles/media_server/files/cloudplow.service b/.ansible/roles/media_server/files/cloudplow.service deleted file mode 100644 index bf98758..0000000 --- a/.ansible/roles/media_server/files/cloudplow.service +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=cloudplow -After=mnt-media.mount -Requires=mnt-media.mount - -[Service] -User=media -Group=media -Type=simple -WorkingDirectory=/srv/app/cloudplow/ -ExecStart=/srv/app/cloudplow/.venv/bin/python3 /srv/app/cloudplow/cloudplow.py run --loglevel=INFO -ExecStopPost=/bin/rm -rf /srv/app/cloudplow/locks -Restart=always -RestartSec=10 - -[Install] -WantedBy=default.target diff --git a/.ansible/roles/media_server/files/cloudplow_config.json b/.ansible/roles/media_server/files/cloudplow_config.json deleted file mode 100644 index 214a75b..0000000 --- a/.ansible/roles/media_server/files/cloudplow_config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "core": { - "dry_run": false, - "rclone_binary_path": "/usr/bin/rclone", - "rclone_config_path": "/srv/etc/rclone/rclone.conf" - }, - "hidden": { - "/mnt/.media.cache/.unionfs": { - "hidden_remotes": [ - "google" - ] - } - }, - "notifications": {}, - "remotes": { - "google": { - "hidden_remote": "GoogleDriveCrypt:", - "rclone_command": "move", - "rclone_excludes": [ - "**partial~", - "**_HIDDEN~", - ".unionfs/**" - ], - "rclone_extras": { - "--bwlimit": "23:00,off 07:00,1M", - "--checkers": 16, - "--drive-chunk-size": "64M", - "--skip-links": null, - "--stats": "60s", - "--transfers": 4, - "--verbose": 1 - }, - "rclone_sleeps": { - "Failed to copy: googleapi: Error 403: User rate limit exceeded": { - "count": 5, - "sleep": 25, - "timeout": 3600 - } - }, - "remove_empty_dir_depth": 2, - "sync_remote": "GoogleDriveCrypt:", - "upload_folder": "/mnt/.media.cache", - "upload_remote": "GoogleDriveCloudplowUpload:" - } - }, - "syncer": {}, - "uploader": { - "google": { - "check_interval": 1, - "exclude_open_files": true, - "max_size_gb": 10, - "opened_excludes": [], - "schedule": { - "allowed_from": "04:00", - "allowed_until": "08:00", - "enabled": false - }, - "size_excludes": [] - } - } -} diff --git a/.ansible/roles/media_server/files/docker-compose.yaml b/.ansible/roles/media_server/files/docker-compose.yaml index dd80bad..9f64b71 100644 --- a/.ansible/roles/media_server/files/docker-compose.yaml +++ b/.ansible/roles/media_server/files/docker-compose.yaml @@ -99,3 +99,18 @@ services: ports: - 8989:8989 restart: unless-stopped + + cloudplow: + image: sabrsorensen/alpine-cloudplow + container_name: cloudplow + environment: + - PUID=1003 + - PGID=1003 + - TZ=Europe/London + - UMASK_SET=022 + volumes: + - /srv/app/docker/mediaserver/config/cloudplow:/config:rw + - /srv/etc/rclone:/config/rclone:rw + - /mnt/.media.cache:/data/imported_media:rw + - /etc/localtime:/etc/localtime:ro + restart: unless-stopped diff --git a/.ansible/roles/media_server/tasks/main.yaml b/.ansible/roles/media_server/tasks/main.yaml index 2316277..1dde580 100644 --- a/.ansible/roles/media_server/tasks/main.yaml +++ b/.ansible/roles/media_server/tasks/main.yaml @@ -5,7 +5,7 @@ - name: "Media Server: Group" tags: - install - - cloudplow + - docker group: name: "media" become: yes @@ -13,7 +13,7 @@ - name: "Media Server: User" tags: - install - - cloudplow + - docker user: name: "media" group: "media" @@ -21,71 +21,6 @@ expires: -1 become: yes - - name: "Media Server: Cloudplow: git repo" - tags: - - install - - cloudplow - git: - repo: "https://github.com/l3uddz/cloudplow.git" - dest: "/srv/app/cloudplow" - become: yes - - - name: "Media Server: Cloudplow: directory permissions" - tags: - - install - - cloudplow - file: - path: "/srv/app/cloudplow" - state: directory - mode: "u+w" - owner: "media" - group: "media" - recurse: yes - become: yes - - - name: "Media Server: Cloudplow: config" - tags: - - config - - cloudplow - copy: - src: "files/cloudplow_config.json" - dest: "/srv/app/cloudplow/config.json" - mode: "0600" - owner: "media" - group: "media" - become: yes - - - name: "Media Server: Cloudplow: Python dependencies" - tags: - - install - - cloudplow - pip: - requirements: "/srv/app/cloudplow/requirements.txt" - virtualenv: "/srv/app/cloudplow/.venv" - virtualenv_python: python3 - become: yes - - - name: "Media Server: Cloudplow: service config" - tags: - - install - - cloudplow - copy: - dest: "/etc/systemd/system/cloudplow.service" - src: "files/cloudplow.service" - mode: "0644" - become: yes - - - name: "Media Server: Cloudplow: service" - tags: - - config - - cloudplow - systemd: - name: "cloudplow" - state: started - enabled: yes - daemon_reload: yes - become: yes - - name: "Media Server: Docker: packages" tags: - install