How to deploy a service & daemon
Objective
So you've written your service. Now what? Now you deploy it!
Steps
You can deploy a service manually using your terminal. Your service eventually resolves to a NodeJs code and to run this code, all you need to do is specify some environment variables then use node to.
The following snippet provides an example on how to manually deploy a service.
Service Manual Deployment
# Go to folder where service was created
cd /opt/soajs/node_modules/myService
# start the soajs example environment
sudo soajs services start --env=[ENTER THE NAME OF YOUR ENVIRONMENT HERE]
# export necessary environment variables to create local awareness
export SOAJS_ENV=[ENTER THE NAME OF YOUR ENVIRONMENT HERE]
export SOAJS_SRVPORT=[ENTER THE PORT]
export SOAJS_DEPLOY_MANUAL=1
export SOAJS_REGISTRY_API=[ENTER THE GATEWAY IP and maintenance PORT]
# Deploy service
node .If you installed the SOAJS Dashboard, you can deploy your custom service using the UI following these steps:
Step 1: Link to GIT & Activate your service/daemon
Head to the Develop pillar → Repositories and link your Bitbucket/Github account to the dashboard. | Once linked, browse through the list of repos and activate your service: |
Step 2: Deploy the service/daemon
Services must be deployed in an environment, so we need to deploy the environment, then deploy the service in it. Check out the Clouds & Deployments to learn how to deploy an existing environment or check out Registries to learn how to create and deploy an environment.
Once your deploy the environment, proceed with the service:
Go to Repositories under Deploy pillar
Click on the service/daemon you want to deploy and click on Configure Deployment
Choose which branch you want to deploy the service/daemon from
Specify the memory limit per instance
Specify the CPU limit per instance
Choose the Catalog Recipe
Choose the deployment mode
Enter how many replicas you want to deploy(usually for local deployment 1 instance is enough), or turn on Auto Scale then enter the cpu percentage, the minimum and the maximum replica count(only for services).
Repeat these steps for any additional service/daemon you want to deploy