lazygate

module
v0.0.0-...-d19e6b0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2024 License: MIT

README

LazyGate

Table of Contents

About

LazyGate is a Gate proxy plugin that shuts down your Minecraft server when it's idle and wakes it up when players connect.

Getting Started

Installing

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()
}
Configuring

Configure the plugin using environment variables:

# Provider to use. Currently available nomad & docker.
LAZYGATE_PROVIDER="nomad"
Usage

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL