Getting Started

From zero to a running Infra UI instance in minutes. This guide walks you through setup and agent management.

Overview

Infra UI is a modern infrastructure management platform built with FastAPI and DDD. It monitors containers, manages access, and orchestrates deployments. The platform includes an optional agent for remote host management and security scanning.

Platform features: Container orchestration, real-time monitoring, security scanning, IAM, multi-tenant isolation, and agent management.

Prerequisites

RequirementVersion
Docker24+
Docker Composev2+
Python3.12+ (for agent)
BrowserModern (Chrome, Firefox, Edge)

Setup

1. Install

Pull the repository

 1git clone https://gitlab.com/fastapi6653130/anjou15-community.git (incoming)
 2cd anjou15-community

2. Configure

Set your environment variables in the .env file:

# Database
DATABASE_URL=postgresql://fastapi:fastapi@localhost:5432/infra_ui_db
REDIS_URL=redis://localhost:6379
RABBITMQ_URL=amqp://guest:guest@localhost:5672
SECRET_KEY=change-me-in-production

3. Launch

start all services with Docker Compose:

 3make start
 4make start-py
Tip: If PostgreSQL runs on a Windows host from WSL, use the Windows host IP or enable mirrored networking in .wslconfig.

4. Deploy

Open the dashboard in your browser and start managing your infrastructure:

URL: http://localhost:9000

(Pro) Navigate to Admin → Agents to register and manage remote agents.

(Pro)Manage Agents

Infra UI includes an agent management platform for registering, monitoring, and controlling remote hosts. Agents communicate with the API via HTTPS to send heartbeats, receive commands, and report system metrics.

Architecture

Agents run a lightweight process that communicates with the Infra UI API. Each agent authenticates using a registration token and can be managed through the web dashboard or REST API.

┌──────────────────┐         ┌──────────────────┐
│   Agent (remote) │  HTTPS  │   Infra UI API   │
│                  │────────>│   localhost:9000  │
│  - Heartbeat     │         │                   │
│  - Commands      │<────────│  - Register agents│
│  - Metrics       │         │  - Assign tasks   │
└──────────────────┘         │  - Store data     │
                             └──────────────────┘

Installing the Agent

The agent is available as a Python package in its own repository:

From source

1# Clone and install
2git clone https://gitlab.com/fastapi6653130/infra-agent.git && cd infra_agent
3pip install -e ".[dev]"

Or with uv:

1uv sync

See agent_management_guide.md for a standalone binary build (PyInstaller) and scanner installation details.

Registering an Agent

Agents can be registered through the web UI or directly via the API.

Via the Web UI

  1. Go to Admin → Agents

    Navigate to /admin/agents in the dashboard.

  2. Click New Agent

    Open the creation form from the agents table.

  3. Fill in the details

    Provide a hostname (unique identifier), display name, OS (linux/windows/macos), architecture (amd64/arm64), and agent version.

  4. Create

    The agent appears with PENDING status until it connects.

Via the API

1curl -X POST http://localhost:9000/admin/agents \
2  -H "Content-Type: application/x-www-form-urlencoded" \
3  -d "hostname=wsl-ubuntu&os=linux&architecture=amd64&agent_version=1.0.0"

Agent Actions

Agents can be edited or deleted from the agents table in the web UI:

Registration Tokens

Tokens are used by agents to authenticate during registration. Generate one via the web UI or API.

Generating a Token

  1. Navigate to Admin → Tokens (/admin/agents/tokens).
  2. Click Generate Token.
  3. Set the expiration date in the modal (default: 1 hour).
  4. Click Generate and copy the token — it's shown only once.

Tokens can be deleted from the table using the Delete button (visible on all tokens regardless of status).

Using a Token (Agent-Side)

1curl -X POST http://localhost:9000/api/v1/agents/register \
2  -H "Content-Type: application/json" \
3  -d '{
4    "hostname": "wsl-ubuntu",
5    "token": "<your-registration-token>",
6    "os": "linux",
7    "architecture": "amd64",
8    "agent_version": "1.0.0"
9  }'

Agent Status

