Skip to content
41 changes: 41 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://raw.githubusercontent.com/whilesmart/docs-kit/main/schema/docs.schema.json",
"name": "FlatRun Agent",
"description": "Lightweight Go backend for flat-file Docker Compose orchestration with a REST API, container lifecycle management, and plugin architecture",
"icon": "server",
"category": {
"language": "go",
"framework": "app"
},
"sidebar": [
{
"title": "Overview",
"path": "docs/overview.md"
},
{
"title": "Installation",
"path": "docs/installation.md"
},
{
"title": "Configuration",
"path": "docs/configuration.md"
},
{
"title": "API Reference",
"path": "docs/api-reference.md"
},
{
"title": "OpenAPI Spec",
"path": "docs/flatrun-agent-openapi.yaml"
},
{
"title": "Plugin Architecture",
"path": "docs/plugin-architecture.md"
},
{
"title": "Security",
"path": "docs/security.md"
}
],
"openapi": "docs/flatrun-agent-openapi.yaml"
}
43 changes: 43 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## API Reference

### Authentication

| Method | Endpoint | Description |
|---|---|---|
| POST | `/api/auth/login` | Login with API key |
| GET | `/api/auth/validate` | Validate JWT token |
| GET | `/api/auth/status` | Check auth status |

### Deployments

| Method | Endpoint | Description |
|---|---|---|
| GET | `/api/deployments` | List all deployments |
| POST | `/api/deployments` | Create new deployment |
| GET | `/api/deployments/:name` | Get deployment details |
| DELETE | `/api/deployments/:name` | Delete deployment |
| POST | `/api/deployments/:name/start` | Start deployment |
| POST | `/api/deployments/:name/stop` | Stop deployment |
| POST | `/api/deployments/:name/restart` | Restart deployment |
| GET | `/api/deployments/:name/logs` | Get deployment logs |

### Docker Resources

| Method | Endpoint | Description |
|---|---|---|
| GET | `/api/containers` | List containers |
| GET | `/api/images` | List images |
| GET | `/api/volumes` | List volumes |
| GET | `/api/networks` | List networks |
| POST | `/api/networks` | Create network |
| DELETE | `/api/networks/:name` | Delete network |

### Other

| Method | Endpoint | Description |
|---|---|---|
| GET | `/api/health` | Health check |
| GET | `/api/stats` | System statistics |
| GET | `/api/certificates` | List SSL certificates |
| GET | `/api/templates` | List Quick App templates |
| GET | `/api/plugins` | List installed plugins |
57 changes: 57 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Configuration

Copy the example configuration and edit it:

```bash
cp config.example.yml config.yml
```

### Reference

```yaml
deployments_path: /home/user/deployments

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example path /home/user/deployments is a user-specific path. For a system-wide agent, it's better to suggest a path like /var/lib/flatrun/deployments to match standard Linux directory hierarchies.

Suggested change
deployments_path: /home/user/deployments
deployments_path: /var/lib/flatrun/deployments

docker_socket: unix:///var/run/docker.sock

api:
host: 0.0.0.0
port: 8090
enable_cors: true
allowed_origins:
- http://localhost:5173
- http://localhost:3000

auth:
enabled: true
api_keys:
- "your-secure-api-key-here"
jwt_secret: "REPLACE_WITH_SECURE_RANDOM_STRING" # generate via: openssl rand -base64 32

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security risk: While the comment suggests generating a secret, providing a placeholder in a documentation snippet often leads to users leaving it as-is. It is safer to use a prompt that clearly indicates action is required.

Suggested change
jwt_secret: "REPLACE_WITH_SECURE_RANDOM_STRING" # generate via: openssl rand -base64 32
+ jwt_secret: "GENERATED_VIA_OPENSSL_RAND" # generate via: openssl rand -base64 32


nginx:
container_name: nginx
config_path: /deployments/nginx/conf.d

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration example uses /deployments/nginx/conf.d as a path, while the deployments_path at the top of the file suggests /home/user/deployments. This might confuse users about where the nginx configuration should reside relative to the deployments root.

Suggested change
config_path: /deployments/nginx/conf.d
config_path: /var/lib/flatrun/nginx/conf.d

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency issue: The config_path refers to /deployments/... but the global deployments_path (line 12) is defined as /home/user/deployments. Using relative paths or consistent absolute paths is recommended to prevent confusion.

Suggested change
config_path: /deployments/nginx/conf.d
config_path: /home/user/deployments/nginx/conf.d

reload_command: nginx -s reload

certbot:
container_name: certbot
email: your-email@example.com
staging: true

logging:
level: info
format: json

health:
check_interval: 30s
metrics_retention: 24h
```

### Key Options

| Option | Description |
|---|---|
| `deployments_path` | Directory containing docker-compose deployments |
| `api.port` | API server port (default: 8090) |
| `auth.api_keys` | Valid API keys for authentication |
| `auth.jwt_secret` | Secret for signing JWT tokens |
| `logging.level` | Log level: debug, info, warn, error |
| `health.check_interval` | Health check frequency |
Loading
Loading