From c2baacc0a4598abb945aae63a1fc6d045b98bf20 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 13 May 2022 16:08:52 +0100 Subject: [PATCH 1/3] union: fix uploading files to union of all bucket based remotes Before this fix, if uploading to a union consisting of all bucket based remotes (eg s3), uploads failed with: Failed to copy: object not found This was because the union backend was relying on parent directories being created to work out which files to upload. If all the upstreams were bucket based backends which can't hold empty directories, no directories were created and the upload failed. This fixes the problem by returning the upstreams used when creating the directory for the upload, rather than searching for them again after they've been created. This will also make the union backend a little more efficient. Fixes #6170 --- backend/union/union.go | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/backend/union/union.go b/backend/union/union.go index 46c697a64..ed17cd020 100644 --- a/backend/union/union.go +++ b/backend/union/union.go @@ -141,22 +141,20 @@ func (f *Fs) Hashes() hash.Set { return f.hashSet } -// Mkdir makes the root directory of the Fs object -func (f *Fs) Mkdir(ctx context.Context, dir string) error { +// mkdir makes the directory passed in and returns the upstreams used +func (f *Fs) mkdir(ctx context.Context, dir string) ([]*upstream.Fs, error) { upstreams, err := f.create(ctx, dir) if err == fs.ErrorObjectNotFound { - if dir != parentDir(dir) { - if err := f.Mkdir(ctx, parentDir(dir)); err != nil { - return err - } - upstreams, err = f.create(ctx, dir) + parent := parentDir(dir) + if dir != parent { + upstreams, err = f.mkdir(ctx, parent) } else if dir == "" { // If root dirs not created then create them upstreams, err = f.upstreams, nil } } if err != nil { - return err + return nil, err } errs := Errors(make([]error, len(upstreams))) multithread(len(upstreams), func(i int) { @@ -165,7 +163,17 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error { errs[i] = fmt.Errorf("%s: %w", upstreams[i].Name(), err) } }) - return errs.Err() + err = errs.Err() + if err != nil { + return nil, err + } + return upstreams, nil +} + +// Mkdir makes the root directory of the Fs object +func (f *Fs) Mkdir(ctx context.Context, dir string) error { + _, err := f.mkdir(ctx, dir) + return err } // Purge all files in the directory @@ -449,10 +457,7 @@ func (f *Fs) put(ctx context.Context, in io.Reader, src fs.ObjectInfo, stream bo srcPath := src.Remote() upstreams, err := f.create(ctx, srcPath) if err == fs.ErrorObjectNotFound { - if err := f.Mkdir(ctx, parentDir(srcPath)); err != nil { - return nil, err - } - upstreams, err = f.create(ctx, srcPath) + upstreams, err = f.mkdir(ctx, parentDir(srcPath)) } if err != nil { return nil, err From a34276e9b32a78647cc027002dad9f29ff4ec4da Mon Sep 17 00:00:00 2001 From: Alex JOST <25005220+dimejo@users.noreply.github.com> Date: Tue, 17 May 2022 15:24:32 +0200 Subject: [PATCH 2/3] s3: Add Warsaw location for Scaleway Add new location in Warsaw (Poland) to endpoints for Scaleway. More Information: https://blog.scaleway.com/scaleway-is-now-in-warsaw/ https://www.scaleway.com/en/docs/storage/object/how-to/create-a-bucket/ --- backend/s3/s3.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 2f72435ac..ea04ed653 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -301,6 +301,9 @@ func init() { }, { Value: "fr-par", Help: "Paris, France", + }, { + Value: "pl-waw", + Help: "Warsaw, Poland", }}, }, { Name: "region", @@ -715,6 +718,9 @@ func init() { }, { Value: "s3.fr-par.scw.cloud", Help: "Paris Endpoint", + }, { + Value: "s3.pl-waw.scw.cloud", + Help: "Warsaw Endpoint", }}, }, { Name: "endpoint", From 3ec25f437b3fe5dcc68b6b17b079752b8364b729 Mon Sep 17 00:00:00 2001 From: SimonLiu Date: Thu, 19 May 2022 19:59:53 +0800 Subject: [PATCH 3/3] Update remote_setup.md Add another option (utilizing SSH Tunnel) for Linux/macOs users to complete the auth on headless box. --- docs/content/remote_setup.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/content/remote_setup.md b/docs/content/remote_setup.md index 2cc9f3af7..b6d81c1b0 100644 --- a/docs/content/remote_setup.md +++ b/docs/content/remote_setup.md @@ -92,3 +92,24 @@ Configuration file is stored at: Now transfer it to the remote box (scp, cut paste, ftp, sftp, etc.) and place it in the correct place (use `rclone config file` on the remote box to find out where). + +## Configuring using SSH Tunnel ## + +Linux and MacOS users can utilize SSH Tunnel to redirect the headless box port 53682 to local machine by using the following command: +``` +ssh -L localhost:53682:localhost:53682 username@remote_server +``` +Then on the headless box run `rclone` config and answer `Y` to the `Use +auto config?` question. + +``` +... +Remote config +Use auto config? + * Say Y if not sure + * Say N if you are working on a remote or headless machine +y) Yes (default) +n) No +y/n> y +``` +Then copy and paste the auth url `http://127.0.0.1:53682/auth?state=xxxxxxxxxxxx` to the browser on your local machine, complete the auth and it is done.