The following guide will teach you how to deploy the bot to the cloud using Google Cloud, a robust and cost effective hosting service:
-
Create an account at https://cloud.google.com/, if you haven't already done so.
-
Set up your billing account at https://console.cloud.google.com/billing
- Note that you may be eligible for $300 in free credit if this is your first Google Cloud account!
-
Enable the Compute Engine API at https://console.cloud.google.com/apis/library/compute.googleapis.com
-
Go to Compute Engine Instances at https://console.cloud.google.com/compute/instances
-
Click Create Instance in the menu
-
Verify or modify the following settings. If a setting is not mentioned, you should leave it as the default:
-
Set the Name of the instance to whatever you'd like (e.g. telegram-translate-ai)
-
Change the Series under Machine configuration to N1
-
Change the Machine Type under Machine configuration to Shared-core -> f1-micro
-
Click DEPLOY CONTAINER under Container to deploy the docker container image to the instance.
-
In the Container image box, enter:
hschickdevs/telegram-translate-ai:latest
-
Set the Restart policy to On failure
-
Add the required environment variables for the bot by clicking ADD VARIABLE for each:
-
OPENAI_TOKEN: Set to your OPENAI API key which was created in the prerequisite step.
-
BOT_TOKEN: Set to your Telegram bot token which was also created in the prerequisite step.
-
MODEL: OPTIONALLY - You can set this environment variable if you'd like to use a different model. the default is
gpt-4o-mini
, but you can set this togpt-4o
if applicable to your account.
-
-
Verify that your settings in the Configure container look like this (The environment variables in the image are for example only, not real), then click SELECT at the bottom to save the settings:
-
Lastly, under Firewall check the boxes for:
- Allow HTTP traffic
- Allow HTTPS traffic
-
-
Once you have finished creating these settings, click CREATE at the bottom of the menu.
-
Once the VM is finished provisioning and the status indicates a green checkmark, you can head to your bot's chat on Telegram and start using it!
For any questions, please contact me on Telegram: https://t.me/hschickdevs