LazyGate is a Gate proxy plugin that shuts down your Minecraft server when it's idle and wakes it up when players connect.
Add the lazygate
module to your project:
go get github.com/kasefuchs/lazygate
Include the plugin in your list of proxy plugins:
package main
import (
lazygate "github.com/kasefuchs/lazygate/pkg/plugin"
"go.minekube.com/gate/cmd/gate"
"go.minekube.com/gate/pkg/edition/java/proxy"
)
func main() {
proxy.Plugins = append(proxy.Plugins, lazygate.NewProxyPlugin())
gate.Execute()
}
Configure the plugin using environment variables:
# Provider to use. Currently available nomad & docker.
LAZYGATE_PROVIDER="nomad"
LazyGate matches registered Gate servers with provider's allocations using labels:
Docker Compose:
services:
minecraft-server-random:
labels:
lazygate.server: random_name
lazygate.time.minimumOnline: 2m
lazygate.time.inactivityThreshold: 5m
lazygate.queue.try: wait,kick
lazygate.queue.wait.timeout: 10s
lazygate.queue.wait.pingInterval: 2s
lazygate.queue.kick.starting: random_name is currently starting!
Gate config:
---
config:
servers:
random_name: minecraft-server-random:25565
try:
- random_name
In this example, the random_name
server will correspond to the minecraft-server1
service.