Skip to content

Installation & Setup

nyounan edited this page May 20, 2025 · 4 revisions

🛠️ Installation & Setup Guide

Welcome! This guide will help you install and run gcp-ops-bot locally, so you can start monitoring your Google Cloud environment and even chat with it using natural language via Google GenAI.


✅ Requirements

Make sure the following are installed on your machine:


1. Clone the Repository

Open a terminal and run:

git clone https://github.com/Retailogists/gcp-ops-bot.git
cd gcp-ops-bot

2. Create and Activate a Virtual Environment

On macOS / Linux

python3 -m venv venv
source venv/bin/activate

On Windows

python -m venv venv
venv\Scripts\activate

3. Install Dependencies

With your virtual environment activated, install the Python packages:

pip install -r requirements.txt

4. Create Your .env File

This file holds your config values (GenAI key, project ID, region, etc.).

Copy the template and fill in your values:

cp .env.example .env

Then edit .env:

GENAI_API_KEY=your_genai_api_key  # Optional if not using GenAI features
GCP_PROJECT_NUMBER=123456789012
GCP_PROJECT_ID=your-project-id
GCP_REGION=your_region_here
GCP_ZONE=your_zone_here

💡 If you're not using GenAI, you can leave the GENAI_API_KEY empty.


5. Authenticate with Google Cloud

This bot uses Application Default Credentials (ADC) to authenticate with GCP APIs.

Option A: Personal credentials (recommended for local development)

gcloud auth application-default login

Option B: Service account key (e.g. for CI/CD or production)

Generate and download a JSON key for your service account.

Then set the environment variable:

On macOS / Linux:

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/key.json"

On Windows:

set GOOGLE_APPLICATION_CREDENTIALS=C:\path\to\your\key.json

6. Run the Bot

Start the interactive monitoring bot:

python main.py

You’ll see:

GCP Monitoring Bot started. Type 'q', 'quit', or 'exit' to stop.
--------------------------------------------------
User :>

You can now enter natural language queries like:

List all custom service accounts in my project

🧪 First-Time Test

To verify that everything is working, run:

python main.py

And enter:

List VMs in us-central1-a

✅ If you get a valid response — you're all set!


🔗 Next Steps

  • Usage Guide: Learn how to use the bot with real prompts and examples.
  • Contributing: Want to improve this project? Here's how to get started.

Need help? Open an issue — we’re happy to help!