sudo docker pull ghcr.io/orenlab/pytmbot:latest
sudo -i
cd /root/
touch .pytmbotenv
Then,
nano .pytmbotenv
And we insert the following content, first replacing <PUT YOUR VALUE HERE>
:
0.0.9
, 0.1.1
, latest
:# The bot token that you received from the BotFather:
BOT_TOKEN=<PUT YOUR VALUE HERE>
DEV_BOT_TOKEN=''
# Add your telegram IDs:
ALLOWED_USER_IDS=[00000000000, 00000000000]
# Set Docker Socket o TCP param. Usually: unix:///var/run/docker.sock:
DOCKER_HOST='unix:///var/run/docker.sock'
PODMAN_HOST=''
alpine-dev
tag:# The bot token that you received from the BotFather:
BOT_TOKEN=<PUT YOUR VALUE HERE>
# Add your telegram IDs:
ALLOWED_USER_IDS=[00000000000, 00000000000]
# Setting up administrative (full) access. This field is only required for the alpine-dev environment!
# For version 0.1.1 and earlier, this field may be omitted.
ALLOWED_ADMINS_IDS=[00000000000, 00000000000]
# Set Docker Socket o TCP param. Usually: unix:///var/run/docker.sock:
DOCKER_HOST='unix:///var/run/docker.sock'
# Salt is used to generate TOTP (Time-Based One-Time Password) secrets and to verify the TOTP code.
AUTH_SALT="PLS, INSERT HERE ONLY BASE32 string"
Then press Ctrl + X
followed by Y
to save your changes and exit the nano
editor.
Note about ‘AUTH_SALT’ parameter: If you are having trouble generating a “salt” for pyTMbot configuration file, I’ve
written a simple Python script to
help you with this task. Simply download the file from
the link and run it using the
following
command: python generate_salt.py
To launch a Docker container:
0.0.9
, 0.1.1
, latest
:sudo docker run -d -m 100M \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /root/.pytmbotenv:/opt/pytmbot/.pytmbotenv:ro \
--env TZ="Asia/Yekaterinburg" \
--restart=always \
--name=pytmbot \
--pid=host \
--security-opt=no-new-privileges \
orenlab/pytmbot:latest \
/venv/bin/python3 app/main.py --log-level=DEBUG --mode=prod
alpine-dev
tag:sudo docker run -d -m 100M \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /root/.pytmbotenv:/opt/pytmbot/.pytmbotenv:ro \
--env TZ="Asia/Yekaterinburg" \
--restart=always \
--name=pytmbot \
--pid=host \
--security-opt=no-new-privileges \
orenlab/pytmbot:latest \
--log-level=INFO --mode=prod
# | Logging levels | Note | Args |
---|---|---|---|
1 | INFO |
Balanced logging mode: only the most important information + a short description of errors and exceptions. | --log-level=INFO |
2 | ERROR |
Only errors and exceptions are shown. This can be considered a “quiet” mode. | --log-level=ERROR |
3 | DEBUG |
The most detailed level of logs provides all the information displayed in the previous levels, plus additional details, such as traces and all debugging information. | --log-level=DEBUG |
Please don’t forget to specify your time zone! You can find a list of available time zones, for example, here
Please don’t forget to specify Tag version!
Now everything is ready for you to use the bot. All you need to do is run the /start
command in your Telegram app.
In order to update the image to the latest version, please follow these steps:
sudo docker stop pytmbot
sudo docker rm /pytmbot
sudo docker rmi pytmbot
sudo docker pull ghcr.io/orenlab/pytmbot:latest
And we run it in the same way as we would if we had just installed the bot (see the instructions above).
sudo docker logs pytmbot
Alternatively, if the container is running on your workstation, you can use Docker Desktop.