diff --git a/app/Jobs/VolumeCloneJob.php b/app/Jobs/VolumeCloneJob.php new file mode 100644 index 000000000..95ac14197 --- /dev/null +++ b/app/Jobs/VolumeCloneJob.php @@ -0,0 +1,39 @@ +onQueue('high'); + } + + public function handle() + { + try { + instant_remote_process([ + "docker volume create $this->targetVolume", + "docker run --rm -v $this->sourceVolume:/source -v $this->targetVolume:/target alpine sh -c 'cp -a /source/. /target/ && chown -R 1000:1000 /target'", + ], $this->server); + } catch (\Exception $e) { + logger()->error("Failed to copy volume data for {$this->sourceVolume}: ".$e->getMessage()); + throw $e; + } + } +}