Coder Social home page Coder Social logo

Comments (6)

chiefrocker86 avatar chiefrocker86 commented on September 21, 2024 1

I’ll give it a try, but I’ve never used go, so don’t put too much hopes in my attempts ;-).

I’m currently busy but when I got a minute I’ll give it a shot.

from rclone.

ncw avatar ncw commented on September 21, 2024

Do you want to make a patch for this? We don't currently have maintainer for the docker plugin.

from rclone.

jonasgeiler avatar jonasgeiler commented on September 21, 2024

I have recently set up the rclone docker volume plugin for docker in rootless-mode using a custom systemd service (basically the systemd setup as described in the docs, but with adjusted paths) instead of the docker plugin install command. Works without problems so far.

Here are the basic steps:

  1. Create ~/.config/systemd/user/docker-volume-rclone.service:
    [Unit]
    Description=Docker Volume Plugin for rclone (Rootless)
    Before=docker.service
    After=network.target docker-volume-rclone.socket
    Requires=docker-volume-rclone.socket docker.service
    
    [Service]
    ExecStart=/usr/bin/rclone serve docker \
      --base-dir $HOME/.local/share/docker-volumes/rclone \
      --socket-addr $XDG_RUNTIME_DIR/docker/plugins/rclone.sock
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-volumes/rclone
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-plugins/rclone/config
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-plugins/rclone/cache
    Environment=RCLONE_CONFIG=$HOME/.local/share/docker-plugins/rclone/config/rclone.conf
    Environment=RCLONE_CACHE_DIR=$HOME/.local/share/docker-plugins/rclone/cache
    Environment=RCLONE_VERBOSE=1
    
    [Install]
    WantedBy=default.target
    
  2. Create ~/.config/systemd/user/docker-volume-rclone.socket:
    [Unit]
    Description=Docker Volume Plugin for rclone (Rootless)
    
    [Socket]
    ListenStream=$XDG_RUNTIME_DIR/docker/plugins/rclone.sock
    
    [Install]
    WantedBy=sockets.target
    
  3. Reload system units with systemctl --user daemon-reload
  4. Start the rclone volume plugin with systemctl --user start docker-volume-rclone.socket && systemctl --user start docker-volume-rclone.service

Important

You should replace the environment variables ($HOME, $XDG_RUNTIME_DIR, etc.) with their respective values in the systemd file. It don't think systemd will replace them itself.
So pretty much replace $HOME with /home/<username> and $XDG_RUNTIME_DIR with /run/user/<uid>

Let me know if you have problems setting this up and I'll try to help!

from rclone.

srfsh avatar srfsh commented on September 21, 2024

I have recently set up the rclone docker volume plugin for docker in rootless-mode using a custom systemd service (basically the systemd setup as described in the docs, but with adjusted paths) instead of the docker plugin install command. Works without problems so far.

Here are the basic steps:

  1. Create ~/.config/systemd/user/docker-volume-rclone.service:
    [Unit]
    Description=Docker Volume Plugin for rclone (Rootless)
    Before=docker.service
    After=network.target docker-volume-rclone.socket
    Requires=docker-volume-rclone.socket docker.service
    
    [Service]
    ExecStart=/usr/bin/rclone serve docker \
      --base-dir $HOME/.local/share/docker-volumes/rclone \
      --socket-addr $XDG_RUNTIME_DIR/docker/plugins/rclone.sock
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-volumes/rclone
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-plugins/rclone/config
    ExecStartPre=/usr/bin/mkdir -p $HOME/.local/share/docker-plugins/rclone/cache
    Environment=RCLONE_CONFIG=$HOME/.local/share/docker-plugins/rclone/config/rclone.conf
    Environment=RCLONE_CACHE_DIR=$HOME/.local/share/docker-plugins/rclone/cache
    Environment=RCLONE_VERBOSE=1
    
    [Install]
    WantedBy=default.target
    
  2. Create ~/.config/systemd/user/docker-volume-rclone.socket:
    [Unit]
    Description=Docker Volume Plugin for rclone (Rootless)
    
    [Socket]
    ListenStream=$XDG_RUNTIME_DIR/docker/plugins/rclone.sock
    
    [Install]
    WantedBy=sockets.target
    
  3. Reload system units with systemctl --user daemon-reload
  4. Start the rclone volume plugin with systemctl --user start docker-volume-rclone.socket && systemctl --user start docker-volume-rclone.service

Important

You should replace the environment variables ($HOME, $XDG_RUNTIME_DIR, etc.) with their respective values in the systemd file. It don't think systemd will replace them itself. So pretty much replace $HOME with /home/<username> and $XDG_RUNTIME_DIR with /run/user/<uid>

Let me know if you have problems setting this up and I'll try to help!

Hi,

I may have appeared out of the blue, but I would really like some helping hand. I am not using a systemd-based distro (alpine), but as far as I could understand, this does not really involve anything related to systemd. Could you describe exactly how you utilize this setup with examples using a mount from rclone?

Thanks a lot!

from rclone.

jonasgeiler avatar jonasgeiler commented on September 21, 2024

@srfsh wrote:
I may have appeared out of the blue, but I would really like some helping hand. I am not using a systemd-based distro (alpine), but as far as I could understand, this does not really involve anything related to systemd. Could you describe exactly how you utilize this setup with examples using a mount from rclone?

I'm not sure I can help in this case since I've never used anything other than systemd. Does your distro use some other service manager? You basically need a service which runs the rclone serve docker command in the background and handles the socket file and other prerequisites like env vars, folders, and startup order.

from rclone.

srfsh avatar srfsh commented on September 21, 2024

@srfsh wrote:
I may have appeared out of the blue, but I would really like some helping hand. I am not using a systemd-based distro (alpine), but as far as I could understand, this does not really involve anything related to systemd. Could you describe exactly how you utilize this setup with examples using a mount from rclone?

I'm not sure I can help in this case since I've never used anything other than systemd. Does your distro use some other service manager? You basically need a service which runs the rclone serve docker command in the background and handles the socket file and other prerequisites like env vars, folders, and startup order.

I thought maybe you had some other hidden (as in forgotten) commands that you used to bind things together.

But I have good news. You don't need to bother with this at all. Here is what you have to do:

  1. Define where you'll put your rclone config and the cache directories. $HOME/.local/share/docker-plugins seems to be a nice place in terms of mimicking /var/lib/docker and /var/lib/docker-plugins. The config directory must have a single file called rclone.conf. I am not sure about the very purpose of the cache directory. Seems to hold a single file with a dummy content. Maybe if I tweak with vfs, it would be populated. Yet to experiment.
  2. Create the directories. I choose the $HOME/.local/share/docker/rclone since I didn't want to have an extra docker-plugins directory, which I won't be using either way, laying around. For instance: mkdir -p .local/share/docker/rclone/config .local/share/docker/rclone/cache.
  3. Place your rclone.conf file under the config directory you've just created.
  4. Make sure your rootless dockerd is running. Uninstall the rclone plugin if you had installed it previously. Then install it again with: docker plugin install --alias rclone --disable --grant-all-permissions rclone/docker-volume-rclone:amd64. With this, we are essentially not enabling it just for the time being, to let us configure it.
  5. Set your desired config and cache directories. This step is the essential part where it makes it possible to use the plugin with rootless dockerd: docker plugin set rclone "config=$HOME/.local/share/docker/rclone/config/" "cache=$HOME/.local/share/docker/rclone/cache/". Again, the paths could be tweaked as your heart desires. The most important one is the config, which holds our rclone.conf file.
  6. Enable the plugin and enjoy your free time: docker plugin enable rclone.
  7. (Optional) Create a volume using the aliased driver name rclone: docker volume create mygdrive -d rclone -o remote=gdrive:.
  8. (Optional) Enjoy it even more using Alpine: docker run --rm -it -v mygdrive:/hellofromgdrive alpine ls /hellofromgdrive

I hope that helps. I have only tested it on Alpine v3.20.3 (the latest as of writing).

from rclone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.