Merge branch 'develop' into feature/PTDL-472

This commit is contained in:
Dane Everitt 2017-07-15 11:52:39 -05:00
commit 736a323eff
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 634 additions and 1 deletions

View file

@ -3,6 +3,11 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## Unreleased
### Added
* Support for CS:GO as a default service option selection.
* Support for GMOD as a default service option selection.
## v0.6.4 (Courageous Carniadactylus)
### Fixed
* Fixed the console rendering on page load, I guess people don't like watching it load line-by-line for 10 minutes. Who would have guessed...

View file

@ -16,6 +16,7 @@ class DatabaseSeeder extends Seeder
$this->call(MinecraftServiceTableSeeder::class);
$this->call(SourceServiceTableSeeder::class);
$this->call(RustServiceTableSeeder::class);
$this->call(TerrariaServiceTableSeeder::class);
$this->call(VoiceServiceTableSeeder::class);

View file

@ -243,6 +243,43 @@ EOF;
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Forge Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
GET_VERSIONS=$(curl -sl http://files.minecraftforge.net/maven/net/minecraftforge/forge/ | grep -A1 Latest | grep -o -e '[1]\.[0-9][0-9] - [0-9][0-9]\.[0-9][0-9]\.[0-9]\.[0-9][0-9][0-9][0-9]')
LATEST_VERSION=$(echo $GET_VERSIONS | sed 's/ //g')
cd /mnt/server
curl -sS http://files.minecraftforge.net/maven/net/minecraftforge/forge/$LATEST_VERSION/forge-$LATEST_VERSION-installer.jar -o installer.jar
curl -sS http://files.minecraftforge.net/maven/net/minecraftforge/forge/$LATEST_VERSION/forge-$LATEST_VERSION-universal.jar -o server.jar
java -jar installer.jar --installServer
rm -rf installer.jar
EOF;
$this->option['forge'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'forge',
], [
'name' => 'Forge Minecraft',
'description' => 'Minecraft Forge Server. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.',
'docker_image' => 'quay.io/pterodactyl/core:java',
'config_startup' => '{"done": ")! For help, type ", "userInteraction": [ "Go to eula.txt for more info."]}',
'config_logs' => '{"custom": false, "location": "logs/latest.log"}',
'config_files' => '{"server.properties":{"parser": "properties", "find":{"server-ip": "0.0.0.0", "enable-query": "true", "server-port": "{{server.build.default.port}}", "query.port": "{{server.build.default.port}}"}}}',
'config_stop' => 'stop',
'config_from' => null,
'startup' => 'java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}',
'script_install' => $script,
'script_container' => 'frolvlad/alpine-oraclejdk8:cleaned',
]);
}
private function addVariables()
@ -251,6 +288,7 @@ EOF;
$this->addSpigotVariables();
$this->addSpongeVariables();
$this->addBungeecordVariables();
$this->addForgeVariables();
}
private function addVanillaVariables()
@ -372,4 +410,19 @@ EOF;
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
}
private function addForgeVariables()
{
ServiceVariable::updateOrCreate([
'option_id' => $this->option['forge']->id,
'env_variable' => 'SERVER_JARFILE',
], [
'name' => 'Server Jar File',
'description' => 'The name of the Jarfile to use when running Forge Mod.',
'default_value' => 'server.jar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
}
}

View file

@ -0,0 +1,430 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
use Illuminate\Database\Seeder;
use Pterodactyl\Models\Service;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Models\ServiceVariable;
class RustServiceTableSeeder extends Seeder
{
/**
* The core service ID.
*
* @var Models\Service
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Service::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'rust',
], [
'name' => 'Rust',
'description' => 'The only aim in Rust is to survive. To do this you will need to overcome struggles such as hunger, thirst and cold. Build a fire. Build a shelter. Kill animals for meat. Protect yourself from other players, and kill them for meat. Create alliances with other players and form a town. Do whatever it takes to survive.',
'startup' => './RustDedicated -batchmode +server.port {{SERVER_PORT}} +server.identity "rust" +rcon.port {{RCON_PORT}} +rcon.web true +server.hostname \"{{HOSTNAME}}\" +server.level \"{{LEVEL}}\" +server.description \"{{DESCRIPTION}}\" +server.url \"{{URL}}\" +server.headerimage \"{{SERVER_IMG}}\" +server.worldsize \"{{WORLD_SIZE}}\" +server.seed \"{{SEED}}\" +server.maxplayers {{MAX_PLAYERS}} +rcon.password \"{{RCON_PASS}}\" {{ADDITIONAL_ARGS}}',
'index_file' => Service::defaultIndexFile(),
]);
}
private function addCoreOptions()
{
$script = <<<'EOF'
apt update
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates
cd /tmp
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
mkdir -p /mnt/server/steam
tar -xzvf steamcmd.tar.gz -C /mnt/server/steam
cd /mnt/server/steam
chown -R root:root /mnt
export HOME=/mnt/server
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 258550 +quit
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['rustvanilla'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'rustvanilla',
], [
'name' => 'Vanilla',
'description' => 'Vanilla Rust server.',
'docker_image' => 'quay.io/pterodactyl/core:rust',
'config_startup' => '{"done": "Server startup complete", "userInteraction": []}',
'config_files' => '{}',
'config_logs' => '{"custom": false, "location": "latest.log"}',
'config_stop' => 'quit',
'config_from' => null,
'startup' => null,
'script_install' => $script,
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
$script = <<<'EOF'
apt update
apt -y --no-install-recommends install curl unzip lib32gcc1 ca-certificates
cd /tmp
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
mkdir -p /mnt/server/steam
tar -xzvf steamcmd.tar.gz -C /mnt/server/steam
cd /mnt/server/steam
chown -R root:root /mnt
export HOME=/mnt/server
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 258550 +quit
curl "https://dl.bintray.com/oxidemod/builds/Oxide-Rust.zip" > /mnt/server/oxide.zip
unzip -o /mnt/server/oxide.zip -d /mnt/server
rm /mnt/server/oxide.zip
echo "This file is used to determine whether the server is an OxideMod server or not.
Do not delete this file or you may loose OxideMod auto updating from the server." > /mnt/server/OXIDE_FLAG
mkdir -p /mnt/server/.steam/sdk32
cp -v /mnt/server/steam/linux32/steamclient.so /mnt/server/.steam/sdk32/steamclient.so
EOF;
$this->option['rustoxide'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'rustoxide',
], [
'name' => 'OxideMod',
'description' => 'OxideMod Rust server.',
'docker_image' => 'quay.io/pterodactyl/core:rust',
'config_startup' => '{"done": "Server startup complete", "userInteraction": []}',
'config_files' => '{}',
'config_logs' => '{"custom": false, "location": "latest.log"}',
'config_stop' => 'quit',
'config_from' => null,
'startup' => null,
'script_install' => $script,
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
}
private function addVariables()
{
$this->addVanillaVariables();
$this->addOxideVariables();
}
private function addVanillaVariables()
{
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'HOSTNAME',
], [
'name' => 'Server Name',
'description' => 'The name of your server in the public server list.',
'default_value' => 'A Rust Server',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'LEVEL',
], [
'name' => 'Level',
'description' => 'The world file for Rust to use.',
'default_value' => 'Procedural Map',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'DESCRIPTION',
], [
'name' => 'Description',
'description' => 'The description under your server title. Commonly used for rules & info.',
'default_value' => 'Powered by Pterodactyl',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'URL',
], [
'name' => 'URL',
'description' => 'The URL for your server. This is what comes up when clicking the "Visit Website" button.',
'default_value' => 'http://pterodactyl.io',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'WORLD_SIZE',
], [
'name' => 'World Size',
'description' => 'The world size for a procedural map.',
'default_value' => '3000',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'SEED',
], [
'name' => 'World Seed',
'description' => 'The seed for a procedural map.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'present',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'MAX_PLAYERS',
], [
'name' => 'Max Players',
'description' => 'The maximum amount of players allowed in the server at once.',
'default_value' => '40',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'SERVER_IMG',
], [
'name' => 'Server Header Image',
'description' => 'The header image for the top of your server listing.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'RCON_PORT',
], [
'name' => 'RCON Port',
'description' => 'Port for RCON connections.',
'default_value' => '8401',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'RCON_PASS',
], [
'name' => 'RCON Password',
'description' => 'Remote console access password.',
'default_value' => 'CHANGEME',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustvanilla']->id,
'env_variable' => 'ADDITIONAL_ARGS',
], [
'name' => 'Additional Arguments',
'description' => 'Add additional startup parameters to the server.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'present',
]);
}
private function addOxideVariables()
{
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'HOSTNAME',
], [
'name' => 'Server Name',
'description' => 'The name of your server in the public server list.',
'default_value' => 'A Rust Server',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'LEVEL',
], [
'name' => 'Level',
'description' => 'The world file for Rust to use.',
'default_value' => 'Procedural Map',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'DESCRIPTION',
], [
'name' => 'Description',
'description' => 'The description under your server title. Commonly used for rules & info.',
'default_value' => 'Powered by Pterodactyl',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'URL',
], [
'name' => 'URL',
'description' => 'The URL for your server. This is what comes up when clicking the "Visit Website" button.',
'default_value' => 'http://pterodactyl.io',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'WORLD_SIZE',
], [
'name' => 'World Size',
'description' => 'The world size for a procedural map.',
'default_value' => '3000',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'SEED',
], [
'name' => 'World Seed',
'description' => 'The seed for a procedural map.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'present',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'MAX_PLAYERS',
], [
'name' => 'Max Players',
'description' => 'The maximum amount of players allowed in the server at once.',
'default_value' => '40',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'SERVER_IMG',
], [
'name' => 'Server Header Image',
'description' => 'The header image for the top of your server listing.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'url',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'RCON_PORT',
], [
'name' => 'RCON Port',
'description' => 'Port for RCON connections.',
'default_value' => '8401',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|integer',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'RCON_PASS',
], [
'name' => 'RCON Password',
'description' => 'Remote console access password.',
'default_value' => 'CHANGEME',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['rustoxide']->id,
'env_variable' => 'ADDITIONAL_ARGS',
], [
'name' => 'Additional Arguments',
'description' => 'Add additional startup parameters to the server.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'present',
]);
}
}

View file

@ -192,6 +192,94 @@ EOF;
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
$script = <<<'EOF'
#!/bin/bash
# CSGO Installation Script
#
# Server Files: /mnt/server
apt -y update
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates
cd /tmp
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
mkdir -p /mnt/server/steamcmd
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
cd /mnt/server/steamcmd
# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt
export HOME=/mnt/server
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 740 +quit
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['csgo'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'csgo',
], [
'name' => 'Counter-Strike: Global Offensive',
'description' => 'Counter-Strike: Global Offensive is a multiplayer first-person shooter video game developed by Hidden Path Entertainment and Valve Corporation.',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "VAC secure mode is activated.", "userInteraction": []}',
'config_files' => null,
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
'config_stop' => 'quit',
'config_from' => $this->option['source']->id,
'startup' => './srcds_run -game csgo -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}',
'script_install' => $script,
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
$script = <<<'EOF'
#!/bin/bash
# Garry's Mod Installation Script
#
# Server Files: /mnt/server
apt -y update
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates
cd /tmp
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
mkdir -p /mnt/server/steamcmd
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
cd /mnt/server/steamcmd
# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt
export HOME=/mnt/server
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 4020 +quit
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['gmod'] = ServiceOption::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'gmod',
], [
'name' => 'Garrys Mod',
'description' => 'Garrys Mod, is a sandbox physics game created by Garry Newman, and developed by his company, Facepunch Studios.',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "VAC secure mode is activated.", "userInteraction": []}',
'config_files' => null,
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
'config_stop' => 'quit',
'config_from' => $this->option['source']->id,
'startup' => './srcds_run -game garrysmod -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}',
'script_install' => $script,
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
}
private function addVariables()
@ -199,6 +287,8 @@ EOF;
$this->addInsurgencyVariables();
$this->addTF2Variables();
$this->addArkVariables();
$this->addCSGOVariables();
$this->addGMODVariables();
$this->addCustomVariables();
}
@ -319,6 +409,60 @@ EOF;
]);
}
private function addCSGOVariables()
{
ServiceVariable::updateOrCreate([
'option_id' => $this->option['csgo']->id,
'env_variable' => 'SRCDS_MAP',
], [
'name' => 'Map',
'description' => 'The default map for the server.',
'default_value' => 'de_dust2',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|alpha_dash',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['csgo']->id,
'env_variable' => 'STEAM_ACC',
], [
'name' => 'Steam Account Token',
'description' => 'The Steam Account Token required for the server to be displayed publicly.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|alpha_num|size:32',
]);
}
private function addGMODVariables()
{
ServiceVariable::updateOrCreate([
'option_id' => $this->option['gmod']->id,
'env_variable' => 'SRCDS_MAP',
], [
'name' => 'Map',
'description' => 'The default map for the server.',
'default_value' => 'gm_flatgrass',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|alpha_dash',
]);
ServiceVariable::updateOrCreate([
'option_id' => $this->option['gmod']->id,
'env_variable' => 'STEAM_ACC',
], [
'name' => 'Steam Account Token',
'description' => 'The Steam Account Token required for the server to be displayed publicly.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|alpha_num|size:32',
]);
}
private function addCustomVariables()
{
ServiceVariable::updateOrCreate([

View file

@ -187,7 +187,7 @@ EOF;
], [
'name' => 'Server Version',
'description' => 'The version of Teamspeak 3 to use when running the server.',
'default_value' => '3.0.13.6',
'default_value' => '3.0.13.7',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([0-9_\.-]{5,10})$/',