Serve Discussion

#1

Since I’ve been using the http serve function with great effect of late, and @ncw is looking to widen the scope of the rc command to allow adding a serve server to a running mount I figure now is a good time to explore potential additional serve protocols.

Right now there’s a http, webdav and restic server option.

Additional options:

Just a place for some open discussion about what could be useful.

#2

There is an issue about serve ftp already.

I think sftp should be reasonably straight forward as the go support is very good - fancy making an issue about that?

An s3 server is an interesting idea. I wonder if the minio code can be used as an s3 server…

1 Like
#3

Figured it’s worth exploring some ideas before committing to an issue post hence the forum post.
Exposing a non S3 backend remote as a S3 compatible server is intriguing though, effectively an object store wrapper.

#4

@ncw I’m using serve restic with great interest and success! Nice work on it. However, I’m looking for a way to have the OS choose any open port by giving rclone an address like this:

rclone serve restic --addr localhost:0

This works, but unfortunately I am not sure how to know what the port it ended up using, because the output is literally the input string: Serving restic REST API on http://localhost:0/

It would be useful if it instead output the actual listener.Addr().String().

Can that be done? :slight_smile: Pretty please? :smiley:

(Happy Easter by the way!)

(Edit: I probably should have put this in its own topic, sorry.)

#5

Sounds like a good plan to me. I didn’t realise go did that with a 0 port in fact! Fancy sending a pull request? The docs should have the 0 port documented too.

1 Like
#6

Sure – will try to do that soon! EDIT: PR made. :slight_smile: Thanks. https://github.com/ncw/rclone/pull/2194

2 Likes
#7

Didn’t realise it was mholt :smiley: been using caddy to serve my mount to use the filemanager middleware to offer up an alternative to google drive webui for crypted directories. Works well as an alternative to the http serve option with rclone (especially as currently I can’t enable/disable a serve on a running crypt mount without it).

1 Like
#8

Wonder if there’s any demand for an rclone to rclone connection. Right now I have a HTTP serve rclone running on one box behind basic auth, and rclone mounting it on another.

Is there room for cutting out the middle man and serving up content in a way that suits another rclone instance to connect to it?

#9

You can do this with serve http for read only and serve webdav for read/write. Webdav isn’t the best protocol in the world though… I did have the idea of extending serve http with some extra metadata to make it ideal for an rclone -> rclone connection. It could serve the directory listings as JSON if you sent the right Accept header which could have the hashes etc in. It wouldn’t need a lot of extending! It would also need a way of doing uploads which you’d probably want to make optional.

1 Like