Search code examples
gitwebheroku

Deploy two web apps from one repo (heroku)


I have a git repository, which contains 3 python telegram bots, each in a separate script. I want to deploy them all as web apps using heroku, so they run at the same time. Is there any possibility to do this, may be create several heroku apps (but then how should I deal with the procfile)?

I've found solutions only for cases, when people had different types of apps (like web and api), but it won't work for me.


Solution

  • Best solution or architecture is to have one git repository for each deployable application.

    Several apps in the same source code repository is used in legacy frameworks , deployed in the old way in which, manually tasks could handle this kind of requeriments.

    If somebody says: But I have code wich is required by all my bots. In this case the most optimum approach is to use libraries like java with maven or nodejs with npm.

    Anyway, your requirement is interesting

    Solution 1

    If you have several entrypoints , one by bot like: bot1.py bot2.py bot3.py you could environment variables to parametrize the file name in Procfile

    worker: python $BOT_NAME.py
    

    Solution 2

    Ensure to have just one entrypoint like start_bot.py in which an environment variable is used to determine the bot has to be started.