# Server Management Tool This is a simple Go application designed to manage your servers, providing functionalities to list, wake up (Wake-on-LAN), shut down, and reboot them. It offers both a command-line interface (CLI) and a web-based interface for convenient management. ## Features - **Server Dashboard:** A responsive table view displaying all servers with real-time status, IP, and MAC addresses. - **Web Terminal:** Integrated xterm.js terminal for direct SSH access to your servers from the browser. - **Manage Power:** - **Wake-on-LAN:** Send magic packets to wake up offline servers. - **Shutdown/Reboot:** Gracefully restart or power off servers via SSH. - **Status Monitoring:** Reliable active health checks (ICMP ping) compatible with macOS and Linux. - **Server Management:** Add, edit, or remove servers directly from the UI. - **MAC Address Lookup:** Automatically discover MAC addresses for local servers. ## Prerequisites - [Go (1.24 or newer)](https://golang.org/doc/install) - [Docker](https://docs.docker.com/get-docker/) - `git` ## Getting Started (Local) 1. **Clone the repository:** ```bash git clone git@git.hnrx.net:hnrx/manage-servers.git cd manage-servers ``` 2. **Run the application:** ```bash go run . serve ``` The application will automatically create a configuration file (`servers.yaml` used by Viper) if one doesn't exist. Access the web interface at `http://localhost:8080`. ## Getting Started (Docker) The project uses standard Docker Hub images (`golang:latest` and `alpine:latest`). 1. **Build the image:** ```bash docker build -t manage-servers:latest . ``` 2. **Run the container:** For Wake-on-LAN to broadcast correctly, the container **must** run in host networking mode: ```bash docker run -d \ --name manage-servers \ --network host \ manage-servers:latest ``` _Note: Port mapping (`-p 8080:8080`) is not required when using `--network host` as the container shares the host's networking stack._ ## Configuration Servers can be managed entirely through the web UI ("Register Server" button). Under the hood, the application persists configuration to `config.yaml` or `servers.json` depending on the environment. ### Required Fields for Full Functionality - **Wake-on-LAN**: Requires valid `MAC Address`. - **Shutdown/Reboot**: Requires `SSH User` and `SSH Password`. - **Terminal**: Requires `SSH User` and `SSH Password`.