Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rclone backend #4

Open
tamalsaha opened this issue Apr 1, 2018 · 6 comments
Open

Add rclone backend #4

tamalsaha opened this issue Apr 1, 2018 · 6 comments

Comments

@tamalsaha
Copy link
Member

https://restic.net/blog/2018-04-01/rclone-backend

@warmfusion
Copy link

I'd like this as the Restic library does not work nicely with our on-prem IBM Cloud Storage (CleverSafe) but we can get the system to work via RClone's implemention of the AWS API. If Stash could use RClone that'd let us bridge backups onto that system nicely.

@tamalsaha
Copy link
Member Author

tamalsaha commented Aug 20, 2019 via email

@apvlv
Copy link

apvlv commented Dec 27, 2019

I also would like to see progress on this. Thank you!

@tamalsaha tamalsaha transferred this issue from stashed/stash Jun 8, 2020
@unixfox
Copy link

unixfox commented Sep 2, 2021

Restic can now work directly with rclone without any need to use a REST API server: https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#other-services-via-rclone

It's just "as simple" as specifying rclone as a repository backend for restic. The amount of changes into stash should be very minimal due to the great integration between restic and rclone.

@hossainemruz
Copy link
Contributor

Thank you @unixfox for letting us know. We are currently working on Stash v1beta2 API. Once the new API is ready, we can add this feature. I have already added this in the feature queue.

@unixfox
Copy link

unixfox commented Feb 15, 2022

For anyone looking for using rclone into stash, it is possible with minor modifications. This will restrict the ability to use REST servers, though.
Basically, you just have to replace rest: by rclone: in https://github.com/stashed/stash/blob/master/vendor/stash.appscode.dev/apimachinery/pkg/restic/setup.go#L308. Then recompile the Docker image of stash with rclone included in it.
You can then modify the default docker image using --set stash-community.operator.registry=yourusername --set stash-community.crdInstaller.registry=stashed when installing stash with helm.

If you don't want to rebuild a Docker image, I maintain these modifications under this Docker image: https://quay.io/repository/unixfox/stash. Use my image with --set stash-community.operator.registry=quay.io/unixfox --set stash-community.crdInstaller.registry=stashed when installing stash with helm.

After that, you can configure your Repository configurations by typing the rclone remote name after url: like:

apiVersion: stash.appscode.com/v1alpha1
kind: Repository
metadata:
  name: rest-repo
  namespace: demo
spec:
  backend:
    rest:
      url: ftp:backup
    storageSecretName: rest-secret

A storage secret name is required before creating a Repository like this, more about that in the docs: https://stash.run/docs/v2021.11.24/guides/latest/backends/rest/

Don't forget to specify how rclone will have to use this remote using the environment variables inside your BackupConfiguration like this example:

apiVersion: stash.appscode.com/v1beta1
kind: BackupConfiguration
metadata:
  name: ss-backup
  namespace: demo
spec:
  repository:
    name: rest-repo
  schedule: "*/5 * * * *"
  target:
    ref:
      apiVersion: apps/v1
      kind: Deployment
      name: stash-demo
    volumeMounts:
    - name: source-data
      mountPath: /source/data
    paths:
    - /source/data
  runtimeSettings:
    container:
      env:
        - name: RCLONE_CONFIG_FTP_TYPE
          value: "ftp"
        - name: RCLONE_CONFIG_FTP_HOST
          value: "1.1.1.1"
        - name: RCLONE_CONFIG_FTP_USER
          value: "username"
        - name: RCLONE_CONFIG_FTP_PASS
          value: "mypass"
  retentionPolicy:
    name: 'keep-last-5'
    keepLast: 5
    prune: true

The environment variable is formed like this: RCLONE_CONFIG_REMOTENAME_PARAMETER. You can find the parameter on the remote type documentation, example for ftp: https://rclone.org/ftp/#standard-options
It's not possible to do it using a rclone config file, as you can't specify what files to mount in the stash sidecar container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants