Merge branch 'develop' into feature/option-scripts

# Conflicts:
#	app/Http/Routes/AdminRoutes.php
#	app/Http/Routes/DaemonRoutes.php
#	app/Models/ServiceOption.php
This commit is contained in:
Dane Everitt 2017-04-20 17:08:08 -04:00
commit 8d24e5f168
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
683 changed files with 8854 additions and 12362 deletions

View file

@ -29,6 +29,6 @@ class AddAllocationsTable extends Migration
*/
public function down()
{
Schema::dropIfExsits('allocations');
Schema::dropIfExists('allocations');
}
}

View file

@ -28,6 +28,6 @@ class CreateFailedJobsTable extends Migration
*/
public function down()
{
Schema::drop('failed_jobs');
Schema::dropIfExists('failed_jobs');
}
}

View file

@ -32,6 +32,6 @@ class CreateJobsTable extends Migration
*/
public function down()
{
Schema::drop('jobs');
Schema::dropIfExists('jobs');
}
}

View file

@ -28,8 +28,6 @@ class AddServerVariables extends Migration
*/
public function down()
{
Schema::table('server_variables', function (Blueprint $table) {
//
});
Schema::dropIfExists('server_variables');
}
}

View file

@ -30,6 +30,6 @@ class AddServiceOptions extends Migration
*/
public function down()
{
Schema::dropIfExsits('service_options');
Schema::dropIfExists('service_options');
}
}

View file

@ -32,14 +32,11 @@ class AddForeignServerVariables extends Migration
public function down()
{
Schema::table('server_variables', function (Blueprint $table) {
$table->dropForeign('server_variables_server_id_foreign');
$table->dropForeign('server_variables_variable_id_foreign');
$table->dropIndex('server_variables_server_id_foreign');
$table->dropIndex('server_variables_variable_id_foreign');
$table->dropForeign(['server_id']);
$table->dropForeign(['variable_id']);
});
DB::statement('ALTER TABLE allocations
DB::statement('ALTER TABLE server_variables
MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL,
MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL
');

View file

@ -26,11 +26,7 @@ class AddForeignTasks extends Migration
public function down()
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropForeign('tasks_server_foreign');
$table->dropForeign('tasks_server_foreign');
$table->dropIndex('tasks_server_foreign');
$table->dropIndex('tasks_server_foreign');
$table->dropForeign(['server']);
});
}
}

View file

@ -28,8 +28,7 @@ class AddPackColumn extends Migration
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign('servers_pack_foreign');
$table->dropIndex('servers_pack_foreign');
$table->dropForeign(['pack']);
$table->dropColumn('pack');
});
}

View file

@ -40,6 +40,9 @@ class UpdateColumnNames extends Migration
$table->foreign('allocation_id')->references('id')->on('allocations');
$table->foreign('service_id')->references('id')->on('services');
$table->foreign('option_id')->references('id')->on('service_options');
// Pack ID was forgotten until multiple releases later, therefore it is
// contained in '2017_03_18_204953_AddForeignKeyToPacks'
});
}
@ -51,19 +54,11 @@ class UpdateColumnNames extends Migration
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign('servers_node_id_foreign');
$table->dropForeign('servers_owner_id_foreign');
$table->dropForeign('servers_allocation_id_foreign');
$table->dropForeign('servers_service_id_foreign');
$table->dropForeign('servers_option_id_foreign');
$table->dropForeign('servers_pack_id_foreign');
$table->dropIndex('servers_node_id_foreign');
$table->dropIndex('servers_owner_id_foreign');
$table->dropIndex('servers_allocation_id_foreign');
$table->dropIndex('servers_service_id_foreign');
$table->dropIndex('servers_option_id_foreign');
$table->dropIndex('servers_pack_id_foreign');
$table->dropForeign(['node_id']);
$table->dropForeign(['owner_id']);
$table->dropForeign(['allocation_id']);
$table->dropForeign(['service_id']);
$table->dropForeign(['option_id']);
$table->renameColumn('node_id', 'node');
$table->renameColumn('owner_id', 'owner');
@ -77,6 +72,7 @@ class UpdateColumnNames extends Migration
$table->foreign('allocation')->references('id')->on('allocations');
$table->foreign('service')->references('id')->on('services');
$table->foreign('option')->references('id')->on('service_options');
$table->foreign('pack')->references('id')->on('service_packs');
});
}
}

View file

@ -1,5 +1,6 @@
<?php
use Pterodactyl\Models\ServiceOption;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
@ -14,14 +15,8 @@ class DeleteServiceExecutableOption extends Migration
public function up()
{
DB::transaction(function () {
Schema::table('services', function (Blueprint $table) {
$table->renameColumn('file', 'folder');
$table->text('description')->nullable()->change();
$table->text('startup')->nullable()->change();
});
// Attempt to fix any startup commands for servers
// that we possibly can.
// that we possibly can. Also set new containers.
foreach (ServiceOption::with('servers')->get() as $option) {
$option->servers->each(function ($s) use ($option) {
$prepend = $option->display_executable;
@ -29,12 +24,27 @@ class DeleteServiceExecutableOption extends Migration
$prepend = ($prepend === 'TerrariaServer.exe') ? 'mono TerrariaServer.exe' : $prepend;
$s->startup = $prepend . ' ' . $s->startup;
$container = $s->container;
if (starts_with($container, 'quay.io/pterodactyl/minecraft')) {
$s->container = 'quay.io/pterodactyl/core:java';
} elseif (starts_with($container, 'quay.io/pterodactyl/srcds')) {
$s->container = 'quay.io/pterodactyl/core:source';
} elseif (starts_with($container, 'quay.io/pterodactyl/voice')) {
$s->container = 'quay.io/pterodactyl/core:glibc';
} elseif (starts_with($container, 'quay.io/pterodactyl/terraria')) {
$s->container = 'quay.io/pterodactyl/core:mono';
}
$s->save();
});
}
Schema::table('services', function (Blueprint $table) {
$table->renameColumn('file', 'folder');
$table->dropColumn('executable');
$table->text('description')->nullable()->change();
$table->text('startup')->nullable()->change();
});
});
}

