BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

[HOWTO] Local Blynk server installation on Synology + questions

Hi guys,

I’m playing with Blynk and NodeMCU dev board for a while.
As I own a Synology DS215J, I wanted to deploy a Blynk server on it.
Thanks to several posts by the community, I succeed to deploy and test it.

But I don’t really find a clear “How To”, so I decided provide a simple step-by-step guide.
I’m not a specialist but I hope this guide will help!
Don’t hesitate to add your comments or improve it.

Note : I’m facing a issue at the final step, for the one I don’t know how to fix it (see last point - 6)

1°) Setup and prepare your Synology

  • Login to DSM as admin and activate SSH / Telnet (Control Panel --> Terminal & SNMP --> Terminal tab --> Activate Telnet & SSH)
  • Install “Java8” package (Package Center --> Search “Java8” --> Install)
  • Create a new directory “Home/Blynk” via “File Station”

2°) Prepare your files

  • Via FTP, copy the 'server-x-x-x.jar" file into the new “Blynk” folder
  • Copy “server.properties” and “mail.properties” into the same folder (optional)

3°) Starts the server

  • On your local PC/MAC, connect to your Synology via SSH (For MAC : Terminal --> “ssh [useradmin]@[server_ip]” + input your password)
  • Once connected, check if the Java version is correct (“java -version” should give you “1.8.xxx”)
  • Start the Blynk server via the following command : “sudo java -jar server-0.16.4.jar” (more parameters available)

4°) Stops the server

  • You can stop your Blynk server by closing the terminal window (or CTRL+C on MAC Terminal)
  • If the process has been launch in a different way you can search the process ID of the Blynk server by using the following command when connected via SSH : “ps -ef | grep java” (ID = 2nd column)
  • When you’ve identified the process ID, kill it via the following command : “sudo kill -9 [ID]”

5°) [Optional] : Access your Blynk server over internet

  • If you need to access to your server outside your local network, you should activate and setup the “External access” (Control Panel)
  • Then, you have to re-direct the ports used by Blynk server on your router

6°) [QUESTION] Launch the Blynk Server at Synology startup
Does anyone has an idea on how to schedule and launch automatically Blynk server at Synology startup ?
Since I launch the Bylnk server via SSH, when I close the terminal the Blynk server is shutting down, which is a bit painfull

  • Update from @Lichtsignaal: If you start the blynk server followed by an “&” sign, it will continue to run in the background, not the best solution, but at least you can close your terminal

Thanks in advance for your inputs.

Murray Bozinsky

4 Likes

@MurrayB Hello. Cool! Thanks for sharing!

if you start the blynk server followed by an “&” sign, it will continue to run in the background, not the best solution, but at least you can close your terminal :slight_smile:

e.g.

java -jar blablabla datablabla &

@Lichtsignaal Thanks for the trick! Any idea to add the Blynk server process at the Synology startup?

I have no idea, the & trick comes from my Linux knowledge, but I have no idea about the Synology. I think there was someone else on the forum who also had this problem, but I’m not sure.

-edit

Maybe this: http://majikshoe.blogspot.nl/2014/12/starting-service-on-synology-dsm-5.html ? Not sure if it works on all Synology devices/

Maybe this will work https://forum.synology.com/enu/viewtopic.php?t=39107

Have you considered using Docker in the DSM GUI? It’s very easy to setup once you know a few key steps.
Also auto restart, doesnt require SSH to start or configure.

Link to some instructions I wrote the other day: Blynk on Synology Diskstation

1 Like

I have installed blynk on my synology 415+ using
the docker pinya/blynk install
provided in the above link

Things seems to be running, and I have the log files
/volume1/docker/blynk/logs$ ls -l
total 184
-rwxrwxrwx 1 root root 0 Aug 18 19:25 admin.log
-rwxrwxrwx 1 root root 1510 Aug 18 20:22 blynk.log
-rwxrwxrwx 1 root root 85 Aug 18 19:25 postgres.log
-rwxrwxrwx 1 root root 156160 Aug 18 21:32 stats.log
-rwxrwxrwx 1 root root 12544 Aug 18 21:32 worker.log

But I have no idea how to configure the users on my blynk server.
Please provide some help in a very elementary way.

Thanks

Thanks, but the problem is that I dont know where is the
server.jar file

I am not familiar with docker, and I dont know where the install files are .

I see some @docker directory
drwx–x--x 9 root root 4096 Aug 18 14:40 @docker

but cannot access it

admin@plato:/volume1/@docker$ cd @docker
-sh: cd: @docker: No such file or directory

Sorry for that, but I need some additional help.

There is no need for accessing the server.jar file. You can access the webinterface via a browser. E.g. http://:7443/admin

Hi!
I used simple watchdog script in cron (every 5 min) if it didn’t found working blynk server it will run it.

  • ssh to synology as root
  • create sh script
    vi watchdog.sh (change java path and configs to yours, run which java)

#!/bin/sh
#
#Watchdog script for blynk server
#
stat=`/bin/ps -aux | /bin/grep -c “blynk”`
server=“server-0.17.0.jar”
if [ $stat -lt “2” ]; then
/usr/local/bin/java -Djava.net.preferIPv4Stack=true -jar /volume1/homes/admin/$server -serverConfig /volume1/homes/admin/blynk_config/server.properties -dataFolder /volume1/homes/admin/blynk_data &
fi

  • add line to crontab
    vi /etc/crontab (also change path to you watchdog script!) Be careful, use only TABs for delimiting (synology feature).

*/5 * * * * root /volume1/homes/admin/watchdog.sh >/dev/null 2>&1

p.s. - In vi for editing press i for end press ESC and for save and quit pres Shift + : then write wq then Enter. :heart: Synology)

2 Likes

@Xandr nice work.

Are you able to knock up a linux bash script to ping 8.8.8.8 and reboot if it fails?

Not all Synology NAS supports Docker…

You can use this one example. Only change line

echo “Host : $myHost is down (ping failed) at $(date)”

to

/sbin/reboot

But be careful, if you have some problem with your ISP your NAS will be rebooted very often.

1 Like

You need to build in some sanity checks of course. Check it maybe 10 times over 5 minutes or so and than reboot. :slight_smile:

Hi Blynker,

I cannot access https://IPSynology:7443/admin
Use port scanner all Blynk port is not open.

my Synology is DS216J (no Docker app)
running Blynk server from SSH term.

Thanks

4 posts were split to a new topic: Setting up Local Server on Synology NAS - port problems?