Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itzg/mc-server-runner
A container entry point to manage graceful shutdown of a Minecraft server
https://github.com/itzg/mc-server-runner
Last synced: 11 days ago
JSON representation
A container entry point to manage graceful shutdown of a Minecraft server
- Host: GitHub
- URL: https://github.com/itzg/mc-server-runner
- Owner: itzg
- License: apache-2.0
- Created: 2018-05-17T03:42:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-10-07T03:26:58.000Z (about 1 month ago)
- Last Synced: 2024-10-12T18:52:56.775Z (about 1 month ago)
- Language: Go
- Homepage:
- Size: 354 KB
- Stars: 32
- Watchers: 3
- Forks: 15
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/itzg/mc-server-runner)](https://github.com/itzg/mc-server-runner/releases/latest)
[![Test](https://github.com/itzg/mc-server-runner/actions/workflows/test.yml/badge.svg)](https://github.com/itzg/mc-server-runner/actions/workflows/test.yml)This is a process wrapper used by
[the itzg/minecraft-server Docker image](https://hub.docker.com/r/itzg/minecraft-server/)
to ensure the Minecraft server is stopped gracefully when the container is sent the `TERM` signal.## Usage
> Available at any time using `-h`
```
-bootstrap string
Specifies a file with commands to initially send to the server
-debug
Enable debug logging
-detach-stdin
Don't forward stdin and allow process to be put in background
-shell string
When set, pass the arguments to this shell
-stop-duration duration
Amount of time in Golang duration to wait after sending the 'stop' command.
-stop-server-announce-delay duration
Amount of time in Golang duration to wait after announcing server shutdown
```## Development Testing
Start a golang container for building and execution. The port is only needed for remote console functionality:
```bash
docker run -it --rm \
-v ${PWD}:/build \
-w /build \
-p 2222:2222 \
golang:1.19
```Within that container, build/test by running:
```bash
go run . test/dump.sh
go run . test/bash-only.sh
# Used to test remote console functionality
# Connect to this using an ssh client from outside the container to ensure two-way communication works
go run . -remote-console /usr/bin/sh
# The following should fail
go run . --shell sh test/bash-only.sh
```### Using the devcontainer's Dockerfile
#### With IntelliJ
Create a "Go Build" run configuration
![](notes/dockerfile-run-config.png)
with a Dockerfile target
![](notes/dockerfile-docker-target.png)