View file

@ -34,7 +34,7 @@ class AddNewServiceOptionsColumns extends Migration
public function down()
{
Schema::table('service_options', function (Blueprint $table) {
$table->dropForeign('config_from');
$table->dropForeign(['config_from']);
$table->dropColumn('config_from');
$table->dropColumn('config_stop');

View file

@ -49,6 +49,7 @@ class MigrateToNewServiceSystem extends Migration
} elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') {
$item->tag = 'source';
}
$item->save();
});
});
}

View file

@ -20,7 +20,7 @@ class ChangeServiceVariablesValidationRules extends Migration
DB::transaction(function () {
foreach (ServiceVariable::all() as $variable) {
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->regex;
$variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->rules;
$variable->save();
}
});

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddForeignKeyToPacks extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->foreign('pack_id')->references('id')->on('packs');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropForeign(['pack_id']);
});
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddServerDescriptionColumn extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->text('description')->after('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('description');
});
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropDeletedAtColumnFromServers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('servers', function (Blueprint $table) {
$table->dropColumn('deleted_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('servers', function (Blueprint $table) {
$table->timestamp('deleted_at')->nullable();
});
}
}

View file

@ -0,0 +1,52 @@
<?php
use Pterodactyl\Models\Task;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpgradeTaskSystem extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropForeign(['server']);
$table->renameColumn('server', 'server_id');
$table->unsignedInteger('user_id')->nullable()->after('id');
$table->foreign('server_id')->references('id')->on('servers');
$table->foreign('user_id')->references('id')->on('users');
});
DB::transaction(function () {
foreach(Task::all() as $task) {
$task->user_id = $task->server->owner_id;
$task->save();
}
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tasks', function (Blueprint $table) {
$table->dropForeign(['server_id']);
$table->dropForeign(['user_id']);
$table->renameColumn('server_id', 'server');
$table->dropColumn('user_id');
$table->foreign('server')->references('id')->on('servers');
});
}
}

View file

@ -116,7 +116,7 @@ EOF;
], [
'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/minecraft',
'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}}"}}}',
@ -131,9 +131,9 @@ EOF;
], [
'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/minecraft:spigot',
'docker_image' => 'quay.io/pterodactyl/core:java-glibc',
'config_startup' => null,
'config_files' => '{"spigot.yml":{"parser": "yaml", "find":{"settings.restart-on-crash": "false"}}}',
'config_files' => '{"spigot.yml":{"parser": "yaml", "find":{"settings.restart-on-crash": false}}}',
'config_logs' => null,
'config_stop' => null,
'config_from' => $this->option['vanilla']->id,
@ -146,7 +146,7 @@ EOF;
], [
'name' => 'Sponge (SpongeVanilla)',
'description' => 'SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.',
'docker_image' => 'quay.io/pterodactyl/minecraft:sponge',
'docker_image' => 'quay.io/pterodactyl/core:java-glibc',
'config_startup' => '{"userInteraction": [ "You need to agree to the EULA"]}',
'config_files' => null,
'config_logs' => null,
@ -161,7 +161,7 @@ EOF;
], [
'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/minecraft:bungeecord',
'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].query_enabled": true, "listeners[0].query_port": "{{server.build.default.port}}", "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"}',

View file

@ -75,7 +75,7 @@ class SourceServiceTableSeeder extends Seeder
], [
'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/srcds',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "gameserver Steam ID", "userInteraction": []}',
'config_files' => '{}',
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
@ -90,7 +90,7 @@ class SourceServiceTableSeeder extends Seeder
], [
'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/srcds',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => null,
'config_files' => null,
'config_logs' => null,
@ -105,7 +105,7 @@ class SourceServiceTableSeeder extends Seeder
], [
'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/srcds',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => null,
'config_files' => null,
'config_logs' => null,
@ -120,7 +120,7 @@ class SourceServiceTableSeeder extends Seeder
], [
'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/srcds:ark',
'docker_image' => 'quay.io/pterodactyl/core:source',
'config_startup' => '{"done": "Setting breakpad minidump AppID"}',
'config_files' => null,
'config_logs' => null,

View file

@ -63,6 +63,7 @@ class TerrariaServiceTableSeeder extends Seeder
'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' => Service::defaultIndexFile(),
]);
}
@ -74,7 +75,7 @@ class TerrariaServiceTableSeeder extends Seeder
], [
'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/terraria:tshock',
'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}}"}}}',

View file

@ -63,6 +63,7 @@ class VoiceServiceTableSeeder extends Seeder
'name' => 'Voice Servers',
'description' => 'Voice servers such as Mumble and Teamspeak 3.',
'startup' => '',
'index_file' => Service::defaultIndexFile(),
]);
}
@ -74,7 +75,7 @@ class VoiceServiceTableSeeder extends Seeder
], [
'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/voice:mumble',
'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"}',
@ -89,7 +90,7 @@ class VoiceServiceTableSeeder extends Seeder
], [
'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/voice:ts3',
'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"}',