Skip to content

Pterodactyl Integration

Infrarust includes integration with Pterodactyl, a popular open-source game server management panel. This integration allows Infrarust to monitor server status and automatically start servers when players connect.

Overview

The Pterodactyl provider in Infrarust:

  • Monitors server status in real-time (Starting, Running, Stopping, Stopped, Crashed)
  • Automatically starts servers when players attempt to connect
  • Supports remote server control (start, stop, restart)
  • Automatically shuts down empty servers after a configurable timeout
  • Uses Pterodactyl's Client API for communication

Configuration

Manager Configuration

To enable Pterodactyl integration, add the following to your config.yaml:

yaml
managers_config:
  pterodactyl:
    enabled: true
    api_key: "your_pterodactyl_api_key" # Must be a client ApiKLey that start with "ptlc_"
    base_url: "https://panel.example.com"

Configuration Options

OptionDescriptionRequired
enabledEnable Pterodactyl integrationYes
api_keyClient API key from Pterodactyl panelYes
base_urlBase URL of your Pterodactyl panelYes

Server Configuration

To configure a proxy to use Pterodactyl for server management, add the server_manager section to your proxy configuration file:

yaml
domains:
  - "mc.example.com"
addresses:
  - "192.168.1.100:25565"
proxyMode: "passthrough"

server_manager:
  provider_name: Pterodactyl
  server_id: "de0d8f2d"
  empty_shutdown_time: 30

motds:
  online:
    text: "Server Online"
  offline:
    text: "Server Offline - Connecting will start the server"

Server Configuration Options

OptionDescriptionRequired
provider_nameMust be Pterodactyl for Pterodactyl panelYes
server_idThe server identifier from Pterodactyl panelYes
empty_shutdown_timeSeconds to wait before shutting down an empty serverNo

Complete Example

Main Configuration (config.yaml)

yaml
bind: "0.0.0.0:25565"

file_provider:
  proxies_path:
    - "./proxies"
  watch: true

managers_config:
  pterodactyl:
    enabled: true
    api_key: "ptlc_xxxxxxxxxxxxxxxxxxxx"
    base_url: "https://panel.example.com"

Proxy Configuration (proxies/survival.yaml)

yaml
domains:
  - "survival.example.com"
  - "play.example.com"
addresses:
  - "192.168.1.100:25565"
sendProxyProtocol: false
proxyMode: "passthrough"

server_manager:
  provider_name: Pterodactyl
  server_id: "de0d8f2d"
  empty_shutdown_time: 300

motds:
  online:
    version_name: "Survival Server"
    text: "Welcome to Survival!"
  offline:
    version_name: "Server Starting..."
    text: "Server is offline. Join to start it!"

Server Status States

The Pterodactyl integration recognizes the following server states:

StateDescription
StartingServer is starting up
RunningServer is online and accepting connections
StoppingServer is shutting down
StoppedServer is offline
CrashedServer has crashed and may need attention

Auto-Shutdown Feature

When empty_shutdown_time is configured, Infrarust will automatically stop the server after the specified number of seconds when no players are connected. This helps save resources when servers are not in use.

yaml
server_manager:
  provider_name: Pterodactyl
  server_id: "de0d8f2d"
  empty_shutdown_time: 300  # Shutdown after 5 minutes of no players

API Capabilities

The integration supports the following operations through Pterodactyl's Client API:

  • Get Server Status: Check current server state and resource usage
  • Start Server: Start an offline server
  • Stop Server: Gracefully stop a running server
  • Restart Server: Restart a running server

API Endpoints Used

EndpointMethodPurpose
/api/client/servers/{id}GETGet server information
/api/client/servers/{id}/resourcesGETGet server status and resources
/api/client/servers/{id}/powerPOSTControl server power state

Released under the AGPL-3.0 License.