Install Scripts
Write the script that downloads and sets up a server's files.
Introduction
The install script runs when a server is created or reinstalled, and puts everything the server needs into its directory: the game server, its configuration files, and any mods. It runs in a temporary container separate from the server's own, and you set it up on the egg's Install Script tab.
Script Settings
- Install Script: The script itself.
- Script Container: The Docker image the script runs in. Pick one with the tools your script needs, such as
curlorunzip. - Script Entrypoint Command: The program that runs the script, usually
bash. Alpine images do not includebash, so useashwith them. - Copy Script From: Use another egg's install script. Leave Install Script empty when you do. See Sharing a Script.
- Privileged Installation Script: Kept for older daemon versions. Wings does not use it.
Script Containers
Pterodactyl publishes installer images with common tools:
ghcr.io/pterodactyl/installers:debianincludesbash,curl,wget,git, andtar.ghcr.io/pterodactyl/installers:alpineincludescurl,wget,git,tar,unzip, andjq, but notbash.
The community publishes more at ghcr.io/ptero-eggs/installers, with debian, alpine, and ubuntu tags. Any other image works too, such as eclipse-temurin:21-jdk if the install needs Java.
Writing the Script
The server's files are at /mnt/server in the install container. Only what the script puts in /mnt/server is kept. Anything else, such as installed packages, is lost when the script finishes. Packages the server needs to run belong in its Docker image.
The egg's variables are available as environment variables, along with SERVER_MEMORY, SERVER_IP, and SERVER_PORT.
A typical script moves into /mnt/server, downloads the server, and writes a first configuration:
#!/bin/bash
mkdir -p /mnt/server
cd /mnt/server || exit 1
curl -sSL "https://example.com/downloads/server-${SERVER_VERSION}.tar.gz" | tar -xz
echo "max_players=${MAX_PLAYERS}" > server.cfgThe script runs as root. When it finishes, Wings gives the files to the user its servers run as.
When a user or administrator chooses Reinstall, the script runs again over the server's existing files. Do not overwrite files users have changed, such as worlds, unless you intend to.
Checking the Output
The server's console shows the script's output while it runs. Wings also saves the latest install's output on the node:
cat /var/log/pterodactyl/install/<server uuid>.logWings does not check whether the script succeeded. The server is marked installed even if a command fails or the script exits with an error. Check a new script's output and fix errors before reinstalling.
Sharing a Script
When several eggs install the same way, such as different Minecraft server types, write the script in one egg and select that egg under Copy Script From in the others. Leave their Install Script empty: if an egg has its own script, that script runs instead.
An egg that copies its script cannot be copied from. The Eggs Using This Script card lists the eggs copying an egg's script.
Last updated on