StatusMeaning
PENDINGRegistered but never connected
ONLINEConnected and sending heartbeats
OFFLINEProcess stopped, killed, or reported shutdown
An agent stays ONLINE as long as its process runs and keeps sending heartbeats. It only goes OFFLINE when it reports a graceful shutdown (POST /api/v1/agents/shutdown, called from the daemon's SIGTERM/SIGINT handler) or, as a safety net, after a long silence (24h, e.g. after kill -9). A single missed heartbeat no longer drops the agent.

Sending Commands

Commands can be sent to agents through the web UI or the REST API.

Via the Web UI

  1. Go to Admin → Agents.
  2. Click the Terminal icon on an agent row.
  3. View command history and results.

Via the API

1# Send a command to an agent
2curl -X POST http://localhost:9000/api/agents/<agent_id>/commands \
3  -H "Content-Type: application/json" \
4  -d '{"command": "uname -a"}'
Commands are executed asynchronously. The agent picks up queued commands on its next poll cycle.

Agent Daemon (Transport Layer)

The infra-agent repository (gitlab.com/fastapi6653130/infra-agent.git) includes a transport layer that runs as a background daemon, continuously communicating with the Infra UI API. See Installing the Agent to get it.

Daemon Flow

  1. Read config

    The agent reads its configuration (token, API URL, intervals).

  2. Register

    Calls POST /api/v1/agents/register with the token → receives agent_id and server configuration.

  3. Start background loops

    Three concurrent loops run: Heartbeat (every 30s), Container report (every 60s, if Docker SDK installed), Command poll (every 15s).

Running as a Daemon

1# Set token and start
2AGENT_REGISTRATION_TOKEN="AGT_xxx" python -m agent --daemon

3# Or via config file
4cat > agent.yaml << EOF
api_url: "http://localhost:9000"
registration_token: "AGT_xxx"
heartbeat_interval: 30
container_report_interval: 60
command_poll_interval: 15
EOF

5python -m agent --daemon -c agent.yaml

Config Options (Environment Variables or YAML)

VariableDefaultDescription
AGENT_API_URLhttp://localhost:9000Infra UI API base URL
AGENT_REGISTRATION_TOKEN""Token for agent registration
AGENT_HEARTBEAT_INTERVAL30Heartbeat interval in seconds
AGENT_CONTAINER_REPORT_INTERVAL60Container report interval in seconds
AGENT_COMMAND_POLL_INTERVAL15Command poll interval in seconds

The agent also reads heartbeat from the server's registration response, overriding the local config value.

Heartbeat & Graceful Shutdown

While the process runs, send heartbeats to stay ONLINE. On SIGTERM/SIGINT, call the shutdown endpoint so the agent goes OFFLINE immediately:

1# Periodic heartbeat (agent-side)
2curl -X POST http://localhost:9000/api/v1/agents/heartbeat \
3  -H "Content-Type: application/json" \
4  -d '{"agent_id": "<agent_id>", "hostname": "wsl-ubuntu"}'

5# Graceful shutdown (on SIGTERM/SIGINT)
6curl -X POST http://localhost:9000/api/v1/agents/shutdown \
7  -H "Content-Type: application/json" \
8  -d '{"agent_id": "<agent_id>", "hostname": "wsl-ubuntu"}'

IAM & RBAC

Infra UI provides two layers of access control: coarse-grained identity roles and granular resource-level RBAC permissions.

Overview

LayerModulePurpose
Identity RoleIdentityCoarse-grained user level (admin, editor, user, metrics)
IAM Roles & PermissionsIAMGranular resource-level RBAC (resource:action pairs)
Identity Role = who you are (admin, editor, user, metrics) — bypasses all IAM checks when set to admin. IAM Permissions = what you can do (container:create, monitoring:read, etc.) — evaluated for non-admin users.

Roles vs Groups

IAM Role

An IAM Role is a template of permissions. It defines what actions are allowed on which resources.

FieldDescription
nameRole name (e.g. "container-manager", "viewer")
descriptionHuman-readable description
is_defaulttrue for system roles (admin, editor, user, metrics), false for custom RBAC roles
permissionsList of Permission objects (resource:action pairs)

System roles are seeded automatically: admin, editor, user, metrics. Custom RBAC roles are created via the IAM UI for fine-grained control.

Group

A Group is a tenant-scoped container that bundles IAM roles together and assigns them to users.

FieldDescription
nameGroup name (e.g. "devops-team", "readonly-auditors")
descriptionHuman-readable description
tenant_idTenant this group belongs to (from the tenant switcher)
rolesList of IAM Roles assigned to this group

The relationship flows as:

User → Group → Roles → Permissions
  1. Create Permissions — e.g. container:create, monitoring:read
  2. Create an IAM Role — attach permissions (e.g. "Container Manager" gets container:create, container:read, container:update)
  3. Create a Group — attach IAM roles (e.g. "DevOps Team" gets the "Container Manager" role)
  4. Assign users to the Group — they inherit all permissions from the group's roles

Permission Model

Each Permission is a pair of Resource × Action.

Resources

ValueDescription
tenantTenant settings and configuration
applicationApplication catalog
securitySecurity monitoring
containerContainer management
monitoringMetrics and monitoring
auditAudit logs
notificationNotifications
userUser management
roleRole management
groupGroup management
api_tokenAPI token management
settingsSystem settings
*All resources (wildcard)

Actions

ValueDescription
createCreate new resources
readView/read resources
updateModify existing resources
deleteRemove resources
manageFull management (all CRUD)
scanScan/inspect resources
approveApprove changes
exportExport data
importImport data
assignAssign resources to users/groups
*All actions (wildcard)

Examples

PermissionMeans
container:createCan create containers
monitoring:readCan view monitoring data
user:*Full control over users
*:readCan read anything
*:*Full access to everything

Assigning Permissions to a Role

Via the IAM Web UI

  1. Go to IAM & RBAC in the sidebar
  2. Click the Permissions tab → New Permission — fill in name, resource (dropdown: container, monitoring, tenant, etc., or * for all), action (create, read, update, delete, manage, or *)
  3. Click the Roles tab → New Role — fill in name and description
  4. Use the API to attach permissions to the role

Via the API

1# List available permissions
2GET /iam/permissions

3# Create a role with permissions
4POST /iam/roles
5{
6  "name": "container-manager",
7  "description": "Can manage containers",
8  "is_default": false,
9  "permission_ids": ["uuid-of-container:create", "uuid-of-container:read"]
10}

11# Update a role's permissions
12PUT /iam/roles/{role_id}
13{
14  "permission_ids": ["uuid-of-perm1", "uuid-of-perm2"]
15}

Tenant Isolation

Groups are scoped to a tenant. When you select a tenant via the tenant switcher and go to IAM & RBAC → Groups, any group you create is automatically assigned to that tenant.

Roles and Permissions are global (shared across all tenants). The same "Container Manager" role can be used in multiple tenants' groups.

Quick Reference — Creating a User

  1. Go to Users page (/admin → Users section)
  2. Click New User
  3. Fill in email, password
  4. Select an Identity Role (admin / editor / user / metrics)
  5. The user can now log in with that base access level
  6. For finer control, create IAM groups and add the user via the API:
    1POST /iam/groups/{group_id}/members
    2{ "user_id": 123 }