From e0696900bb088e72dfc888284b119a94f52f5140 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 4 Nov 2016 20:37:40 -0400 Subject: [PATCH] Fix issue that would prevent Ark servers from being added to servers. Renamed migration file to force it to re-run on previously migrated systems. --- ...4_000949_add_ark_service_option_fixed.php} | 9 +++- database/seeds/SourceServiceTableSeeder.php | 50 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) rename database/migrations/{2016_10_30_000949_add_ark_service_option.php => 2016_11_04_000949_add_ark_service_option_fixed.php} (91%) diff --git a/database/migrations/2016_10_30_000949_add_ark_service_option.php b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php similarity index 91% rename from database/migrations/2016_10_30_000949_add_ark_service_option.php rename to database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php index 44562ee25..fa8d5dde6 100644 --- a/database/migrations/2016_10_30_000949_add_ark_service_option.php +++ b/database/migrations/2016_11_04_000949_add_ark_service_option_fixed.php @@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; -class AddArkServiceOption extends Migration +class AddArkServiceOptionFixed extends Migration { /** * Run the migrations. @@ -15,10 +15,17 @@ class AddArkServiceOption extends Migration { DB::transaction(function () { $service = DB::table('services')->select('id')->where('author', 'ptrdctyl-v040-11e6-8b77-86f30ca893d3')->where('name', 'Source Engine')->first(); + + // No SRCDS Service, Skipping if (!$service) { return; } + // Already have this service option installed. + if (DB::table('service_options')->select('id')->where('name', 'Ark: Survival Evolved')->where('parent_service', $service->id)->first()) { + return; + } + $oid = DB::table('service_options')->insertGetId([ 'parent_service' => $service->id, 'name' => 'Ark: Survival Evolved', diff --git a/database/seeds/SourceServiceTableSeeder.php b/database/seeds/SourceServiceTableSeeder.php index 2a02a52b4..2c4b25d55 100644 --- a/database/seeds/SourceServiceTableSeeder.php +++ b/database/seeds/SourceServiceTableSeeder.php @@ -87,6 +87,16 @@ class SourceServiceTableSeeder extends Seeder 'startup' => '-game {{SRCDS_GAME}} -console -port {{SERVER_PORT}} +map {{SRCDS_MAP}} -strictportbind -norestart' ]); + $this->option['ark'] = Models\ServiceOptions::create([ + 'parent_service' => $this->service->id, + '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', + 'tag' => 'ark', + 'docker_image' => 'quay.io/pterodactyl/srcds:ark', + 'executable' => './ShooterGameServer', + 'startup' => 'TheIsland?listen?ServerPassword={{ARK_PASSWORD}}?ServerAdminPassword={{ARK_ADMIN_PASSWORD}}?Port={{SERVER_PORT}}?MaxPlayers={{SERVER_MAX_PLAYERS}}' + ]); + $this->option['custom'] = Models\ServiceOptions::create([ 'parent_service' => $this->service->id, 'name' => 'Custom Source Engine Game', @@ -102,6 +112,7 @@ class SourceServiceTableSeeder extends Seeder { $this->addInsurgencyVariables(); $this->addTF2Variables(); + $this->addArkVariables(); $this->addCustomVariables(); } @@ -183,6 +194,45 @@ class SourceServiceTableSeeder extends Seeder ]); } + private function addArkVariables() + { + DB::table('service_variables')->insert([ + 'option_id' => $this->option['ark']->id, + 'name' => 'Server Password', + 'description' => 'If specified, players must provide this password to join the server.', + 'env_variable' => 'ARK_PASSWORD', + 'default_value' => '', + 'user_viewable' => 1, + 'user_editable' => 1, + 'required' => 0, + 'regex' => '/^(\w\.*)$/' + ]); + + DB::table('service_variables')->insert([ + 'option_id' => $this->option['ark']->id, + '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.', + 'env_variable' => 'ARK_ADMIN_PASSWORD', + 'default_value' => '', + 'user_viewable' => 1, + 'user_editable' => 1, + 'required' => 0, + 'regex' => '/^(\w\.*)$/' + ]); + + DB::table('service_variables')->insert([ + 'option_id' => $this->option['ark']->id, + 'name' => 'Maximum Players', + 'description' => 'Specifies the maximum number of players that can play on the server simultaneously.', + 'env_variable' => 'SERVER_MAX_PLAYERS', + 'default_value' => 20, + 'user_viewable' => 1, + 'user_editable' => 1, + 'required' => 1, + 'regex' => '/^(\d{1,4})$/' + ]); + } + private function addCustomVariables() { Models\ServiceVariables::create([