Rclone Azure Blob

From Irregularpedia
Jump to navigation Jump to search

Rlcone

Set up Azure storage account with all defaults. Then follow the image to get the SAS key.

Install “rclone” - For unix-based systems run, curl https://rclone.org/install.sh | sudo bash, in the terminal. - For Windows-based systems goto, https://rclone.org/downloads/, to download the installation file.

Mounting in linux

Follow directions from the link; https://rclone.org/azureblob/. or reference this video 1. rclone config 2. Chose the following options; 1. n - for new remote 2. 30 - for Azure Blob 3. use defaults till you reach sas_url then copy the sas_url for your container. 1. note - you much create the sas_url from the container NOT the account, also make sure you give the right permissions. 2. Example sas_url: https://storeage.blob.core./cloud?sp=racwdlmeop&st=2023-07-03T12:41:58Z&se=2027-07-03T20:41:58Z&spr=keyofsomesort 4. use defaults to the end and quit the config. You see something like this below; ``bash Configuration complete. Options: - type: azureblob - account: storage - sas_url: “thesasurl” Keep this “sas” remote? y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d>

    Current remotes:
    
    Name                 Type
    ====                 ====
    sas                  azureblob
    
    e) Edit existing remote
    n) New remote
    d) Delete remote
    r) Rename remote
    c) Copy remote
    s) Set configuration password
    q) Quit config
    e/n/d/r/c/s/q> q
    </code>`<code>
  1. Next, you need to decide how you want to connect;
    1. Syncing sync a target directory at the moment. You will need to set a cron job to back and sync regularly. Here is the connection string; rclone sync /home/drok/blob sas:cloud/test rclone sync /target directory “remote name”:“container name”/“directory in container”. You must have it like this for it to work.
    2. Mounting is similar to sync, but the service stays connected. Here is the connection string; ‘rclone mount –allow-non-empty sas:teleportcloud/test /home/drok/blob/’. Running the command like this in the terminal will remain active. You will need to run this in the background as a service.
      1. To run on boot, create a system file. Start with a simple script, nano rclone_blobmount.sh;

      <syntaxhighlight lang="bash">#!/bin/bash rclone mount --allow-non-empty --daemon sas:teleportcloud/test /home/drok/blob/</syntaxhighlight>

       Run </code>chmod +x rclone_blobmount.sh` to make it executable.
      1. Create a systemd file sudo nano /etc/systemd/system/blobmount.service;

      <syntaxhighlight lang="bash">[Unit] Description=rclone blobstorage mount After=network.target After=systemd-user-sessions.service After=network-online.target

      [Service] User=drok Type=forking ExecStart=/home/drok/rclone_blobmount.sh TimeoutSec=30 Restart=on-failure RestartSec=30 StartLimitInterval=350 StartLimitBurst=10

      [Install] Alias=blobmount.service WantedBy=multi-user.target</syntaxhighlight>

      1. Restart systemd daemon; sudo systemctl daemon-reload
      2. Run the service; sudo systemctl start blobmount.service
      3. Enable on boot; sudo systemctl enable blobmount.service