Telegram bot for managing Hetzner cloud servers.
hcloud-tg requires some environment variables to work.
BOT_TOKEN
:
Your bot token which you got from @BotFather.
ALLOWED_USERS
:
A list of users telegram id that are allowed to use the bot. IDs should be separated using '-' (12345678-3215477). You can either get your id by messaging @get_id_bot
bot or you can run the bot without any allowed users and send /me
command to get a reply containing your telegram id.
HETZNER_API_KEY
:
An API key generated from Hetzner cloud console. Note that only servers that are in the API project will be available to manage.
Using docker run
:
docker run -e BOT_TOKEN=<BOT_TOKEN> -e ALLOWED_USERS=<ALLOWED_USERS> -e HETZNER_API_KEY=<HETZNER_CLOUD_API> navid2zp/hcloud-tg
Using docker-compose
:
create a docker-compose.yml
file:
version: "3.9"
services:
hcloud-tg:
container_name: hcloud-tgbot
image: navid2zp/hcloud-tg
env_file: ./env.list
restart: always
create a file containing environment variables named env.list
next to docker-compose.yml
:
BOT_TOKEN=<YOUR_BOT_TOKEN>
ALLOWED_USERS=<ALLOWED_USERS>
HETZNER_API_KEY=<YOUR_HETZNER_API_KEY>
and then run: docker-compose up
Add the required environment variables and then:
git clone https://github.com/Navid2zp/hcloud-tg.git
cd hcloud-tg
pip install -r requirements.txt
python bot.py
- reset
- reboot
- shutdown
- power on
- power off
- root password reset
https://hub.docker.com/r/navid2zp/hcloud-tg
MIT