Upgrade Nearby Shops API Backend

In this article we will learn how you can upgrade Nearby Shops API Backend con ubuntu 16.04

Prerequisite Knowledge

To understand this upgrade guide you dont need to be an expert but having some basic knowledge of linux terminal commands, Postgres Database and java will help you.

Steps for Upgrade

Step 1. Go to the Installation Directory
Step 2. Download the latest jar file
Step 3 : Modify and Update SystemD unit file
Step 4 : Systemctl Daemon-Reload
Step 5 : Restart the Service

Let us begin the step by step Upgrade Guide for Nearby Shops API Backend

Step 1 : Go to the installation directory

While installing the Nearby Shops you must have created an installation directory. You will now cd into the installation directory.
In the following example the installation directory is ~/nearbyshops

                     Code
                  
    cd ~/nearbyshops
                    
                  

Step 2 : Download latest jar file into the installation directory

Please download the latest jar file and configuration file into the installation directory. You can download the files from the downloads page

                     Code
                  
    wget [link-of-latest-jar-file]
                    
                  

Step 3 : Modify and Update SystemD unit file

SystemD is a mechanism in the Linux OS which automates the execution of the processes. It is required to ensure that the process does not terminate unexpectedly. When there is an unexpected termination of the process the systemD restarts the process. Since our API backend is suppose to run indefinitely unless we dont stop it by self. Therefore we need this mechanism to ensure that our process runs indefinitely.

The script (program) to automate the process execution is written in SystemD unit files. SystemD reads these files to understand how to automate the process execution.

You will now locate the SystemD unit file and modify and update the file.

                     Code
                  
    cd /etc/systemd/system
    sudo nano nearbyshopsapi.service
                    
                  

In this file you will see the path to the jar file. Now change the file path of the jar file with the file path of the new jar file.

Step 4 : Systemctl Daemon-Reload

Whenever you have made changes to the unit files you need to execute systemctl daemon-reload command.

                     Code
                  
     systemctl daemon-reload
                    
                  

In this file you will see the path to the jar file. Now change the file path of the jar file with the file path of the new jar file.

Step 5 : Restart the Service

After making all these changes you are now required to restart the server or the process to ensure that changes are live.
Use the following terminal commands to restart your server. s

                     Code
                  
                      sudo systemctl restart nearbyshopsapi
                  
                
OR
                     Code
                  
                      shutdown -r now
                  
                

In this file you will see the path to the jar file. Now change the file path of the jar file with the file path of the new jar file.