-
Notifications
You must be signed in to change notification settings - Fork 2
[FEAT] Add platform documentation #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Deploy Documentation | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'docs/**' | ||
| - 'mkdocs.yml' | ||
| - '.github/workflows/docs-deploy.yml' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| deployments: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
| cache: 'pip' | ||
| cache-dependency-path: 'docs/requirements.txt' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r docs/requirements.txt | ||
|
|
||
| - name: Build documentation | ||
| run: mkdocs build | ||
|
|
||
| - name: Deploy to Cloudflare Pages | ||
| uses: cloudflare/pages-action@v1 | ||
| with: | ||
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | ||
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | ||
| projectName: chatops-docs | ||
| directory: site | ||
| gitHubToken: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,3 +81,7 @@ htmlcov/ | |
|
|
||
| # Architecture | ||
| ARCHITECTURE.md | ||
|
|
||
| # Documentation | ||
| site/ | ||
| .cache/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Documentation | ||
| site/ | ||
| .cache/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Documentation | ||
|
|
||
| This directory contains the MkDocs documentation for ChatOps. | ||
|
|
||
| ## Building Locally | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - Python 3.12+ | ||
| - pip | ||
|
|
||
| ### Setup | ||
|
|
||
| ```bash | ||
| # Install dependencies | ||
| pip install -r requirements-docs.txt | ||
|
martian56 marked this conversation as resolved.
|
||
|
|
||
| # Serve documentation locally | ||
| mkdocs serve | ||
| ``` | ||
|
|
||
| The documentation will be available at `http://localhost:8000` | ||
|
|
||
| ### Build Static Site | ||
|
|
||
| ```bash | ||
| mkdocs build | ||
| ``` | ||
|
|
||
| The static site will be generated in the `site/` directory. | ||
|
|
||
| ## Documentation Structure | ||
|
|
||
| - `index.md` - Homepage | ||
| - `getting-started/` - Getting started guides | ||
| - `architecture/` - System architecture | ||
| - `api/` - API documentation | ||
| - `agent/` - Agent documentation | ||
| - `frontend/` - Frontend documentation | ||
| - `technologies/` - Technology stack | ||
| - `deployment/` - Deployment guides | ||
| - `contributing/` - Contribution guidelines | ||
|
|
||
| ## Deployment | ||
|
|
||
| Documentation is automatically deployed to Cloudflare Pages on push to `main` branch. | ||
|
|
||
| See `.github/workflows/docs-deploy.yml` for deployment configuration. | ||
|
|
||
| ## Contributing | ||
|
|
||
| When adding or updating documentation: | ||
|
|
||
| 1. Edit the relevant `.md` file | ||
| 2. Test locally with `mkdocs serve` | ||
| 3. Commit and push | ||
| 4. Documentation will be automatically deployed | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # Agent Configuration | ||
|
|
||
| Configuration options for the ChatOps agent. | ||
|
|
||
| ## Configuration Methods | ||
|
|
||
| ### Command-line Flags | ||
|
|
||
| ```bash | ||
| ./chatops-agent \ | ||
| -api-key YOUR_API_KEY \ | ||
| -api-url https://your-chatops-instance.com | ||
| ``` | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| ```bash | ||
| export CHATOPS_API_KEY="your-api-key-here" | ||
| export CHATOPS_API_URL="https://your-chatops-instance.com" | ||
| ./chatops-agent | ||
| ``` | ||
|
|
||
| ### Config File | ||
|
|
||
| Create a JSON config file: | ||
|
|
||
| ```json | ||
| { | ||
| "api_key": "your-api-key-here", | ||
| "api_url": "https://your-chatops-instance.com" | ||
| } | ||
| ``` | ||
|
|
||
| Use with: | ||
| ```bash | ||
| ./chatops-agent -config /path/to/config.json | ||
| ``` | ||
|
|
||
| ## Configuration Options | ||
|
|
||
| ### API Key | ||
|
|
||
| - **Required**: Yes | ||
| - **Flag**: `-api-key` | ||
| - **Env**: `CHATOPS_API_KEY` | ||
| - **Description**: API key for authentication | ||
|
|
||
| ### API URL | ||
|
|
||
| - **Required**: No (default: https://chatops.onrender.com) | ||
| - **Flag**: `-api-url` | ||
| - **Env**: `CHATOPS_API_URL` | ||
| - **Description**: ChatOps API server URL | ||
|
|
||
| ## Defaults | ||
|
|
||
| - **API URL**: `https://chatops.onrender.com` | ||
| - **Metrics Interval**: 5 seconds | ||
| - **Reconnection Delay**: Exponential backoff starting at 1 second | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Installation Guide](installation.md) | ||
| - [Development Guide](development.md) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Agent Development | ||
|
|
||
| Development guide for the ChatOps agent. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - Go 1.24+ | ||
| - Docker (optional, for testing Docker features) | ||
|
|
||
| ## Building | ||
|
|
||
| ```bash | ||
| cd agent | ||
| go build -o chatops-agent ./main.go | ||
| ``` | ||
|
|
||
| ## Running Locally | ||
|
|
||
| ```bash | ||
| ./chatops-agent -api-key YOUR_API_KEY -api-url http://localhost:8000 | ||
| ``` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| agent/ | ||
| ├── main.go # Entry point | ||
| ├── internal/ | ||
| │ ├── agent/ # Agent core logic | ||
| │ ├── api/ # API client | ||
| │ ├── config/ # Configuration | ||
| │ ├── metrics/ # Metrics collection | ||
| │ └── pkg/ # Shared packages | ||
| └── package/ # Packaging scripts | ||
| ``` | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| go test ./... | ||
| ``` | ||
|
|
||
| ## Contributing | ||
|
|
||
| 1. Follow Go best practices | ||
| 2. Write tests for new features | ||
| 3. Update documentation | ||
| 4. Submit pull request | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Installation Guide](installation.md) | ||
| - [Configuration Guide](configuration.md) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # Agent Documentation | ||
|
|
||
| The ChatOps agent is a lightweight Go application that runs on each monitored server. | ||
|
|
||
| ## Overview | ||
|
|
||
| The agent is responsible for: | ||
|
|
||
| - **Metrics Collection**: CPU, memory, disk, and network metrics every 5 seconds | ||
| - **Docker Management**: Container lifecycle operations | ||
| - **Command Execution**: Remote command execution via WebSocket | ||
| - **Real-time Communication**: Bidirectional WebSocket connection to API | ||
|
|
||
| ## Features | ||
|
|
||
| - ✅ Lightweight and efficient (single binary) | ||
| - ✅ Low resource usage | ||
| - ✅ Automatic reconnection | ||
| - ✅ Secure API key authentication | ||
| - ✅ Docker integration | ||
| - ✅ System metrics collection | ||
| - ✅ Command execution with output capture | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────┐ | ||
| │ Go Agent │ | ||
| ├─────────────────────────────────────────┤ | ||
| │ Components │ | ||
| │ ├── Metrics Collector │ | ||
| │ │ ├── CPU │ | ||
| │ │ ├── Memory │ | ||
| │ │ ├── Disk │ | ||
| │ │ └── Network │ | ||
| │ ├── Docker Client │ | ||
| │ ├── WebSocket Client │ | ||
| │ └── Command Executor │ | ||
| ├─────────────────────────────────────────┤ | ||
| │ Communication │ | ||
| │ ├── WebSocket Connection │ | ||
| │ ├── Authentication (API Key) │ | ||
| │ └── Message Protocol │ | ||
| └─────────────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| 1. **Get an API Key**: Create one in the web interface | ||
| 2. **Download Agent**: Get the binary for your platform | ||
| 3. **Run Agent**: `./chatops-agent -api-key YOUR_KEY` | ||
| 4. **Verify**: Check the web interface for metrics | ||
|
|
||
| See [Installation Guide](installation.md) for detailed instructions. | ||
|
|
||
| ## Configuration | ||
|
|
||
| The agent can be configured via: | ||
|
|
||
| - **Command-line flags**: `-api-key`, `-api-url` | ||
| - **Environment variables**: `CHATOPS_API_KEY`, `CHATOPS_API_URL` | ||
| - **Config file**: JSON configuration file (optional) | ||
|
|
||
| See [Configuration Guide](configuration.md) for details. | ||
|
|
||
| ## Communication Protocol | ||
|
|
||
| ### Agent → API | ||
|
|
||
| **Message Types**: | ||
| - `auth`: Initial authentication | ||
| - `metrics`: System metrics data | ||
| - `command_response`: Command execution result | ||
| - `docker_response`: Docker operation result | ||
|
|
||
| ### API → Agent | ||
|
|
||
| **Message Types**: | ||
| - `auth_success`: Authentication confirmation | ||
| - `command`: Command execution request | ||
| - `docker_command`: Docker operation request | ||
|
|
||
| ## Metrics Collection | ||
|
|
||
| The agent collects the following metrics every 5 seconds: | ||
|
|
||
| - **CPU**: Usage percentage per core | ||
| - **Memory**: Total, used, available, percentage | ||
| - **Disk**: Usage per filesystem | ||
| - **Network**: Bytes sent/received per interface | ||
|
|
||
| ## Docker Support | ||
|
|
||
| The agent can manage Docker containers if Docker is installed: | ||
|
|
||
| - List containers | ||
| - Start/stop/restart containers | ||
| - Get container logs | ||
| - Container status information | ||
|
|
||
| ## Security | ||
|
|
||
| - **API Key Authentication**: Secure key-based authentication | ||
| - **WebSocket Encryption**: TLS/SSL encryption in production | ||
| - **No Root Required**: Agent can run as non-root user | ||
| - **Minimal Permissions**: Only requires necessary system access | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| Common issues and solutions: | ||
|
|
||
| - **Connection Failed**: Check API URL and network connectivity | ||
| - **Authentication Failed**: Verify API key is correct and active | ||
| - **No Metrics**: Ensure agent has necessary system permissions | ||
| - **Docker Not Working**: Verify Docker is installed and accessible | ||
|
|
||
| ## Next Steps | ||
|
|
||
| - [Installation Guide](installation.md) | ||
| - [Configuration Guide](configuration.md) | ||
| - [Development Guide](development.md) | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.