Screenshot showing configuration of container station in QNAP NAS

Running a node.js app on my QNAP NAS the "quick and dirty" way

Reading time:
5 minutes
Tags:
docker
nodejs
sonos
Published:
19 March 2024 (44 weeks ago)
Table of Contents

Introduction

I wanted to play a little bit with my home automation system and needed to have an easy interface to control my sonos environment. After some googling I came across sonst-http-api by jishi (https://github.com/jishi/node-sonos-http-api) and have decided to give it a try. But where should I run this? Setting up another Raspberry Pi (the exactly always gets a corrupted SD card at the worst point in time or my NAS to which I have migrated all my tiny home apps)? The answer is simple... Let's go the NAS route.

Setup

To set this up, I wanted to achieve the following
  • using my ARM based QNAP NAS
  • use an existing docker container and just execute some commands (this is for playing and not for "production use"
So I logged in to my QNAP NAS and started the Container Station App.
Then I have selected Container → Create (hope this is the translation they have used for erstellen).
Then add the following data:
1 - Create Container
Image: 1 - Create Container
We want to pull it from Docker Hub and I decided to use the "node" image that contains everything for node.js
2 - Configure Container
Image: 2 - Configure Container
Specify any container name that you want to use, I decided to use the standard network node (NAT) and expose the internal TCP port 5005 to the host using the same TCP port.
After that, I have modified the entrypoint and the command. The entrypoint is the first command that is executed (now: sh -c) and the "command" is an additional command or parameters. In this case:
"git clone https://github.com/abc/xyz.git && cd xyz && npm install && npm run start"
Now you can apply these settings and click on next to finalize everything. Then the container automatically starts.