Deploy python telegram bot on IBM Cloud

1 minute read

Updated! For new IBM Cloud on 2019.06.24.

It works on my python 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 name is Shamanking, you must write same name in manifest.yml.

- name: Shamanking
  instances: 1
  memory: 128M

But your bot is not web app, so IBM’s health checker will turn it off in only 1 minute.

applications:
- name: Shamanking
  instances: 1
  memory: 128M
  disk_quota: 1024M
  no-route: true

And type like below on console.

ibmcloud cf set-health-check Shamanking none
ibmcloud cf push

Below for reference.

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

setup Procfile

Procfile is for run.

web: python bot.py

setup requirements.txt

Must write requirements.txt, and put some lib for IBM Cloud.

pip freeze > requirements.txt

setup runtime.txt

Describe what runtime environement you want

python-3.6.7

Leave a comment