Deploying Node.js telegram bot on IBM BlueMix

1 minute read

It works on my Node.js project.

If you do not follow this settings, you would see like this.

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
0 of 1 instances running, 1 down
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 down
FAILED
Start app timeout

Setup

Setup manifest.yml

If you’re app is not web app, you must describe it. In the below, app name is hangifbot

applications:
- name: hangifbot
  instances: 1
  memory: 128M
  disk_quota: 1024M
  no-route: true # bot does not need router

Another option when deploying

  • no-route: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#no-route
  • deploying: https://cloud.ibm.com/docs/cli?topic=cloud-cli-developing

But there is a problem. Health checker will it turn off in only 1 minute if you do not like below.

ibmcloud cf set-health-check hangifbot none
ibmcloud cf push --no-route

Setup package.json

Describe package.json for run.

# ...
"scripts": {
    "start": "node bot.js"   
  }
# ...  

Deploy

1. install IBM Cloud Develop Tools

Install IBM Cloud Develop Tools. It’s a superset of Cloud Foundry cli.

2. Deploy

Fisrt, set up IBM Cloud.

ibmcloud login
# type your ID/PW

# set a location for running your bot
ibmcloud target --cf

And push to Cloud server.

# push to IBM Cloud and run!
ibmcloud cf push

That’s all. cf push is good. npm install is executed before running automatically.

Leave a comment