Objective
So you've written your service. Now what? Now you deploy it!
Steps
Manual Service Deployment
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.
# Go to folder where service was created cd /opt/soajs/node_modules/myService # Export necessary environment variables export SOAJS_SRVIP=127.0.0.1 export SOAJS_ENV=[ENTER THE NAME OF YOUR ENVIRONMENT HERE] export SOAJS_PROFILE=[ENTER PATH TO PROFILE HERE] # Deploy service node .
Dashboard Service Deployment
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 environment.
Once your deploy the environment, proceed with the service:
- Click on Add New Service
- Choose your deployment mode
- Enter how many replicas you want to deploy (usually for local deployment 1 instance is enough)
- Choose the Catalog Recipe
- Choose the service
- Enter the version you want to use
- Choose the branch
Repeat these steps for any additional service you want to deploy
Grant Access to Owner
After deploying your services in an environment, you need to grant access to it, click here to learn how to secure your service when you are done deploying it.
Dashboard Daemon Configuration
Daemons require groups to be deployed and daemon groups are managed under the Develop pillar. Make sure you have SOAJS Dashboard installed so you can create and configure a daemon group.
Log in to the Dashboard, and activate the git account that contains your daemon. Go to Develop → Repositories and add your git account, then activate the repo that contains your daemon. Now head over to Develop → Daemon Catalog and you will see your daemon in the Daemons tab. | Create a Group, configure it and assign it to our daemon. The group configuration is what drives our daemon: It specifies when the daemon should run, how long it should run for, how to execute its jobs, etc... Click on the Group Configurations tab and click Add Group Configuration. Here you will enter the group name of your choice, select your daemon from the drop down menu, select what type of daemon you want (interval, cron, or run once), and whether or not you want the daemon jobs to run sequentially or in parallel. |
Once this is done, our demon is ready to be deployed!
Daemon Deployment with Manual SOAJS Deployment
Similar to manually deploy a service, you can deploy a daemon using your terminal.
Daemons behave like services in SOAJS and require the same list of environment variables.
In addition they need to know which group configuration to load thus an additional environment variable should be exported.
# Go to folder where daemon was created cd /opt/soajs/node_modules/myDaemon # Export necessary environment variables export SOAJS_SRVIP=127.0.0.1 export SOAJS_ENV=[ENTER THE NAME OF YOUR ENVIRONMENT HERE] export SOAJS_PROFILE=[ENTER PATH TO PROFILE HERE] export SOAJS_DAEMON_GRP_CONF=[DAEMON GROUP CONF NAME] # Deploy daemon node .
Daemon Deployment with Local Cloud SOAJS Deployment
Go to Deploy → Clouds & Deployments.
Click on the services tab, then click Deploy New service.
Select your daemon from the drop down list and your daemon is now deployed!
The same form that appeared in deploying a service is used with an extra dropdown for you to pick a daemon group for your daemon.
Add Comment