What is the proper protocol for updating the local server jar file (Raspberry Pi)

Hello,

I’ve installed the local server (12.2) and have been running it for a while with no issues, but last night I wanted to update to the 12.3 version and could not get it running. I don’t know much about linux or raspberry Pi to begin with, so this has been a learning experience for me.

What is the proper method for updating to a new version of the local server?

Off topic, I have been playing with esp 8266 chips with Blynk. I created a garage door controller that tells me the state of the door (up or down) and I can open or close the door remotely. It amazes me how quickly I was able to get everything set up using Blynk. What a great app!

-Adam

Hello. Protocol is very simple :

kill ‘old version’;
start new version;

If you had a problem - see logs/blynk.log it will have description of problem. Most probably you didn’t kill previous version of server.

1 Like

In Linux you can create what are called symbolic links, it’s the same as a Windows link. What I did was made a startup script (it’s somewhere on the forum here) and create a symbolic link to the jar file like so:

ln -s server-version.jar server.jar

This will create a server.jar file which is called in the startup script. The script also makes a file if you started your server running or not. This way the procedure gets a little easier because there is no need to change the scripts:

  1. upload new jar to server
  2. create symlink again
  3. restart your service

-e-t

Script is here, if you want it: [SOLVED] Start blynk server on Runlevel (Raspberry Pi)

Thank you Dmitriy and Lichtsignaal! I was definitely not killing the previous version prior to starting the new one.

To execute the ‘kill’ command, i needed the process id, which I found by executing ‘ps -fC java’ which showed the command that I used to start the server and listed it’s process ID so I could verify what I was ‘killing’.

Lichtsignaal, I used your ‘ln’ suggestion to create the ‘server.jar’ link, but rather than the script, I just edited the crontab line that I was using for the older version to now point to ‘server.jar’. Is this a bad way to auto run the server (compared to your script method)? I restarted the pi, and it seemed to run properly.

Thank you both again for the help.

-Adam

Now I think I really screwed my pi up. I can’t find the process ID of java anymore, yet the port is already in use

snip from log:

18:28:56.540 INFO - Using data dir '/home/pi/Blynk' 18:28:58.682 ERROR - Error parsing file '/home/pi/Blynk/mail.properties'. 18:28:58.683 ERROR - Error parsing file '/home/pi/Blynk/server.properties'. 18:28:59.284 INFO - Initializing mail transport. Username : AMW.Blynk@gmail.com. SMTP host : smtp.gmail.com:587 18:29:00.882 INFO - Plain tcp/ip hardware server port 8442. 18:29:00.889 INFO - Enabling SSL for hardware. 18:29:04.649 INFO - SSL hardware port 8441. 18:29:04.675 INFO - Enabling SSL for application. 18:29:04.679 WARN - Found server certificates but no client certificate for '/home/pi' path. Using one way ssl. 18:29:04.736 INFO - Application server port 8443. 18:29:04.850 INFO - Enabling HTTP API. 18:29:04.851 INFO - HTTP for app port 8080. 18:29:04.869 INFO - Enabling HTTPS API. 18:29:04.917 INFO - HTTPS for app port 7443. 18:29:04.977 INFO - Enabling HTTPS for admin UI. 18:29:05.021 INFO - HTTPS admin UI port 7443. 18:29:05.288 ERROR - Error initializing HTTPS Admin UI, port 7443 java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:414) at sun.nio.ch.Net.bind(Net.java:406) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125) at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:485) at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1089) at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:425) at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903) at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:198) at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:348) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) at java.lang.Thread.run(Thread.java:744)

The java process doesn’t seem to be running, so I can’t kill it.

Does anyone have an idea of what I can do to fix this (other than reformatting the SD card and reinstalling a fresh version of Raspbian, which will be my plan B).

I think you are using old properties file.

You try to bind on same port 2 different services. HTTPS API and Admin UI.

Either remove your server.properties, either change/add :

https.port=9443
administration.https.port=7443

Once again, I can’t thank you enough Dmitriy. It is now back up and running. Next time, I will look over the log file more closely as I see now that I should have been able to find the problem with my setup configuration.

1 Like

No, crontab is a good way to go. It could be even better in some cases then a script, but both have their advantages :slight_smile:

Usually properties are not changed. So it shouldn’t happen often and you don’t have to look in logs :wink:. Last month just was crazy in terms of development. 200 commits in a month. Many things were changed.

Ok, I’m going to jump on to this thread as it seems to be the right place to get some help.

I would like to update the local server but I do not know exactly where to start. My first step is to ‘Kill’ the running server right? That sounds easy… but it’s not for me.

Advice from @Dmitriy is[quote=“Dmitriy, post:2, topic:3595”]
Hello. Protocol is very simple :

kill ‘old version’;start new version;
[/quote]

Is there any chance it could be explained for dummies like me. I have questions like;

1)What command do I type to find the process number to ‘KILL’?
2)What command do i type to KILL the process?
3)What directory/folder do I put the new jar file in?
4)What command do I type to "GET’ the jar file directly?
5)How do i start the new server?

When I set up the server followed the instructions from a blog and managed to get it working but It was a while ago and I have forgotten even the most basic commands. I also remember using crontab to start the server automatically so I think ill also need to relearn how to edit that to run the new server

Ok, Ill answer my own questions in the hope it will help someone else out. Also let me know if I did it correctly.

1)What command do I type to find the process number to ‘KILL’?
I used ps -ef in the terminal window to get me a list of running processes then I found the program ID for the Blynk server in that list.

2)What command do i type to KILL the process?
I used kill -9 PID 540
Note; My PID was 540, but you will need to use the Program ID that you find in step 1

3)What directory/folder do I put the new jar file in?
I found my server jar file in home/pi/Blynk
so use the command cd home/pi/Blynk to get to the right spot to put the new server file

4)What command do I type to "GET’ the jar file directly?
this information is in the Blynk documentation
type ;
wget “https://github.com/blynkkk/blynk-server/releases/download/v0.12.4/server-0.12.4.jar

5)How do i start the new server?
I use crontab to start my server so I typed the command crontab -e which allowed me to edit which file to start up in the routine. Then I did reboot

seems to be working ok, I hope this helps others.

my only issue now is I seem to be getting my LCD’s losing the Virtual pin allocations all the time. I have heard of this before, Ill do some more searching on the forum before I panic.

2 Likes

iOS? update on it’s way.

Updated Blynk doc with update instruction - https://github.com/blynkkk/blynk-server#update-instruction

2 Likes

Yes iOS.
I did end up finding a thread about it saying it is a known bug.
I’m glad you will have it sorted soon.