Skip to content

Deploy to Heroku

Aahnik Daw edited this page Apr 23, 2021 · 9 revisions

Heroku is a cloud platform that lets companies build, deliver, monitor, and scale apps, it is one of the fastest ways to go from idea to URL, bypassing all those infrastructure headaches.

You can deploy tgcf to Heroku very easily.

Limitations

  • Heroku has an ephemeral file system.
  • Thus you cant store your files here.
  • tgcf.config.yml can't be created here.
  • Instead, you can use an environment variable named TGCF_CONFIG to store the contents of the configuration file.
  • tgcf in past mode won't work properly in Heroku, as the environment variable TGCF_CONFIG can't be updated.

Pros

  • tgcf will work perfectly fine in live mode in Heroku.
  • Heroku offers a great free tier of 450 hrs/mo

One-click deploy

  1. Make sure you have a Heroku account and then click on this button.

    Deploy to Heroku

  2. A Heroku page will open where you can set all the environment variables.

  • Set the name of the app whatever you want.

    image

  • Set your API ID and API HASH obtained from my.telegram.org. Set the mode to live.

    image

  • You may keep your SESSION_STRING and TGCF_CONFIG empty for now.

    image

  • Now click the deploy app button.

    image

  1. It will take some time to build and deploy. After the deployment is complete, click on the manage app button. image

  2. On the top right corner click More -> Run console

image

  1. Write the tg-login command and click run.

    image

This will ask you for you phone no. or bot token. And then display the session string to you. Copy this session string. If you cant copy directly, click the save button to save a text file on your computer, and then copy the session string from it.

  1. Now go to the settings tab and click Reveal config vars. Click on the pencil button for the session string config var, and then paste the session string the value of that.

  2. Learn how to configure tgcf, and then write your configuration in the TGCF_CONFIG env var.

  3. Go to the resources tab, and turn on the worker.

image