How to Update a SOAJS service/daemon code ?
Objective
Become familiar with how the SOAJS Dashboard notifies you about updates for SOAJS services & daemons that are deployed in Dashboard Environment and learn how to pull and apply these updates in the Dashboard Environment.
Steps
- Locate Update Notifications
- Understand what the Update is about
- Apply the Code Update
Step 1
The Dashboard contains a notification system that informs you whenever new code updates are published by the SOAJS team for all Ready Made Services deployed in the Dashboard Environment.
These notifications appear in 2 places:
- Under Deploy pillar → Continuous Delivery → Ledger tab.
- Under Deploy pillar → Clouds & Deployments → notification icon next to each service deployed.
In Clouds & Deployments you only see a notification icon that there is a new update, whereas the Ledger provides you with a link so you can learn more about the update.
Step 2
Before you pull a SOAJS Service Update in the Dashboard Environment, it is crucial you learn what the update is about as it might not be backward compatible or it might depend on an image upgrade.
In this case you need to handle these prerequisites before applying the code update otherwise the service might crash after you apply the update.
Every SOAJS service has a 3 digit version and when there is a new update, one of these digits is bumped based on the update type.
If the the last digit is bumped, the update is just a patch and it's backward compatible.
If the middle digit is bumped, the update isn't backward compatible.
If the the first digit is bumped, you have an upgrade and surely it isn't backward compatible.
In Addition, every SOAJS services is built on top of the SOAJS framework and thus it is dependent of the version of that framework as well. The framework version follows the same 3 digits version strategy.
You can find the service releases and release notes on https://github.com/soajs/soajs.%serviceName%/releases to learn more what the update is about and what is the new service version.
You can also find which SOAJS framework version this service is now using by looking under dependencies section in its package file: https://github.com/soajs/soajs.%serviceName%/blob/master/package.json
Example:
SOAJS URAC Service:
Releases & Release Notes: https://github.com/soajs/soajs.urac/releases
Package File: https://github.com/soajs/soajs.urac/blob/master/package.json
If the Package File depicts that the SOAJS framework version is not backward compatible, then there is a new SOAJS image update and you need to pull this new image BEFORE you pull the updates of this service.
You can learn more about how to pull SOAJS image updates/upgrades in this link.
Assuming you pulled the new image updates/upgrades or assuming that there aren't any new image updates, head to the next step and see how to apply the service updates.
Step 3
Applying latest update on a deployed SOAJS service in the Dashboard Environment:
- Go to the Deploy pillar → Clouds & Deployments
- Make sure that the DASHBOARD environment is selected in the top left corner from the red drop down menu.
- Click on SOAJS tab and locate your service entry.
- Open the Service Operations menu of the service/daemon you are about to update
- Click Restart Service
This operation will restart your service using the exact same settings that were used to deploy it in the first place.
However, the SOAJS deployer inside the SOAJS image will perform a git clone operation that will clone the latest code updates from branch master.
Once the code is pulled, the deployer will run an NPM INSTALL command to install the dependencies needed and will start your service.
While the deployer is running, your old service remains operational until the new service is flagged as running by either Docker Swarm or Kubernetes depending on which of the two drivers you have chosen to deploy your SOAJS cloud with.
When the new service becomes ready, then the old one will be terminated; your SOAJS Service is now updated.