More code updates

This commit is contained in:
Dane Everitt 2017-10-07 17:21:41 -05:00
parent cc297eea09
commit 17642bffe7
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
32 changed files with 209 additions and 2863 deletions

View file

@ -12,12 +12,6 @@ class DatabaseSeeder extends Seeder
{
Model::unguard();
$this->call(MinecraftServiceTableSeeder::class);
$this->call(SourceServiceTableSeeder::class);
$this->call(RustServiceTableSeeder::class);
$this->call(TerrariaServiceTableSeeder::class);
$this->call(VoiceServiceTableSeeder::class);
Model::reguard();
}
}

View file

@ -1,411 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\EggVariable;
class MinecraftServiceTableSeeder extends Seeder
{
/**
* The core service ID.
*
* @var \Pterodactyl\Models\Nest
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
private $default_mc = <<<'EOF'
'use strict';
/**
* Pterodactyl - Daemon
* 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.
*/
const rfr = require('rfr');
const _ = require('lodash');
const Core = rfr('src/services/index.js');
class Service extends Core {
onConsole(data) {
// Hide the output spam from Bungeecord getting pinged.
if (_.endsWith(data, '<-> InitialHandler has connected')) return;
return super.onConsole(data);
}
}
module.exports = Service;
EOF;
/**
* Run the database seeds.
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'minecraft',
], [
'name' => 'Minecraft',
'description' => 'Minecraft - the classic game from Mojang. With support for Vanilla MC, Spigot, and many others!',
'startup' => 'java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}',
'index_file' => $this->default_mc,
]);
}
private function addCoreOptions()
{
$script = <<<'EOF'
#!/bin/ash
# Vanilla MC Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
LATEST_VERSION=`curl -s https://s3.amazonaws.com/Minecraft.Download/versions/versions.json | grep -o "[[:digit:]]\.[0-9]*\.[0-9]" | head -n 1`
if [ -z "$VANILLA_VERSION" ] || [ "$VANILLA_VERSION" == "latest" ]; then
DL_VERSION=$LATEST_VERSION
else
DL_VERSION=$VANILLA_VERSION
fi
curl -o ${SERVER_JARFILE} https://s3.amazonaws.com/Minecraft.Download/versions/${DL_VERSION}/minecraft_server.${DL_VERSION}.jar
EOF;
$this->option['vanilla'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'vanilla',
], [
'name' => 'Vanilla Minecraft',
'description' => 'Minecraft is a game about placing blocks and going on adventures. Explore randomly generated worlds and build amazing things from the simplest of homes to the grandest of castles. Play in Creative Mode with unlimited resources or mine deep in Survival Mode, crafting weapons and armor to fend off dangerous mobs. Do all this alone or with friends.',
'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", "server-port": "{{server.build.default.port}}"}}}',
'config_stop' => 'stop',
'config_from' => null,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Spigot Installation Script
#
# Server Files: /mnt/server
## Only download if a path is provided, otherwise continue.
if [ ! -z "${DL_PATH}" ]; then
apk update
apk add curl
cd /mnt/server
MODIFIED_DOWNLOAD=`eval echo $(echo ${DL_PATH} | sed -e 's/{{/${/g' -e 's/}}/}/g')`
curl -sSL -o ${SERVER_JARFILE} ${MODIFIED_DOWNLOAD}
fi
EOF;
$this->option['spigot'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'spigot',
], [
'name' => 'Spigot',
'description' => 'Spigot is the most widely-used modded Minecraft server software in the world. It powers many of the top Minecraft server networks around to ensure they can cope with their huge player base and ensure the satisfaction of their players. Spigot works by reducing and eliminating many causes of lag, as well as adding in handy features and settings that help make your job of server administration easier.',
'docker_image' => 'quay.io/pterodactyl/core:java-glibc',
'config_startup' => null,
'config_files' => '{"spigot.yml":{"parser": "yaml", "find":{"settings.restart-on-crash": false}}}',
'config_logs' => null,
'config_stop' => null,
'config_from' => $this->option['vanilla']->id,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Sponge Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
curl -sSL "https://repo.spongepowered.org/maven/org/spongepowered/spongevanilla/${SPONGE_VERSION}/spongevanilla-${SPONGE_VERSION}.jar" -o ${SERVER_JARFILE}
EOF;
$this->option['sponge'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'sponge',
], [
'name' => 'Sponge (SpongeVanilla)',
'description' => 'SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.',
'docker_image' => 'quay.io/pterodactyl/core:java-glibc',
'config_startup' => '{"userInteraction": [ "You need to agree to the EULA"]}',
'config_files' => null,
'config_logs' => null,
'config_stop' => null,
'config_from' => $this->option['vanilla']->id,
'startup' => null,
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# Bungeecord Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl
cd /mnt/server
if [ -z "${BUNGEE_VERSION}" ] || [ "${BUNGEE_VERSION}" == "latest" ]; then
BUNGEE_VERSION="lastStableBuild"
fi
curl -o ${SERVER_JARFILE} https://ci.md-5.net/job/BungeeCord/${BUNGEE_VERSION}/artifact/bootstrap/target/BungeeCord.jar
EOF;
$this->option['bungeecord'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'bungeecord',
], [
'name' => 'Bungeecord',
'description' => 'For a long time, Minecraft server owners have had a dream that encompasses a free, easy, and reliable way to connect multiple Minecraft servers together. BungeeCord is the answer to said dream. Whether you are a small server wishing to string multiple game-modes together, or the owner of the ShotBow Network, BungeeCord is the ideal solution for you. With the help of BungeeCord, you will be able to unlock your community\'s full potential.',
'docker_image' => 'quay.io/pterodactyl/core:java',
'config_startup' => '{"done": "Listening on ", "userInteraction": [ "Listening on /0.0.0.0:25577"]}',
'config_files' => '{"config.yml":{"parser": "yaml", "find":{"listeners[0].host": "0.0.0.0:{{server.build.default.port}}", "servers.*.address":{"127.0.0.1": "{{config.docker.interface}}", "localhost": "{{config.docker.interface}}"}}}}',
'config_logs' => '{"custom": false, "location": "proxy.log.0"}',
'config_stop' => 'end',
'config_from' => null,
'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'] = Egg::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", "server-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()
{
$this->addVanillaVariables();
$this->addSpigotVariables();
$this->addSpongeVariables();
$this->addBungeecordVariables();
$this->addForgeVariables();
}
private function addVanillaVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['vanilla']->id,
'env_variable' => 'SERVER_JARFILE',
], [
'name' => 'Server Jar File',
'description' => 'The name of the server jarfile to run the server with.',
'default_value' => 'server.jar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['vanilla']->id,
'env_variable' => 'VANILLA_VERSION',
], [
'name' => 'Server Version',
'description' => 'The version of Minecraft Vanilla to install. Use "latest" to install the latest version.',
'default_value' => 'latest',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|between:3,7',
]);
}
private function addSpigotVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'SERVER_JARFILE',
], [
'name' => 'Server Jar File',
'description' => 'The name of the server jarfile to run the server with.',
'default_value' => 'server.jar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'DL_VERSION',
], [
'name' => 'Spigot Version',
'description' => 'The version of Spigot to download (using the --rev tag). Use "latest" for latest.',
'default_value' => 'latest',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|string|between:3,7',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['spigot']->id,
'env_variable' => 'DL_PATH',
], [
'name' => 'Download Path',
'description' => 'A URL to use to download Spigot rather than building it on the server. This is not user viewable. Use <code>{{DL_VERSION}}</code> in the URL to automatically insert the assigned version into the URL. If you do not enter a URL Spigot will build directly in the container (this will fail on low memory containers).',
'default_value' => '',
'user_viewable' => 0,
'user_editable' => 0,
'rules' => 'string',
]);
}
private function addSpongeVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['sponge']->id,
'env_variable' => 'SPONGE_VERSION',
], [
'name' => 'Sponge Version',
'description' => 'The version of SpongeVanilla to download and use.',
'default_value' => '1.10.2-5.2.0-BETA-381',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|regex:/^([a-zA-Z0-9.\-_]+)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['sponge']->id,
'env_variable' => 'SERVER_JARFILE',
], [
'name' => 'Server Jar File',
'description' => 'The name of the Jarfile to use when running SpongeVanilla.',
'default_value' => 'server.jar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
}
private function addBungeecordVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['bungeecord']->id,
'env_variable' => 'BUNGEE_VERSION',
], [
'name' => 'Bungeecord Version',
'description' => 'The version of Bungeecord to download and use.',
'default_value' => 'latest',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|alpha_num|between:1,6',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['bungeecord']->id,
'env_variable' => 'SERVER_JARFILE',
], [
'name' => 'Bungeecord Jar File',
'description' => 'The name of the Jarfile to use when running Bungeecord.',
'default_value' => 'bungeecord.jar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/',
]);
}
private function addForgeVariables()
{
EggVariable::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

@ -1,416 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class RustServiceTableSeeder extends Seeder
{
use CreatesServiceIndex;
/**
* The core service ID.
*
* @var Models\Service
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
/**
* Run the database seeds.
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Nest::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' => $this->getIndexScript(),
]);
}
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'] = Egg::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'] = Egg::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()
{
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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()
{
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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',
]);
EggVariable::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

@ -1,478 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class SourceServiceTableSeeder extends Seeder
{
use CreatesServiceIndex;
/**
* The core service ID.
*
* @var Models\Service
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
/**
* Run the database seeds.
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'srcds',
], [
'name' => 'Source Engine',
'description' => 'Includes support for most Source Dedicated Server games.',
'startup' => './srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +ip 0.0.0.0 -strictportbind -norestart',
'index_file' => $this->getIndexScript(),
]);
}
private function addCoreOptions()
{
$script = <<<'EOF'
#!/bin/bash
# SRCDS Base 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 ${SRCDS_APPID} +quit
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['source'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'source',
], [
'name' => 'Custom Source Engine Game',
'description' => 'This option allows modifying the startup arguments and other details to run a custo SRCDS based game on the panel.',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "gameserver Steam ID", "userInteraction": []}',
'config_files' => '{}',
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
'config_stop' => 'quit',
'config_from' => null,
'startup' => null,
'script_install' => $script,
'script_entry' => 'bash',
'script_container' => 'ubuntu:16.04',
]);
$this->option['insurgency'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'insurgency',
], [
'name' => 'Insurgency',
'description' => 'Take to the streets for intense close quarters combat, where a team\'s survival depends upon securing crucial strongholds and destroying enemy supply in this multiplayer and cooperative Source Engine based experience.',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => null,
'config_files' => null,
'config_logs' => null,
'config_stop' => null,
'config_from' => $this->option['source']->id,
'startup' => './srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} +ip 0.0.0.0 -strictportbind -norestart',
'copy_script_from' => $this->option['source']->id,
]);
$this->option['tf2'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'tf2',
], [
'name' => 'Team Fortress 2',
'description' => 'Team Fortress 2 is a team-based first-person shooter multiplayer video game developed and published by Valve Corporation. It is the sequel to the 1996 mod Team Fortress for Quake and its 1999 remake.',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => null,
'config_files' => null,
'config_logs' => null,
'config_stop' => null,
'config_from' => $this->option['source']->id,
'startup' => './srcds_run -game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} +ip 0.0.0.0 -strictportbind -norestart',
'copy_script_from' => $this->option['source']->id,
]);
$script = <<<'EOF'
#!/bin/bash
# ARK: 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
mkdir -p /mnt/server/Engine/Binaries/ThirdParty/SteamCMD/Linux
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
tar -xzvf steamcmd.tar.gz -C /mnt/server/Engine/Binaries/ThirdParty/SteamCMD/Linux
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 376030 +quit
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
EOF;
$this->option['ark'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'ark',
], [
'name' => 'Ark: Survival Evolved',
'description' => 'As a man or woman stranded, naked, freezing, and starving on the unforgiving shores of a mysterious island called ARK, use your skill and cunning to kill or tame and ride the plethora of leviathan dinosaurs and other primeval creatures roaming the land. Hunt, harvest resources, craft items, grow crops, research technologies, and build shelters to withstand the elements and store valuables, all while teaming up with (or preying upon) hundreds of other players to survive, dominate... and escape! — Gamepedia: ARK',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "Setting breakpad minidump AppID"}',
'config_files' => null,
'config_logs' => null,
'config_stop' => '^C',
'config_from' => $this->option['source']->id,
'startup' => './ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}',
'script_install' => $script,
'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'] = Egg::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'] = Egg::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()
{
$this->addInsurgencyVariables();
$this->addTF2Variables();
$this->addArkVariables();
$this->addCSGOVariables();
$this->addGMODVariables();
$this->addCustomVariables();
}
private function addInsurgencyVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_APPID',
], [
'name' => 'Game ID',
'description' => 'The ID corresponding to the game to download and run using SRCDS.',
'default_value' => '17705',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|regex:/^(17705)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_GAME',
], [
'name' => 'Game Name',
'description' => 'The name corresponding to the game to download and run using SRCDS.',
'default_value' => 'insurgency',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|regex:/^(insurgency)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['insurgency']->id,
'env_variable' => 'SRCDS_MAP',
], [
'name' => 'Default Map',
'description' => 'The default map to use when starting the server.',
'default_value' => 'sinjar',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^(\w{1,20})$/',
]);
}
private function addTF2Variables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_APPID',
], [
'name' => 'Game ID',
'description' => 'The ID corresponding to the game to download and run using SRCDS.',
'default_value' => '232250',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|regex:/^(232250)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_GAME',
], [
'name' => 'Game Name',
'description' => 'The name corresponding to the game to download and run using SRCDS.',
'default_value' => 'tf',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|regex:/^(tf)$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['tf2']->id,
'env_variable' => 'SRCDS_MAP',
], [
'name' => 'Default Map',
'description' => 'The default map to use when starting the server.',
'default_value' => 'cp_dustbowl',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^(\w{1,20})$/',
]);
}
private function addArkVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'ARK_PASSWORD',
], [
'name' => 'Server Password',
'description' => 'If specified, players must provide this password to join the server.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'alpha_dash|between:1,100',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'ARK_ADMIN_PASSWORD',
], [
'name' => 'Admin Password',
'description' => 'If specified, players must provide this password (via the in-game console) to gain access to administrator commands on the server.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'alpha_dash|between:1,100',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['ark']->id,
'env_variable' => 'SERVER_MAX_PLAYERS',
], [
'name' => 'Maximum Players',
'description' => 'Specifies the maximum number of players that can play on the server simultaneously.',
'default_value' => 20,
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|numeric|digits_between:1,4',
]);
}
private function addCSGOVariables()
{
EggVariable::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',
]);
EggVariable::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()
{
EggVariable::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',
]);
EggVariable::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()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['source']->id,
'env_variable' => 'SRCDS_APPID',
], [
'name' => 'Game ID',
'description' => 'The ID corresponding to the game to download and run using SRCDS.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|numeric|digits_between:1,6',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['source']->id,
'env_variable' => 'SRCDS_GAME',
], [
'name' => 'Game Name',
'description' => 'The name corresponding to the game to download and run using SRCDS.',
'default_value' => '',
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|alpha_dash|between:1,100',
]);
}
}

View file

@ -1,116 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class TerrariaServiceTableSeeder extends Seeder
{
use CreatesServiceIndex;
/**
* The core service ID.
*
* @var Models\Service
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
/**
* Run the database seeds.
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'terraria',
], [
'name' => 'Terraria',
'description' => 'Terraria is a land of adventure! A land of mystery! A land that\'s yours to shape, defend, and enjoy. Your options in Terraria are limitless. Are you an action gamer with an itchy trigger finger? A master builder? A collector? An explorer? There\'s something for everyone.',
'startup' => 'mono TerrariaServer.exe -port {{SERVER_PORT}} -autocreate 2 -worldname World',
'index_file' => $this->getIndexScript(),
]);
}
private function addCoreOptions()
{
$script = <<<'EOF'
#!/bin/ash
# TShock Installation Script
#
# Server Files: /mnt/server
apk update
apk add curl unzip
cd /tmp
curl -sSLO https://github.com/NyxStudios/TShock/releases/download/v${T_VERSION}/tshock_${T_VERSION}.zip
unzip -o tshock_${T_VERSION}.zip -d /mnt/server
EOF;
$this->option['tshock'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'tshock',
], [
'name' => 'Terraria Server (TShock)',
'description' => 'TShock is a server modification for Terraria, written in C#, and based upon the Terraria Server API. It uses JSON for configuration management, and offers several features not present in the Terraria Server normally.',
'docker_image' => 'quay.io/pterodactyl/core:mono',
'config_startup' => '{"userInteraction": [ "You need to agree to the EULA"]}',
'config_startup' => '{"done": "Type \'help\' for a list of commands", "userInteraction": []}',
'config_files' => '{"tshock/config.json":{"parser": "json", "find":{"ServerPort": "{{server.build.default.port}}", "MaxSlots": "{{server.build.env.MAX_SLOTS}}"}}}',
'config_logs' => '{"custom": false, "location": "ServerLog.txt"}',
'config_stop' => 'exit',
'startup' => null,
'script_install' => $script,
]);
}
private function addVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['tshock']->id,
'env_variable' => 'T_VERSION',
], [
'name' => 'TShock Version',
'description' => 'Which version of TShock to install and use.',
'default_value' => '4.3.22',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([0-9_\.-]{5,10})$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['tshock']->id,
'env_variable' => 'MAX_SLOTS',
], [
'name' => 'Maximum Slots',
'description' => 'Total number of slots to allow on the server.',
'default_value' => 20,
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|numeric|digits_between:1,3',
]);
}
}

View file

@ -1,182 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* This software is licensed under the terms of the MIT license.
* https://opensource.org/licenses/MIT
*/
use Pterodactyl\Models\Egg;
use Pterodactyl\Models\Nest;
use Illuminate\Database\Seeder;
use Pterodactyl\Models\EggVariable;
use Pterodactyl\Traits\Services\CreatesServiceIndex;
class VoiceServiceTableSeeder extends Seeder
{
use CreatesServiceIndex;
/**
* The core service ID.
*
* @var Nest
*/
protected $service;
/**
* Stores all of the option objects.
*
* @var array
*/
protected $option = [];
/**
* Run the database seeds.
*/
public function run()
{
$this->addCoreService();
$this->addCoreOptions();
$this->addVariables();
}
private function addCoreService()
{
$this->service = Nest::updateOrCreate([
'author' => config('pterodactyl.service.core'),
'folder' => 'voice',
], [
'name' => 'Voice Servers',
'description' => 'Voice servers such as Mumble and Teamspeak 3.',
'startup' => '',
'index_file' => $this->getIndexScript(),
]);
}
private function addCoreOptions()
{
$script = <<<'EOF'
#!/bin/ash
# Mumble Installation Script
#
# Server Files: /mnt/server
apk update
apk add tar curl
cd /tmp
curl -sSLO https://github.com/mumble-voip/mumble/releases/download/${MUMBLE_VERSION}/murmur-static_x86-${MUMBLE_VERSION}.tar.bz2
tar -xjvf murmur-static_x86-${MUMBLE_VERSION}.tar.bz2
cp -r murmur-static_x86-${MUMBLE_VERSION}/* /mnt/server
EOF;
$this->option['mumble'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'mumble',
], [
'name' => 'Mumble Server',
'description' => 'Mumble is an open source, low-latency, high quality voice chat software primarily intended for use while gaming.',
'docker_image' => 'quay.io/pterodactyl/core:glibc',
'config_startup' => '{"done": "Server listening on", "userInteraction": [ "Generating new server certificate"]}',
'config_files' => '{"murmur.ini":{"parser": "ini", "find":{"logfile": "murmur.log", "port": "{{server.build.default.port}}", "host": "0.0.0.0", "users": "{{server.build.env.MAX_USERS}}"}}}',
'config_logs' => '{"custom": true, "location": "logs/murmur.log"}',
'config_stop' => '^C',
'config_from' => null,
'startup' => './murmur.x86 -fg',
'script_install' => $script,
]);
$script = <<<'EOF'
#!/bin/ash
# TS3 Installation Script
#
# Server Files: /mnt/server
apk update
apk add tar curl
cd /tmp
curl -sSLO http://dl.4players.de/ts/releases/${TS_VERSION}/teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2
tar -xjvf teamspeak3-server_linux_amd64-${TS_VERSION}.tar.bz2
cp -r teamspeak3-server_linux_amd64/* /mnt/server
echo "machine_id=
default_voice_port=${SERVER_PORT}
voice_ip=0.0.0.0
licensepath=
filetransfer_port=30033
filetransfer_ip=
query_port=${SERVER_PORT}
query_ip=0.0.0.0
query_ip_whitelist=query_ip_whitelist.txt
query_ip_blacklist=query_ip_blacklist.txt
dbplugin=ts3db_sqlite3
dbpluginparameter=
dbsqlpath=sql/
dbsqlcreatepath=create_sqlite/
dbconnections=10
logpath=logs
logquerycommands=0
dbclientkeepdays=30
logappend=0
query_skipbruteforcecheck=0" > /mnt/server/ts3server.ini
EOF;
$this->option['ts3'] = Egg::updateOrCreate([
'service_id' => $this->service->id,
'tag' => 'ts3',
], [
'name' => 'Teamspeak3 Server',
'description' => 'VoIP software designed with security in mind, featuring crystal clear voice quality, endless customization options, and scalabilty up to thousands of simultaneous users.',
'docker_image' => 'quay.io/pterodactyl/core:glibc',
'config_startup' => '{"done": "listening on 0.0.0.0:", "userInteraction": []}',
'config_files' => '{"ts3server.ini":{"parser": "ini", "find":{"default_voice_port": "{{server.build.default.port}}", "voice_ip": "0.0.0.0", "query_port": "{{server.build.default.port}}", "query_ip": "0.0.0.0"}}}',
'config_logs' => '{"custom": true, "location": "logs/ts3.log"}',
'config_stop' => '^C',
'config_from' => null,
'startup' => './ts3server_minimal_runscript.sh default_voice_port={{SERVER_PORT}} query_port={{SERVER_PORT}}',
'script_install' => $script,
]);
}
private function addVariables()
{
EggVariable::updateOrCreate([
'option_id' => $this->option['mumble']->id,
'env_variable' => 'MAX_USERS',
], [
'name' => 'Maximum Users',
'description' => 'Maximum concurrent users on the mumble server.',
'default_value' => 100,
'user_viewable' => 1,
'user_editable' => 0,
'rules' => 'required|numeric|digits_between:1,5',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['mumble']->id,
'env_variable' => 'MUMBLE_VERSION',
], [
'name' => 'Server Version',
'description' => 'Version of Mumble Server to download and use.',
'default_value' => '1.2.19',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([0-9_\.-]{5,8})$/',
]);
EggVariable::updateOrCreate([
'option_id' => $this->option['ts3']->id,
'env_variable' => 'TS_VERSION',
], [
'name' => 'Server Version',
'description' => 'The version of Teamspeak 3 to use when running the server.',
'default_value' => '3.0.13.7',
'user_viewable' => 1,
'user_editable' => 1,
'rules' => 'required|regex:/^([0-9_\.-]{5,10})$/',
]);
}
}