This is small example of running your own bots with Heroku. You can run ANY python script with ANY dependaries.
-
Download this repository.
-
Register on Heroku.
-
Download and install Heroku CLI.
-
Download and install git.
-
Copy your script/ project to repository's folder.
-
Replace "script.py" with path to your main executable file in "Procfile".
worker: python script.py
-
You may select your python version and runtime with "runtime.txt". Read how on official heroku page.
-
If you are using non-standart modules, you must add them to requirements.txt
To check which version of module you have on your computer, run pip freeze | grep MODULE_NAME in the terminal.
You will get line MODULE_NAME==MODULE_VERSION. Add this line to "requirements.txt".
You should remove any unused modules from "requirements.txt".
Repeat this process for all the modules you are planning to use.
-
Now open terminal(or do it other way, but i will explain how to do it in terminal on Ubuntu) and create git repository.
git init
Create heroku app.
heroku create
And push your code into heroku app.
git add .
git commit -m "initial commit"
git push heroku master
- Run you worker with following command.
heroku ps:scale worker=1
- Now everything should be working. You can check your logs with.
heroku logs --tail
- From now on you can use usual git commands(push, add, commit etc.) to update your app.
Everytime you push heroku master your app gets redeployed.
- @michaelkrukov - http://michaelkrukov.ru/
This project is licensed under GNU General Public License v3.0 - see the LICENCE.md file for details