Overview
Templates in GamePanelX V3 are compressed archives of game server files that enable rapid server deployment. TheCreateTemplate script packages server directories into reusable templates.
What Are Templates?
Templates are.tar.gz archives stored in ~/templates/ containing:
- Game server binaries
- Configuration files
- Maps and assets
- Any customizations or mods
Creating Templates
TheCreateTemplate script is located at ~/_SERVERS/scripts/CreateTemplate.
Basic Usage
~/tmp/mygame with ID 23, resulting in ~/templates/23.tar.gz.
Command-Line Parameters
File PathPath to the directory containing the server files, relative to
$HOME.Example: tmp/mygame refers to ~/tmp/mygameTemplate IDUnique identifier for the template. Used for the output filename:
{id}.tar.gzCallback URLURL to notify about template creation status. Receives status updates as the template is created.
From SteamSet to
yes if this template is being created from a SteamCMD download. Enables automatic cleanup of source files.Debug ModeEnable debug output for troubleshooting template creation.
Template Creation Process
Validation
Validates that:
- Required parameters (
-p,-i) are provided - Source directory exists at
~/{file_path} - Directory is not empty
Archive Creation
Creates a compressed tar archive:The tar process ID is saved to
~/templates/.gpx_{template_id} for monitoring.Completion Callback
When archiving finishes, sends a callback with the template size:Where
{size} is the human-readable size (e.g., “1.2G”, “500M”).Template Storage
Templates are stored in a standardized location:Tracking Files
During creation, temporary tracking files (.gpx_{id}) store the tar process PID. These files are used to monitor creation progress.
Using Templates to Create Servers
Once a template is created, use it with theCreateServer script:
-x 23 parameter references template ID 23 (~/templates/23.tar.gz).
See Creating Servers for detailed information on deploying servers from templates.
Creating Templates from SteamCMD
A common workflow is downloading game files via SteamCMD and creating a template:Create Template
Package the downloaded files into a template:The
-s yes flag ensures the temporary directory is cleaned up after template creation.Template Creation Workflow
Manual File Preparation
For custom server configurations or modded servers:-
Prepare Source Directory
-
Customize Server
- Edit configuration files
- Add mods or plugins
- Set default settings
- Add custom maps
-
Create Template
-
Verify Template
From Existing Server
Create a template from a running server’s directory:Status Callbacks
When a callback URL is provided with-u, the script sends HTTP requests at key stages:
| Status | When Triggered | Additional Data |
|---|---|---|
started | Template creation begins | None |
complete | Archive creation finished | size={human_readable_size} |
failed | Error occurred | None |
Example Callback URLs
Logging
Template creation is logged to~/logs/templates.log:
Examples
Template Management
Listing Templates
Inspecting Template Contents
Deleting Templates
Template Versioning
Implement a versioning scheme for templates:Error Handling
Validation Errors
The script exits immediately if:- Missing
-por-iparameters
- Source directory doesn’t exist
- Source directory exists but contains no files
Best Practices
- Unique IDs: Use meaningful, unique template IDs
- Documentation: Maintain a list of templates with descriptions
- Clean Source: Remove logs, PIDs, and runtime files before creating templates
- Test First: Test server configurations before creating templates
- Versioning: Use version numbers in template IDs for tracking
- Callbacks: Implement callback URLs for web panel integration
- Storage: Monitor
~/templates/disk usage regularly - Cleanup: Remove old/unused templates to save space
Integration with Web Panels
Templates enable powerful web panel features:- Template Library: Display available templates with details
- One-Click Deployment: Create servers from templates via web interface
- Progress Tracking: Use callbacks to show real-time creation status
- Template Updates: Re-create templates when game updates are released
- Mod Packs: Create templates for popular mod configurations
Example Callback Handler (PHP)
Related Scripts
- Creating Servers - Deploying servers from templates
- Updating Servers - Updating game files for new templates
- Starting & Stopping Servers - Managing deployed servers