feat: Add web terminal and server dashboard, streamline setup, and configure CI with Docker registry mirror.
Build Docker Container using Multistage Build / build (push) Failing after 32s

This commit is contained in:
Matthias Hinrichs
2026-02-18 01:35:13 +01:00
parent 1e992a53b0
commit 49c976a02a
2 changed files with 33 additions and 83 deletions
+2 -3
View File
@@ -9,7 +9,7 @@ on:
branches:
- main
tags:
- 'v*' # Tags, die mit "v" anfangen, z. B. v1.0.0
- "v*" # Tags, die mit "v" anfangen, z. B. v1.0.0
workflow_dispatch:
jobs:
build:
@@ -31,8 +31,7 @@ jobs:
with:
buildkitd-config-inline: |
[registry."docker.io"]
username = "${{ secrets.DOCKERHUB_USERNAME }}"
password = "${{ secrets.DOCKERHUB_TOKEN }}"
mirrors = ["docker.hnrx.net"]
[registry."git.hnrx.net"]
username = "${{ secrets.DOCKER_USERNAME }}"
password = "${{ secrets.DOCKER_PASSWORD }}"
+29 -78
View File
@@ -4,20 +4,20 @@ This is a simple Go application designed to manage your servers, providing funct
## Features
* **List Servers:** Display all configured servers with their details.
* **Wake Server:** Send Wake-on-LAN (WoL) magic packets to bring servers online.
* **Shutdown Server:** Remotely shut down servers via SSH.
* **Reboot Server:** Remotely reboot servers via SSH.
* **Server Status:** Check if servers are online using ping.
* **Web Interface:** A user-friendly web interface to perform all management actions.
- **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
Before you begin, ensure you have the following installed:
* [Go (1.24.6 or newer)](https://golang.org/doc/install)
* [Docker](https://docs.docker.com/get-docker/)
* `git` (for cloning the repository)
- [Go (1.24 or newer)](https://golang.org/doc/install)
- [Docker](https://docs.docker.com/get-docker/)
- `git`
## Getting Started (Local)
@@ -28,94 +28,45 @@ Before you begin, ensure you have the following installed:
cd manage-servers
```
2. **Configure your servers:**
Edit the `servers.json` file to include your server details, including MAC addresses for Wake-on-LAN and SSH credentials for shutdown/reboot.
Example `servers.json`:
```json
[
{
"name": "harvester-01",
"mac": "3c:49:37:05:c2:2e",
"ip": "192.168.110.101",
"ssh_user": "rancher",
"ssh_pass": "maddog07"
}
]
```
3. **Run CLI commands:**
```bash
go run . list
go run . wake harvester-01
go run . status
go run . shutdown harvester-01
go run . reboot harvester-01
```
4. **Run the web server locally:**
2. **Run the application:**
```bash
go run . serve
```
Access the web interface in your browser at `http://localhost:8080`.
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)
1. **Build the Docker image:**
The project uses standard Docker Hub images (`golang:latest` and `alpine:latest`).
Navigate to the root of the project and run:
1. **Build the image:**
```bash
docker build -t manage-servers:latest .
```
2. **Run the Docker container:**
2. **Run the container:**
To enable Wake-on-LAN functionality, the Docker container needs to run in `host` network mode. This allows it to send broadcast packets directly onto your physical network.
For Wake-on-LAN to broadcast correctly, the container **must** run in host networking mode:
```bash
docker run --network host -p 8080:8080 manage-servers:latest
docker run -d \
--name manage-servers \
--network host \
manage-servers:latest
```
* `--network host`: Essential for Wake-on-LAN to work correctly.
* `-p 8080:8080`: Maps port 8080 from the container to port 8080 on your host.
3. **Access the web interface:**
Open your web browser and navigate to `http://localhost:8080`.
_Note: Port mapping (`-p 8080:8080`) is not required when using `--network host` as the container shares the host's networking stack._
## Configuration
The `servers.json` file is crucial for the application's functionality. Ensure it's correctly formatted and contains accurate information for all your servers.
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.
* `name`: A unique identifier for your server.
* `mac`: The MAC address of the server for Wake-on-LAN.
* `ip`: The IP address of the server for SSH connections and status checks.
* `ssh_user`: The username for SSH access.
* `ssh_pass`: The password for SSH access.
### Required Fields for Full Functionality
## Troubleshooting
### Host key verification failed (when pushing to Git)
If you encounter `Host key verification failed` when pushing to your Git repository, it means your system does not trust the SSH key of the Git server. To resolve this, you need to manually add the server's host key to your `~/.ssh/known_hosts` file.
From your terminal, attempt to connect to the server via SSH for the first time:
```bash
ssh git@192.168.200.20
```
When prompted to confirm the host's authenticity, type `yes` and press Enter. This will add the host key to your `known_hosts` file, and you should then be able to push your changes.
### Error loading servers: open servers.json: no such file or directory (in Docker)
This error indicates that the `servers.json` file was not found inside the Docker container. Ensure you have the latest `Dockerfile` (which includes copying `servers.json`) and rebuild your Docker image.
### Sending magic packet from Docker container does not work
If Wake-on-LAN is not working from within the Docker container, it's likely a networking issue. Ensure you are running the Docker container with the `--network host` flag, as described in the "Run the Docker container" section above. This allows the container to send broadcast packets directly onto your physical network.
- **Wake-on-LAN**: Requires valid `MAC Address`.
- **Shutdown/Reboot**: Requires `SSH User` and `SSH Password`.
- **Terminal**: Requires `SSH User` and `SSH Password`.