seedboxsync: switch lftp to rsync

This commit is contained in:
vincent 2022-11-21 19:41:03 +01:00
parent 50935ae052
commit c412854050

View File

@ -22,41 +22,53 @@ job "seedboxsync" {
vault { vault {
policies = ["seedbox"] policies = ["seedbox"]
} }
task "server" { task "rsync" {
driver = "docker" driver = "docker"
service { service {
name = "lftp" name = "seedboxsync"
} }
config { config {
image = "ducampsv/lftp:latest" image = "ducampsv/rsync-docker:latest"
volumes = [ volumes = [
"/mnt/diskstation/media/download:/media" "/mnt/diskstation/media/download:/media",
"local/id_rsa:/home/rsyncuser/.ssh/id_rsa"
] ]
command = "rsync"
args = [ args = [
"-u", "${USERNAME},${PASSWORD}", "--info=progress2",
"-e", "mirror -c -P 5 -x seed ${REMOTE_PATH} /media;quit", "-e" , "ssh -p23 -o StrictHostKeyChecking=no",
"${REMOTE_SERVER}" "-a",
"${USERNAME}@${REMOTE_SERVER}:${REMOTE_PATH}",
"/media",
"--exclude=seed",
"-v"
] ]
} }
env { env {
USER_ID = 1000001 RSYNC_UID = 1000001
GROUP_ID = 1000007 RSYNC_GID = 1000007
} }
template { template {
data = <<EOH data = <<EOH
{{ with secret "secrets/data/nomad/seedbox"}} {{ with secret "secrets/data/nomad/seedbox"}}
USERNAME = "{{ .Data.data.username }}" USERNAME = "{{ .Data.data.username }}"
PASSWORD = "{{ .Data.data.password }}" REMOTE_PATH = "{{ .Data.data.remote_rsync_path }}"
REMOTE_PATH = "{{ .Data.data.remote_path }}"
REMOTE_SERVER = "{{ .Data.data.remote_server }}" REMOTE_SERVER = "{{ .Data.data.remote_server }}"
{{end}} {{end}}
EOH EOH
destination = "secrets/sample.env" destination = "secrets/sample.env"
env = true env = true
} }
template {
data = "{{ with secret \"secrets/data/nomad/seedbox\"}}{{ .Data.data.private_key }}{{end}}"
destination = "local/id_rsa"
uid=1000001
perms= "600"
}
resources { resources {
memory = 100 memory = 500
} }
} }