Rent your Synology drive using Storjshare with Docker

Time ago, I installed the drive share tool from the blockchain based storj cloud service on my Synology NAS. Therefore I used the community package “debian chroot” to install the storj share (beta) software. Since this, the Storjshare-CLI went through many releases. With debian chroot, the installation was annoying. That was why I decided to use a Docker container to install the recent CLI.

For this installation, you should be able to:

  • connect to your NAS with ssh
  • forwarding ports in your router
  • and you have to be admin of your NAS

 

Prepare your Synology NAS

Docker Synology Package

First of all, install a the Docker package in your Synology Package Manager and start them after the installation.

Now, create a folder in one of your volumes named storj (e.g. /volume1/storj/). I recommend you to disable the recycling function, because it would be filled of deleted shared data. Create in that folder an other one named data (e.g. /volume1/storj/data/) and change the permissions for execution.

cd /volume1
mkdir storj
mkdir storj/data
chmod -R 777 storj

For the Storj-Deamon, you have to forward the (tcp) ports 4000 to 4004 to your NAS server. Configurate your router for the forwarding.

Install the storjshare daemon CLI

Now, login to your Synology NAS with ssh. Therefore use PuTTY or a terminal. Download the Docker iso oreandawe/storjshare-cli with the following command:

sudo docker pull oreandawe/storjshare-cli:latest

After the pulling, you could check de versions of the package parts with:

sudo docker run --rm -ti --entrypoint /versions oreandawe/storjshare-cli

The next step is to compile the Docker iso to a background running container. For that use the following command:

sudo docker run -d --name storj -ti --entrypoint /bin/sh oreandawe/storjshare-cli
# Description of the used "run" options
# -d			: run container in background
# name			: name your container
# --entrypoint	: overwrite the default ENTRYPOINT of the image
# -ti			: (nowhere found. Perhaps you do -> comment please πŸ˜‰ )

Now, go to the Docker app in the Synology DSM interface and stop the container “storj”.

As soon as the container is stopped, you can edit them. Now, setup the ports 4000 to 4004 for the local port and the container port (tcp). In th volume options add the directory you created before (e.g. volume1/storj/) and mount this as /storj/.

Your setting should now look like in the picture above and you can start the container again.

Go back to your terminal and create a new node with the command:

sudo docker exec storj storjshare create --storj <addr> --storage /storj/data --size <maxsize> --rpcport 4000 --maxtunnels 4 --tunnelportmin 4001 --tunnelportmax 4004 --logdir /storj/[nodeid]_date.log --outfile /storj/config.json --noedit
#--storj <addr>             : specify the ERC20 compatible ETH wallet address (required)
#--storage <path>          : specify the storage path
#--size <maxsize>          : specify share size (ex: 10GB, 1TB)
#--rpcport <port>          : specify the rpc port number
#--rpcaddress <addr>       : specify the rpc address
#--maxtunnels <tunnels>    : specify the max tunnels
#--tunnelportmin <port>    : specify min gateway port
#--tunnelportmax <port>    : specify max gateway port
#--logdir <path>           : specify the log directory
#--noedit                  : do not open generated config in editor
#--outfile <writepath> 	   : write config to path

Fill the “<..>” with your content. (but leave the “[nodeid]” in peace) There is now a config.json file created in your directory. You can change these settings whenever you want. (Descriptons at docs.Storj.io or at Github)

Start the daemon

To start the storjshare, you have to start the daemon first. Do this with:

sudo docker exec storj storjshare daemon

Finally, you can start your storjshare node with the settings saved in your config.json file:

sudo docker exec storj storjshare start --config /storj/config.json

Check the running state from your node with the command:

sudo docker exec storj storjshare status

The output of that should look like:

If there are any problems, write a comment or ask the community on community.storj.io.

Autostart your Storjshare Node

If you start restart your Synology NAS in spite of an update or something else, the Storjshare Node will not. To solve this problem, you can write a start script and install it in the system-settings of your NAS. Therefore, use the text editor of your choice and write the following content to a file named startup_storjshare.sh and save it on your NAS (e.g. /volume1/storj/startup_storjshare.sh ).

#!/bin/bash
sleep 15
sudo docker exec storj storjshare daemon
sudo docker exec storj storjshare start --config /storj/config.json
startup_storjshare.sh

Important: Make this file executable with chmod +x startup_storjshare.sh

