This repo contains Python code of telegram bot and CI/CD code for deployig in dev/prod environments:
It is a python based app Telegram bot
-
Free weather API - bot uses free Open Weather API
-
Weather autosend function - bot sends Weather at desired time.
- Linux based OS
- Terraform >= 1.0
- Docker
- Anchore Grype tool
- HashiCorp Vault
- HashiCorp Nomad
- Github runner
- poetry
- Python > 3.7
- pip
---
title: Scheme
---
graph TD
X[user]
subgraph A[GitHuB]
B[Repository]
end
subgraph C[Linux VM]
direction TB
subgraph D[NOMAD Cluster]
E[PostgreSQL 15]
F[Weather Bot]
F <-.Storing data.-> E
end
F -- Get secrets and vars --> G
E -- Get secrets and vars-->G
D -- Get images-->A
subgraph G[Vault]
H[Secret1]
J[Secret2]
K[SecretN]
end
end
X <--> F
---
title: CI/CD Environments Logic
---
flowchart LR;
A[On push to DEV] --> B[Auto Deploy to Dev]
C[On PR merged into main] --> E[Nomad Plan]-->D[Auto start PROD deploying]
---
title: DEV/PROD Pipeline steps
---
flowchart LR;
A[Clean curent directory + \ndocker system prune] --> B[Checkout] --> C[Building Docker Image\n and push to registry] --> D[Check image\nby Anchore Grype] --> E[Rendering Terraform template\n for Nomad] -->F[Nomad job run]
- Dockerfile - to build app
- main.py - app core
- .github/ - CI/CD workflow
- bot.tpl - terraform template
- entrypoint.sh - entrypoint for container
- main.tf - terraform main file
- .pre-commit-config.yml - config for pre-commit tool
- requiremenets.txt - python packages for app
TBD
- Hourly weather may show the wrong hour, will be fixed in next releases.
- It is small possibility that bot sends auto message twice, default check interval 58 seconds.
GNU GPL v3