A centralized management system for a fleet of Caddy instances acting as reverse proxies on anycast edge nodes, enabling dynamic configuration updates, versioning, and rollback capabilities via a web UI and an internal API.
- Centralized Configuration Management: Manage Caddy configurations from a single control plane
- Version Control: Track configuration changes with automatic versioning
- Rollback Capability: Easily rollback to previous configurations
- Multi-Instance Sync: Push configurations to multiple Caddy instances simultaneously
- Real-time Status: Monitor sync status and health of all Caddy instances
- RESTful API: Complete API for programmatic management
- Embedded Web UI: Modern Remix-based interface built into the binary
- Teleport Controller: Single Go binary with embedded web UI and API server
- SQLite Database: Stores configurations, slave details, and version history
- Caddy Slaves: Standard Caddy instances running with default config on edge nodes
Teleport Controller β Caddy Admin API β Caddy Slaves
- Teleport runs on ONE host (your management server)
- Caddy slaves run standard Caddy with default/blank config on edge nodes
- Teleport pushes configurations to slaves via Caddy's built-in admin API (port 2019)
- Communication over WireGuard ensures secure connectivity between controller and slaves
- No special Caddy setup required - slaves just need admin API enabled (default)
- Web Browser β Teleport (port 3333): Embedded web UI served by Teleport
- Teleport β Caddy Admin API (port 2019): Configuration management via HTTP
- All config pushes are async with proper error handling and rollback capabilities
- Go 1.21 or later
- Caddy instances with admin API enabled (default)
- WireGuard network connectivity to Caddy instances
π WireGuard Setup Required: See WIREGUARD-SETUP.md for detailed instructions on setting up secure tunnels between your management server and edge nodes.
- Clone the repository:
git clone <repository-url>
cd teleport
- Install dependencies:
go mod tidy
- Create configuration file:
cp config.yaml.example config.yaml
- Build and run:
go build -o teleport cmd/teleport/main.go
./teleport
Or run directly:
go run cmd/teleport/main.go
For production deployment with systemd service:
# One-command deployment
sudo make deploy
See DEPLOYMENT.md for detailed production deployment instructions.
The application can be configured via:
- Configuration file (
config.yaml
) - Environment variables (prefixed with
TELEPORT_
) - Command line flags
Example configuration:
server:
port: 3333
mode: development
database:
path: ./teleport.db
logging:
level: info
format: json
./teleport --help
--config, -c
: Configuration file path--port, -p
: Server port (default: 3333)--database, -d
: Database file path (default: ./teleport.db)
GET /api/v1/configurations/active
- Get current active configurationPOST /api/v1/configurations/active
- Set new active configurationGET /api/v1/configurations/history
- Get configuration historyGET /api/v1/configurations/history/{version_id}
- Get specific configurationPOST /api/v1/configurations/rollback/{version_id}
- Rollback to specific version
GET /api/v1/slaves
- List all slavesPOST /api/v1/slaves
- Add new slaveGET /api/v1/slaves/{slave_id}
- Get slave detailsPUT /api/v1/slaves/{slave_id}
- Update slaveDELETE /api/v1/slaves/{slave_id}
- Remove slavePOST /api/v1/slaves/{slave_id}/sync
- Force sync to specific slave
GET /api/v1/status
- Get system status and health
curl -X POST http://localhost:3333/api/v1/slaves \
-H "Content-Type: application/json" \
-d '{
"name": "edge-sgp-01",
"wireguard_ip": "10.0.1.10",
"caddy_admin_port": 2019,
"caddy_admin_api_scheme": "http",
"is_enabled": true
}'
curl -X POST http://localhost:3333/api/v1/configurations/active \
-H "Content-Type: application/json" \
-d '{
"json_config": "{\"apps\":{\"http\":{\"servers\":{\"example\":{\"listen\":[\":80\"],\"routes\":[{\"handle\":[{\"handler\":\"static_response\",\"body\":\"Hello World\"}]}]}}}}}",
"description": "Simple hello world configuration"
}'
id
: Unique configuration IDversion_id
: Human-readable version identifierjson_config
: Caddy JSON configurationdescription
: User-provided descriptioncreated_at
: Creation timestampis_active
: Whether this is the active configuration
id
: Unique slave IDname
: Human-readable slave namewireguard_ip
: WireGuard IP addresscaddy_admin_port
: Caddy admin API portcaddy_admin_api_scheme
: HTTP scheme (http/https)is_enabled
: Whether slave is enabled for syncinglast_known_config_version_id
: Last successfully applied configurationlast_sync_status
: Status of last sync attemptlast_sync_message
: Details of last sync attemptlast_sync_timestamp
: Timestamp of last sync attemptadded_at
: When slave was added
teleport/
βββ cmd/teleport/ # Main application entry point
βββ internal/
β βββ api/ # HTTP API handlers and routes
β βββ config/ # Configuration management
β βββ database/ # Database setup and migrations
β βββ models/ # Data models
β βββ service/ # Business logic services
βββ web/ # Frontend application (planned)
βββ config.yaml.example # Example configuration
βββ README.md
# Build using Makefile (recommended)
make build
# Or build manually
go build -o teleport ./cmd/teleport/main.go
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o teleport-linux ./cmd/teleport/main.go
# Build for multiple platforms
make build-all
If you encounter build errors on your production server:
# Run the debug script to identify issues
./debug-build.sh
# Run the fix script to resolve common problems
./fix-build.sh
# Manual troubleshooting
go mod tidy
go mod download
make build
Common issues:
- Module path errors: Ensure you're in the project root directory
- Go version: Requires Go 1.21+
- Module mode: Ensure
GO111MODULE=on
(default in Go 1.16+)
# Run tests
go test ./...
# Run tests with coverage
go test -cover ./...
Teleport includes automated systemd service installation:
# Install and start service
sudo make deploy
# Or step by step
sudo make install-service # Install service
sudo make start-service # Start service
sudo make status-service # Check status
The service includes security hardening and runs as a dedicated teleport
user.
FROM golang:1.21-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o teleport cmd/teleport/main.go
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/teleport .
COPY --from=builder /app/config.yaml.example ./config.yaml
EXPOSE 3333
CMD ["./teleport"]
- Ensure WireGuard network is properly secured
- Use HTTPS for production deployments
- Implement authentication for the API (planned feature)
- Regularly backup the SQLite database
- Monitor logs for suspicious activity
- Web UI implementation (Remix-based, embedded) β COMPLETED
- Single binary deployment with embedded assets β COMPLETED
- Authentication and authorization
- Configuration validation and testing
- Drift detection
- Webhook integration for Git-based workflows
- Metrics and monitoring integration
- Multi-tenant support
- Configuration templates and inheritance
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
[License information to be added]