Getting expense details by folder | Yandex Cloud.
Watch the Bot usage demo video
Build and run the bot inside docker container.
export IMAGE=yandex-cloud-billing-analysis-bot:dev-1.0.0
docker build -t $IMAGE -f Dockerfile .
docker run --detach --rm \
--name yandex-cloud-billing-analysis-bot \
$IMAGE
Get container logs:
docker logs -f yandex-cloud-billing-analysis-bot
Enter into container by root
user:
docker exec -it -u root yandex-cloud-billing-analysis-bot /bin/bash
Telegram users that can communicate with this bot handled by sqlite3 database.
sqlite3 ./bot/sql/db.sqlite3
Table DDL:
CREATE TABLE authusers (
telegram_id INTEGER PRIMARY KEY,
is_active INTEGER DEFAULT 0
);
Insert authenticated users;
INSERT INTO authusers(telegram_id, is_active) VALUES
(196255068, 1),
(196255069, 1),
(196255070, 1);
To disable inserted user access to the bot set is_active
to 0 with corresponding value of telegram_id
:
UPDATE authusers
SET is_active = 0
WHERE 1=1
AND telegram_id = 196255068;
The bot will run in docker container on virtual machine based on container optimazied image.
I deployed VM using Terraform.
cd ./deploy
Allow direnv
to load environment variables from .envrc
:
direnv allow
Initialize terraform:
terraform init
Validate configurations:
terraform validate
Deploy:
terraform apply
Terraform output countains usefull informations, such as virtual machine public IP address and user password.
To show terraform output:
terraform output
Or in JSON format:
terraform output -json
- Add handler to get report for the particular date
- Add background job that will send message when balance goes below certain threshold