Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions control-plane/Dockerfile.dev

This file was deleted.

9 changes: 3 additions & 6 deletions control-plane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,20 @@ go run ./cmd/server

Visit `http://localhost:8080/ui/` to access the embedded admin UI.

## Local Docker Development
## Local Development with Hot-Reload

For development with hot-reload, use the `dev.sh` script. This automatically rebuilds and restarts the server when Go files change.

```bash
cd control-plane
./dev.sh # SQLite mode (default, no dependencies)
./dev.sh postgres # PostgreSQL mode
./dev.sh down # Stop containers
./dev.sh clean # Stop and remove volumes
./dev.sh postgres # PostgreSQL mode (set AGENTFIELD_DATABASE_URL first)
```

The server runs at `http://localhost:8080` and will automatically reload when you modify `.go`, `.yaml`, or `.yml` files.

**Notes:**
- Uses [Air](https://github.com/air-verse/air) for hot-reload
- Go build cache is persisted in Docker volumes for faster rebuilds
- Uses [Air](https://github.com/air-verse/air) for hot-reload (auto-installed if missing)
- Web UI is not included in dev mode; run `npm run dev` separately in `web/client/` if needed

## Configuration
Expand Down
35 changes: 18 additions & 17 deletions control-plane/dev.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
#!/bin/bash
# Start control plane in Docker with hot-reload
# Start control plane with hot-reload using Air
#
# Usage:
# ./dev.sh # SQLite mode (default)
# ./dev.sh postgres # PostgreSQL mode
# ./dev.sh down # Stop containers
# ./dev.sh clean # Stop and remove volumes
# ./dev.sh # Start with hot-reload (SQLite mode)
# ./dev.sh postgres # Start with PostgreSQL (set AGENTFIELD_DATABASE_URL first)
#
# Prerequisites:
# go install github.com/air-verse/air@v1.61.7

set -e
cd "$(dirname "$0")"

# Check if air is installed
if ! command -v air &> /dev/null; then
echo "Air not found. Installing..."
go install github.com/air-verse/air@v1.61.7
fi

case "${1:-}" in
postgres|pg)
echo "Starting control plane with PostgreSQL..."
docker compose -f docker-compose.dev.yml --profile postgres up
;;
down|stop)
echo "Stopping containers..."
docker compose -f docker-compose.dev.yml --profile postgres down
;;
clean)
echo "Stopping and removing volumes..."
docker compose -f docker-compose.dev.yml --profile postgres down -v
echo "Starting control plane with PostgreSQL (hot-reload)..."
export AGENTFIELD_STORAGE_MODE=postgresql
air -c .air.toml
;;
*)
echo "Starting control plane with SQLite..."
docker compose -f docker-compose.dev.yml up
echo "Starting control plane with SQLite (hot-reload)..."
export AGENTFIELD_STORAGE_MODE=local
air -c .air.toml
;;
esac
87 changes: 0 additions & 87 deletions control-plane/docker-compose.dev.yml

This file was deleted.

Loading