compose.yml•4.19 kB
services:
# VyOS Router instance
vyos-router:
# Note: vyos/vyos-build:current is for building VyOS, not running it
# For production use, create a VyOS runtime image from ISO per:
# https://docs.vyos.io/en/latest/installation/virtual/docker.html
image: docker.io/vyos/vyos-build:current
container_name: vyos-router
hostname: vyos-router
privileged: true
restart: unless-stopped
# Network configuration
networks:
vyos-network:
ipv4_address: 192.168.100.10
# Port mappings for VyOS services
ports:
- "2222:22" # SSH access to VyOS
- "8443:443" # HTTPS API
# Volume mounts
volumes:
# Mount kernel modules for VyOS functionality
- /lib/modules:/lib/modules:ro
# VyOS configuration script
- "./vyos-config:/config/scripts:ro"
# Workspace for development and testing
- "./vyos-workspace:/workspace:rw"
# Environment for VyOS
environment:
- VYOS_API_KEY=vyos-mcp-secret-key
- DEBIAN_FRONTEND=noninteractive
# Start VyOS system from build image
# The vyos/vyos-build:current image contains a complete VyOS system
command: ["/sbin/init"]
# Initialize VyOS with our configuration
entrypoint: |
sh -c '
# Start VyOS system
/sbin/init &
# Wait for VyOS to be ready
sleep 60
# Run configuration script if it exists
if [ -f /config/scripts/boot.sh ] && [ -x /opt/vyatta/sbin/vyatta-cfg-cmd-wrapper ]; then
chmod +x /config/scripts/boot.sh
/config/scripts/boot.sh || echo "Boot script failed, continuing..."
fi
# Keep container running
wait
'
# Health check for VyOS API
healthcheck:
test: ["CMD", "curl", "-f", "-k", "https://localhost:443/retrieve", "-H", "Content-Type: application/json", "-d", "{\"data\": {\"path\": [\"system\", \"host-name\"]}, \"key\": \"vyos-mcp-secret-key\"}", "--connect-timeout", "5"]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
# Resource limits for VyOS
deploy:
resources:
limits:
memory: 2G
cpus: "1.0"
reservations:
memory: 512M
cpus: "0.5"
# MCP Server
vyos-mcp:
build:
context: .
dockerfile: Containerfile
container_name: vyos-mcp-server
hostname: vyos-mcp-server
restart: unless-stopped
# Network configuration
networks:
vyos-network:
ipv4_address: 192.168.100.20
# Port mappings for MCP server
ports:
- "8080:8080" # MCP server
# Volume mounts for development
volumes:
# Optional: development mount for live code changes
- "./src:/opt/vyos-mcp/src:ro"
# Environment variables for MCP server
environment:
- VYOS_API_KEY=vyos-mcp-secret-key
- VYOS_HOST=vyos-router
- VYOS_PORT=443
- VYOS_PROTOCOL=https
- MCP_PORT=8080
- MCP_HOST=0.0.0.0
- NODE_ENV=development
# Wait for VyOS to be ready
depends_on:
vyos-router:
condition: service_healthy
# Resource limits for MCP server
deploy:
resources:
limits:
memory: 512M
cpus: "0.5"
reservations:
memory: 128M
cpus: "0.1"
# Management/testing container
vyos-client:
image: alpine:latest
container_name: vyos-client
command: sleep infinity
networks:
vyos-network:
ipv4_address: 192.168.100.30
# Install useful tools
entrypoint: |
sh -c '
apk add --no-cache curl jq openssh-client &&
exec sleep infinity
'
depends_on:
vyos-router:
condition: service_healthy
vyos-mcp:
condition: service_healthy
volumes:
- "./tests:/tests:ro"
networks:
vyos-network:
driver: bridge
ipam:
config:
- subnet: 192.168.100.0/24
gateway: 192.168.100.1
driver_opts:
com.docker.network.bridge.name: vyos-br0
volumes:
vyos-config:
driver: local