How to run a Node app on Synology?
from Zagorath@aussie.zone to selfhosted@lemmy.world on 31 Jan 08:20
https://aussie.zone/post/17312800

I’ve written a bot for !dailygames@lemmy.zip that I’m currently just running on my desktop. But I’d like to be able to set and forget it (except for when I do updates) by running it on my Synology NAS.

How can I best pull the node app from GitHub and run it on my Synology, preferably automatically running on start-up if the Synology is restarted.

#selfhosted

threaded - newest

slazer2au@lemmy.world on 31 Jan 08:45 next collapse

If you can containerise it you could run it in docker.

Zagorath@aussie.zone on 02 Feb 09:03 collapse

I would love to containerise it. I worked with Docker in a previous job, but honestly I’ve forgotten most of how to work with it. Would be a nice refresher to try and relearn how to create Dockerfiles and docker-compose.yamls.

Unfortunately I currently have two problems. First: I seem to be completely unable to test this on my desktop. When I open Docker on my PC, it complains that I need to run wsl --shutdown, but despite doing that many times, it still complains, before immediately closing.

So I was going to try doing it entirely on the Synology. And then I ran into the issue that…I have no idea how to even start with that. When I search for Docker in the Package Manager the only thing that comes up is Synology’s own container manager, and I have no idea how to work with that.

slazer2au@lemmy.world on 02 Feb 09:10 collapse

Docker on windows is weird. It’s why I run docker in a Hyper-V cm on my PC not in wsl.

Zelaf@sopuli.xyz on 31 Jan 09:40 next collapse

I’d recommend to make a Dockerfile for it and run it that way. It’ll be quite a lot easier than to manage installing a bunch of dependencies.

Here’s a guide I found pretty good!

Here’s a bit of a shorter one too to get some more reference.

Zagorath@aussie.zone on 02 Feb 08:59 collapse

How do you run a docker container on Synology? I have a DS923+ which AFAIK should be able to run it, but when I search for Docker in the Package Manager the only thing that comes up is Synology’s own container manager, and I have no idea how to work with that.

Zelaf@sopuli.xyz on 02 Feb 17:23 collapse

It’s basically a front-end GUI to Docker, like how some use Portainer. Synology has pretty alright documentation here. If you’re on mobile, click the menu button on the top right to view the sub-pages for the docs, was confusing at first to find what more it had to say about it lol.

But in short, to spin up individual containers you can go to the “Container” page. But there’s a big lack of control because Synology so I recommend to use Docker Compose under “Projects” for more fine grained control if needed. When you start a project you have to select a location for the project files and you can use dot notation for sub directory and files when doing volume mounting, eg. ./nginx/config:/etc/nginx/nginx.conf.

There’s a lot to read on for containers in general and working with them on Synology is a tad different and sometimes a lot of hoops to jump through. But it’s definitely nicer in the end than running almost anything outside of Synology’s Office Suite through it!

just_another_person@lemmy.world on 31 Jan 11:13 next collapse

Only some models of Synology units have the ability to run containers, so check that first.

Otherwise, you COULD try and install the deps from the Synocommunity packages, but they get messy pretty quickly due to architecture limitations per package (one package may only work on select models). You can browse those and their architecture targets on the synocommunity site to make sure what you need will be available. If you can’t go the container route, I’d definitely read up on packaging your own app using the synocommunity guides, even if keeping it private.

Zagorath@aussie.zone on 02 Feb 09:00 collapse

Yeah I’m pretty sure my Synology should be able to run containers. It’s a DS923+. But unfortunately when I search for Docker in the Package Manager the only thing that comes up is Synology’s own container manager, and I have no idea how to work with that.

just_another_person@lemmy.world on 02 Feb 09:26 collapse

It’s just a docker frontend. Shouldn’t be too confusing.

rikudou@lemmings.world on 31 Jan 18:35 next collapse

The easiest would be using docker, you can set up the container to always restart, that way it will be started automatically on NAS restart.

You can also download node.js from the Synology software center and manually add a cronjob to run after reboot, but the docker way is probably the best way to go.

Zagorath@aussie.zone on 02 Feb 09:00 collapse

How do you run a docker container on Synology? I have a DS923+ which AFAIK should be able to run it, but when I search for Docker in the Package Manager the only thing that comes up is Synology’s own container manager, and I have no idea how to work with that.

rikudou@lemmings.world on 02 Feb 09:34 collapse

IIRC, that’s exactly it. You can either use their GUI (which is not half bad) or you can use the docker command in the terminal after you install the package.

Zagorath@aussie.zone on 02 Feb 10:22 collapse

Is there a way to get a terminal on the Synology itself, or is SSH from my PC the only way?

rikudou@lemmings.world on 02 Feb 11:38 next collapse

I only ever used SSH, so I don’t know.

Zelaf@sopuli.xyz on 02 Feb 17:27 collapse

There is not. But I’d say keep SSH closed on the NAS or whitelist only your local IP in the firewall. I do that and turn it off when I don’t need it. It can be a bit risqué messing about with SSH on Synology because of how funky they’ve made the distro it’s running and any changes you make might not persist on reboot or after updates.

Zagorath@aussie.zone on 05 Feb 07:19 collapse

Personally I’m not enormously worried about SSH, because I’m behind NAT anyway, but yeah it’s definitely still something I’d rather keep off if not in use.

possiblylinux127@lemmy.zip on 01 Feb 00:13 next collapse

Why can’t you run it on your desktop?

possiblylinux127@lemmy.zip on 01 Feb 00:13 next collapse

Why can’t you run it on your desktop?

Zagorath@aussie.zone on 01 Feb 03:35 collapse

I can, but that would require manually starting it up every time I restart my computer—which is daily, for the most part. And there are times when I don’t even turn on my computer for the day, or don’t do so before the 2pm time the bot needs to run. It would be better to have it running on a system that’s always online.

possiblylinux127@lemmy.zip on 01 Feb 03:59 collapse

You could use task scheduler. However, that won’t fix the uptime issue.

boiledham@lemmy.world on 01 Feb 06:37 collapse

Docker would be my go to

Zagorath@aussie.zone on 02 Feb 09:00 collapse

How do you run a docker container on Synology? I have a DS923+ which AFAIK should be able to run it, but when I search for Docker in the Package Manager the only thing that comes up is Synology’s own container manager, and I have no idea how to work with that.

dktr@lemmy.world on 02 Feb 16:00 next collapse

It’s just a wrapper on top of Docker. You can import your own yaml files when you create your setup.

boiledham@lemmy.world on 10 Feb 05:05 collapse

I was able to install docker on mine. I don’t remember if I had to grab the installer separately or if it showed up in my package manager though