Install the file on your Synology NAS under “Task Scheduler” -> “Create Triggered Task” -> “User Defined Script”. Under the “General tab” write your task’s name (e.g. Storj Startup) and choose the event “Boot-up”. Finally, write the path to your startup script into the “User-defined script” box under the “Task Settings” tab. Now, your share-drive is ready for action.

If there are any questions or additions, please write a comment. I would be very grateful. =D

Upgrade the container to a new release

You can check the status of your node for free atΒ https://storjstat.com/Β . If you get following state, you have to upgrade your node.

For that, put following commands into your ssh terminal to stop the container, pulling the latest version, removing the old container and to compile the latest iso as same as the old container:

 

sudo docker stop storj
sudo docker pull oreandawe/storjshare-cli:latest
sudo docker rm storj
sudo docker run -d --name storj -ti --entrypoint /bin/sh oreandawe/storjshare-cli

After this, configure the path and ports for the container with the Synology Docker App as written above. Finally, start your container with your old config-file and check if the node is running: (be patient: the node needs a while to reactivate your shards πŸ˜‰ )

sudo docker exec storj storjshare daemon
sudo docker exec storj storjshare start --config /storj/config.json
sudo docker exec storj storjshare status

17 Replies to “Rent your Synology drive using Storjshare with Docker”

    1. Yes, during the beta I made. But since then, I did not run it anymore.. until last weak πŸ˜‰
      Now, the network seems underloaded. There are barely shared data to receive.
      In the community, they are talking about a new release in the next 4 month that should bring new live to the Storjservice. (https://community.storj.io)

      I installed it on my DS916+ and the regular cpu usage from the container is 0.38% and it uses 176MB of RAM.

      Thanks for your comment!

  1. Thanks for your work, I have it working now, two things i had to do

    –sjcx now must be replaced by –storj

    before start node, manually create /storj/data/ folder and assign permissions (777)

  2. Thanks for your info, very helpfull.
    About last step and creating user defined script, I have DSM 5.5 and there is no such option to run script in boot up. And also in startup script I used:
    docker exec storj storjshare daemon
    docker exec storj storjshare start –config /storj/config.json
    And then finally script started to to work.

    1. Sorry I have DSM 5.2. Most probably to run script in boot up must again use putty, ssh and command lines.

    1. That’s a pity.. There is another way with debian chroot but it I am not sure that your RS816 is strong enough for storjshare..

    1. I think yes, it does. The user must be a root-user but I did not test this.
      Did you try it with an user with other permissions?

  3. Hello !
    As the Docker repository is regularly set up to date i wrote this script to to update the docker image and run storjshare automatically with the very last version each time the syno restarts :

    sleep 1m
    #Because without, it won't work
    sudo docker container rm -f storj
    sudo docker pull oreandawe/storjshare-cli:latest
    #For the case where you use the TCP 4000 port and /volume1/storj directory
    sudo docker run -ti -d -v /volume1/storj:/storj/ -w /storj/ -p 4000:4000 --name storj --entrypoint /bin/sh oreandawe/storjshare-cli
    sudo docker exec storj storjshare daemon
    sudo docker exec storj storjshare start --config /storj/config.json
  4. First, thanks for the great tutorial!

    I have a problem though, I followed each step carefully and I added some port forwarding rule on my router… The storj daemon is up and running but no data is being shared:

    β”‚ Share β”‚ Status β”‚ Uptime β”‚ Restarts β”‚ Peers β”‚ Allocs β”‚ Delta β”‚ Port β”‚ Shared β”‚ Bridges β”‚
    β”‚ ae*** β”‚ running β”‚ 7h 33m … β”‚ 0 β”‚ 47 β”‚ 0 β”‚ 6ms β”‚ 4000 β”‚ … β”‚ connected β”‚

    Any idea?

    1. Thank you!
      Did you still get no shared data? It is normal that it takes a long time for the first data to arrive. It also depends on the characteristics of your server, how fast it can react, how your configurations match the requested storage types and how much data is currently being uploaded by other users.
      However, if you still haven’t received any shared data, you can check your log files on https://ssdynamite.com/ So you will find misconfigurations relatively quickly.

  5. Is it possible to upgrade nodejs to latest LTS release?
    Today it’s “node -v” = v6.7.0
    Latest LTS = v8.10.0

    1. Hi Robin,
      The used version of NodeJS is defined in the docker-image from gliderlabs/alpine:3.4. You may be able to install the new version in the container. However, this would be reset during an image update. I don’t recommend it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.