Skip to content

Server Mode

The server component of Trailer.dev is responsible for coordinating workspace deployments and managing user access. It's available as a pre-built container:

bash
docker pull ghcr.io/trailer-dev/trailer:server

Features

  • Workspace coordination
  • User authentication
  • Access control
  • Resource management
  • Agent coordination

Configuration

Environment Variables

bash
TRAILER_SERVER_PORT=8090
TRAILER_SERVER_HOST=0.0.0.0
TRAILER_AUTH_ENABLED=true
TRAILER_AUTH_PROVIDER=local

Configuration File

yaml
server:
  port: 8090
  host: 0.0.0.0

security:
  auth:
    enabled: true
    provider: local

Running the Server

bash
docker run -d \
  -p 8090:8090 \
  ghcr.io/trailer-dev/trailer:server

Security

  • JWT-based authentication
  • Role-based access control
  • Workspace isolation
  • Secure communication

Integration

The server component integrates with:

  • Docker agents
  • Kubernetes agents
  • Web interface
  • Authentication providers

Key Features

Agent Management

  • Handles agent registration and authentication
  • Maintains agent connections via WebSocket
  • Coordinates resource allocation across agents
  • Monitors agent health and status

Resource Coordination

  • Manages container resources across agents
  • Handles resource allocation and scheduling
  • Maintains resource state consistency
  • Coordinates resource operations

API and Web Interface

  • Provides REST API endpoints
  • Serves the React-based web interface
  • Handles authentication and authorization
  • Manages user sessions and permissions

Database Management

  • Uses PocketBase for data storage
  • Manages user accounts and permissions
  • Stores resource configurations
  • Handles data migrations

Configuration

The server can be configured through:

  • Environment variables
  • Configuration file
  • Command-line flags

Default configuration:

  • Web interface port: 8090
  • WebSocket endpoint: ws://localhost:8090
  • Database location: ~/.local/share/trailer/data

Security

The server implements several security features:

  • Authentication system
  • Role-based access control
  • Secure WebSocket connections
  • API authentication
  • Resource isolation

API Endpoints

The server provides various API endpoints:

  • /api/auth/* - Authentication endpoints
  • /api/agents/* - Agent management
  • /api/resources/* - Resource management
  • /api/workspaces/* - Workspace operations

Web Interface

The server serves a modern web interface that provides:

  • Resource management dashboard
  • Agent status monitoring
  • Configuration management
  • User management
  • Real-time updates

Deployment Considerations

When deploying the server:

  • Ensure proper network access
  • Configure SSL/TLS for production
  • Set up proper authentication
  • Configure resource limits
  • Set up monitoring and logging

Released under the MIT License.