An AI-driven Site Reliability Engineering (SRE) bot powered by Google Gemini and Telegram. Gopher-Ops monitors your host system metrics (CPU, RAM) and allows you to perform basic triage and healing actions (start, stop, restart containers, clear cache) via a Telegram chat interface.
Designed with modern DevOps principles, it features Infrastructure as Code (IaC) provisioning via Terraform and automated CI/CD pipelines.
- Infrastructure as Code (IaC): Automated provisioning of a containerized lab environment (Nginx & stateful Redis cluster) using Terraform, complete with Custom Networks, Persistent Volumes, Variables, and Count loops for scaling.
- System Observability & SRE: Developed in Golang, the bot fetches real-time host metrics (CPU/RAM) and container statuses directly via the Docker API.
- Generative AI ChatOps: Integrated Google Gemini (2.5-flash-lite) to act as an intent parser. It understands natural language logs and triggers technical SRE actions in a casual "Gen-Z" persona to reduce operator cognitive load.
- Interactive Healing Actions: Parses AI intents to generate Human-in-the-loop (HITL) inline Telegram buttons, allowing the operator to start, stop, restart, or clear cache directly from chat.
- Robust CI/CD Pipeline: Configured with GitHub Actions for automated Go unit testing and Terraform validation/formatting upon every push/PR.
- Zero-Trust Security: Hardcoded Telegram Chat ID gating ensuring only the authorized operator can view metrics or execute system-level docker commands.
graph TD;
User[Operator / SRE] -->|Telegram Chat| Bot((Gopher-Ops Bot))
Bot <-->|Extract Intent & Persona| Gemini[Google Gemini AI]
Bot <-->|Fetch Metrics & Execute Actions| Docker[Docker Engine]
TF[Terraform IaC] -->|Provisions Lab| Docker
Docker --> Nginx[Nginx Web Server]
Docker --> Redis[Redis Cluster + Persistent Volume]
- Backend: Go (Golang), Docker API SDK, gopsutil
- AI / NLP: Google Generative AI (Gemini Flash-Lite)
- Infrastructure: Docker, Terraform (HCL)
- CI/CD: GitHub Actions
- Interface: Telegram Bot API
- Go 1.22+
- Docker running on the host machine.
- Terraform CLI installed.
- A Telegram Bot Token (from @BotFather).
- A Google Gemini API Key.
Clone the repository and set up your credentials:
git clone https://github.com/yourusername/gopher-ops.git
cd gopher-ops
cp .env.example .env
go mod tidyImportant: Update .env with your Gemini API key, Telegram Token, and your specific AUTHORIZED_CHAT_ID.
Deploy the dummy microservices (Nginx & Redis) for the bot to monitor:
cd terraform
terraform init
terraform apply -auto-approveThis will spin up gopher-ops-nginx-lab and scaled Redis nodes with persistent data volumes on a custom docker network.
Return to the root directory and boot up the SRE agent:
cd ..
go run cmd/main.goOnce the bot is running, simply PM it on Telegram to start managing your infrastructure:
- "Bro, check system health jap" -> Bot reads live CPU/RAM and lists the Terraform-provisioned containers.
- "Tolong stop container gopher-ops-nginx-lab" -> Bot understands the intent, verifies state, and provides a clickable inline
🛑 Stopbutton. - "Minta restart redis satu" -> Re-initializes specific containers directly across the Docker daemon.
This project binds to the host's Docker socket to execute real container lifecycles. Please ensure your AUTHORIZED_CHAT_ID is strictly configured to prevent unauthorized infrastructure manipulation.