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
setuid http

  /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:

1 Like