Rest-server on an old Synology DJ213j NAS (ARM7 CPU)

I installed rest-server on an old Synology DJ213j with a Marvell Armada-370 PJ4Bv7 (ARM7 with hard float) processor.

I did not create any package for this, but perhaps these instructions will be useful to someone. You will need to have root ssh access and be comfortable with the linux shell. If you have a model that supports Docker, using that will be significantly more convenient than this.

I first compiled rest-server (you could probably also just download the linux-arm binary release) with:

GOARM=7 go run build.go --goos linux --goarch arm -o rest-server.nas

Next I created a new “restic-backup” shared folder, which ends up in /volume1/restic-backup, and copied the binary there as rest-server (make sure it’s executable, chmod 755 /volume1/restic-backup/rest-server).

Create a .htpasswd file locally on your computer and copy it to the same folder:

htpasswd -B -c .htpasswd your-http-username

Create a /etc/init/rest-server.conf upstart config with the following contents:

# only start this service after the httpd user process has started
start on started httpd-user

# stop the service gracefully if the runlevel changes to 'reboot'
stop on runlevel [06]

# run the scripts as the 'http' user. Running as root (the default) is a bad idea
# CHANGE THIS IF YOU WANT A DIFFERENT USER
setuid http

script
  /volume1/restic-backup/rest-server --listen :8765 --path /volume1/restic-backup --prometheus
end script

Change the ownership to match the user you picked in the upstart config to ensure the permissions are correct:

chown http /volume1/restic-backup
chmod 755 /volume1/restic-backup

Reload the upstart configs and start the service:

initctl reload-configuration
initctl start rest-server

Now your rest-server should be available on port 8765.

On this NAS, rest-server appears to be CPU-bound for some reason, and the transfer speed maxes out at about 20 MB/s. I also compiled a restic binary and ran it there, but it takes more than 15 seconds just to derive the encryption key from your passphrase…

If anyone wants to create a real package out of this, perhaps this is a good starting point: https://github.com/alexandregz/gogs-spk

2 Likes

I am interested in this as well. Did you designate a place where you compiled the rest-server?
Somebody else suggested I do this for backups since it’s faster.
However, it seems like I am already running at maximum bandwidth for my connection.
I have a RS816 and a DS414 which both cannot install using the Docker method.

Do you have any advice based on your experience?
Thanks.

I just checked and the RS816 is using a MARVELL Armada 385 88F6820
and the DS414 is running a MARVELL Armada XP MV78230

I am new to this. I have never compiled a GO Program before, but this was what I followed.

-master$ GOARM=7 go run build.go --goos linux --goarch arm -o rest-server.nas

go: downloading goji.io v2.0.2+incompatible

go: downloading github.com/prometheus/client_golang v0.8.0

go: downloading github.com/miolini/datacounter v0.0.0-20171104152933-fd4e42a1d5e0

go: downloading github.com/spf13/cobra v0.0.1

go: downloading golang.org/x/crypto v0.0.0-20180214000028-650f4a345ab4

go: downloading github.com/gorilla/handlers v1.3.0

go: downloading github.com/prometheus/common v0.0.0-20180110214958-89604d197083

go: downloading github.com/prometheus/procfs v0.0.0-20180212145926-282c8707aa21

go: downloading github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a

go: downloading github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5

go: downloading github.com/golang/protobuf v1.0.0

go: downloading github.com/spf13/pflag v1.0.0

go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.0

In the end the result was a rest-server.nas
I have to test out the rest of it now.