toumbot

Posted on Mar 15, 2022Read on Mirror.xyz

Running a Starknet node on a Synology DS218 NAS

The only computer I have is an old MacBook Pro. I wanted to try running a Starknet node on a server which is always on and the best thing I found to answer my requirement was my Synology DS128 NAS. Here is how I managed to run a Starknet node on it, using Docker and an Ubuntu image.

Since I am not very familiar with those technologies (it was actually my first time using Docker), there are probably better / more optimized ways to do this.

A big thanks to Dzupp for the initial tutorial (link at the end of this doc).

Document versions

- March 13th 2022 - V1.0 - First draft
- March 15th 2022 - V1.1 - Fixing typos

Setting up Docker

The first thing we need to do is installing the Docker app on the NAS. Docker will help us run a version of Ubuntu which will run the node.

First we need to go to the admin center of the NAS, using a browser and typing :5000 in the address bar.

Note: if you do not know / forgot the IP address of the NAS, I found this website that helped me find it: find.synology.com/#

In the package center, simply search for the Docker package and click on the Install button.

DS218 Package Center with Docker installed

To run the node I decided to use the Linux distribution Ubuntu. Open Docker, go to Registry and search for “ubuntu”. Right click on it and choose “Download this image”.

Ubuntu image download

In the Image section, you will see the ubuntu image that has been downloaded (no need to pay attention to the the “unbuntu-starknet” image for now, it has been created later in the process).

Select the ubuntu image and click on Launch. Docker will then guide you into the process of creating and executing the container, which can be seen like a running instance of the ubuntu image. As I am not very familiar with Docker I simply used the default options, that seemed to do the trick.

Select the ubuntu image and click on "Launch"

Enter the container name and click on Next.

To avoid any surprises and limit the resource impact the container could have on the NAS I guess we could enable resource limitation. For now I did not.

Leave all settings by default

Selecting “Run this container after the wizard is finished” will launch the container immediately when clicking on Apply. Otherwise, the container will only be created but not Launched. If you want to access the container using your MacOS terminal and not Docker through the Synology web page, do not tick the box (we will launch the container by login in to the NAS using SSH, then launch the container using command lines also directly in the terminal).

Click on Apply to finalize the container creation

In the Container section, you can now see the container that was just created. If you selected the “Run this container after the wizard is finished” tick box, then the Container should already be running.

It is actually possible to run the whole installation of the node (and all the required components like Python, Rust, etc…) in a terminal inside the Docker app of the Synology admin / web page. For this you can double click on the container and go to the Terminal tab (the screenshot below is buggy but it should work).

Buggy screenshot but otherwise the terminal should show up and allow you to enter commands.

Since I found it very slow, buggy and not easy to use I preferred logging into the container using directly the Terminal of MacOS. In order to do so you first need to activate SSH on the NAS.

(Optional) - Log into the container using the MacOS Terminal

Activating SSH on the NAS

First we need to allow SSH connections on the NAS. Open the control panel and click on Terminal & SNMP

Synology control panel

Click on Enable SSH service, then Apply.

Activating SSH on the NAS

SSH is now activated on the NAS. Starting from here we should be able to run everything from the MacOS Terminal directly.

Accessing the container using the MacOS Terminal

First, we need to login to our NAS via SSH. To do so, open a Terminal in MacOS and type:

ssh <user>@<NAS IP address>

Then enter your password and press enter. You should be logged into the NAS.

If you are in this section of the document, it means that when the Container was created previously, you did not tick the checkbox to run it automatically. Hence, the container should at this stage be Stopped. We are going to run it using a command line in the MacOS terminal now that we are logged into the NAS using SSH.

sudo docker exec -it container_ID_or_name /bin/bash

to find the container name or ID, you can use this command:

sudo docker ps -a

You should now be logged in the container, on the Ubuntu OS.

Preparing the Ubuntu image

The OS is in “minimized mode” meaning that not much is installed (which a guess makes sense for a container). We first need to install all the missing parts necessary for our node to run.

First step is to “un-minimize” the OS by running this command:

unminimize

Then install Python 3:

apt install python3.8

We will need to install also curl:

apt install curl

And git:

apt install git

Now we should be able / ready to follow this tutorial to properly setup the node, starting from Part 2: Install dev tools on your Linux distro. When your node is running, come back to this page to see how to save your modified container as a new image (to avoid having to restart all over when the container shuts down).

https://mirror.xyz/0x83857601C1cFA057F2576b343c563BDB9A4C9975/8HfjYCkbid2vlayxyPtSD9_wtb9a-wHb1uOENsAOwng

Save your container as a new image

Once the above tutorial is over and you have your node up and running, open a new terminal on MacOS, SSH into your NAS, and run the below command to convert your container as an image:

sudo docker commit <container ID> <new image name>

Sources