Add docker-compose support with environment variable configuration

- Create docker-compose.yml with server and agent services
- Add environment variable support to Dockerfiles via entrypoint scripts
- Configure server with ADDR, PORT, USERNAME, PASSWORD vars
- Configure agent with SERVER, INTERVAL, AGENT_ID vars
- Add health check to server service for container orchestration
- Add service dependencies to ensure server starts before agent
- Create .dockerignore to optimize Docker builds
- Update QUICKSTART.md with Docker Compose instructions
- Support running server only, agent only, or full stack
- Support multiple agents with custom identifiers
This commit is contained in:
Ducky SSH User
2025-12-20 05:57:09 +00:00
parent 9184de0a1d
commit 98ecc61624
5 changed files with 216 additions and 5 deletions

View File

@@ -1,6 +1,45 @@
# Nerd Monitor - Quick Start Guide
## Building
## Docker Compose (Easiest)
The easiest way to get started is using Docker Compose:
### Run Full Stack (Server + Agent)
```bash
docker-compose up
```
Access the dashboard at: **http://localhost:8080**
### Run Server Only
```bash
docker-compose up server
```
### Run Agent Only (with external server)
```bash
SERVER=your-server:8080 docker-compose up agent
```
### Run Multiple Agents
```bash
# Start the server
docker-compose up -d server
# Run agents with custom IDs
docker-compose run --name agent1 -e AGENT_ID=machine1 agent
docker-compose run --name agent2 -e AGENT_ID=machine2 agent
```
### Docker Compose Configuration
Edit `docker-compose.yml` to customize:
- Server credentials: `USERNAME` and `PASSWORD`
- Agent reporting interval: `INTERVAL`
- Agent custom ID: `AGENT_ID`
## Native Binaries
### Building
```bash
# Build for current OS
@@ -111,6 +150,8 @@ Change these when starting the server:
./bin/nerd-monitor-server -username myuser -password mysecurepass
```
Or with Docker Compose, edit the `USERNAME` and `PASSWORD` environment variables in `docker-compose.yml`.
## Architecture
- **Server**: Web UI, API endpoint for agent stats, in-memory storage
@@ -134,3 +175,8 @@ Change these when starting the server:
- Verify server is running: `http://localhost:8080`
- Check firewall rules allow the agent port
- Ensure correct server address and port are specified
### Docker Compose agents can't reach server
- Verify server is healthy: `docker ps` (server should show healthy status)
- Check both containers are on the same network: `docker network inspect nerd-monitor`
- Ensure `SERVER` environment variable is set to `server:8080` (the service name)