Install Scripts
Write the script that downloads and sets up a server's files.
Introduction
The install script runs when a server is created, and again whenever it is reinstalled. Its job is to put everything the server needs into the server's directory: the game server itself, its configuration files, and any mods.
The script runs in its own temporary container, separate from the one the server later runs in. 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 instead of writing one. Leave Install Script empty when you use this. See Sharing a Script.
- Privileged Installation Script: Kept for older versions of the daemon. Wings does not use it.
Script Containers
Pterodactyl publishes installer images that include 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. You may use any other image as well, such as eclipse-temurin:21-jdk if the install needs Java.
Writing the Script
The server's files are at /mnt/server inside the install container. Only what the script puts in /mnt/server is kept. Anything else, such as packages it installs, disappears when the script finishes. If the server needs a package to run, it must be in the server's Docker image instead.
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 in the install container. When it finishes, Wings gives the files to the user its servers run as.
A server is also reinstalled when a user or administrator chooses Reinstall. The script then runs again over the server's existing files, so make sure it does not overwrite files users have changed, such as their worlds, unless that is what you want.
Checking the Output
The console on the server's page shows the script's output while it runs. Wings also saves the output of the latest install on the node:
cat /var/log/pterodactyl/install/<server uuid>.logWings does not check whether the script succeeded. Even if a command fails, or the script exits with an error, the server is marked as installed. Check the output when you write a new script, and fix any errors before you reinstall the server.
Sharing a Script
Several eggs often install the same way, such as different Minecraft server types. Instead of copying the script into each one, write it 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 itself be copied from. The Eggs Using This Script card lists the eggs that copy an egg's script.