From 7993202689a963381f14cb6d0a641c49fb0614e0 Mon Sep 17 00:00:00 2001 From: Polarcraft Date: Sat, 8 Jul 2017 21:40:14 -0500 Subject: [PATCH 1/4] Added a Forge Service Option --- .../seeds/MinecraftServiceTableSeeder.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/database/seeds/MinecraftServiceTableSeeder.php b/database/seeds/MinecraftServiceTableSeeder.php index c2ed986e3..76e0b1b39 100644 --- a/database/seeds/MinecraftServiceTableSeeder.php +++ b/database/seeds/MinecraftServiceTableSeeder.php @@ -243,6 +243,41 @@ EOF; 'startup' => null, 'script_install' => $script, ]); + + $script = <<<'EOF' +#!/bin/ash +# Forge Installation Script +# +# Server Files: /mnt/server +apk update +apk add curl openjdk8 + +FUCK_FORGE_NOT_HAVING_A_GOOD_WAY_TO_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 $FUCK_FORGE_NOT_HAVING_A_GOOD_WAY_TO_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 +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, + ]); } private function addVariables() @@ -251,6 +286,7 @@ EOF; $this->addSpigotVariables(); $this->addSpongeVariables(); $this->addBungeecordVariables(); + $this->addForgeVariables(); } private function addVanillaVariables() @@ -372,4 +408,20 @@ 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)$/', + ]); + } + } From 23d6907c9cf16bf81375751a592d7e3313f3dca1 Mon Sep 17 00:00:00 2001 From: Polarcraft Date: Sat, 8 Jul 2017 21:41:39 -0500 Subject: [PATCH 2/4] Remove pesky space --- database/seeds/MinecraftServiceTableSeeder.php | 1 - 1 file changed, 1 deletion(-) diff --git a/database/seeds/MinecraftServiceTableSeeder.php b/database/seeds/MinecraftServiceTableSeeder.php index 76e0b1b39..a441bc56a 100644 --- a/database/seeds/MinecraftServiceTableSeeder.php +++ b/database/seeds/MinecraftServiceTableSeeder.php @@ -423,5 +423,4 @@ EOF; 'rules' => 'required|regex:/^([\w\d._-]+)(\.jar)$/', ]); } - } From 501f4f9a83d2826762488badad0195fdca2831dd Mon Sep 17 00:00:00 2001 From: Polarcraft Date: Sat, 8 Jul 2017 22:04:14 -0500 Subject: [PATCH 3/4] Renamed funny variable --- database/seeds/MinecraftServiceTableSeeder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/seeds/MinecraftServiceTableSeeder.php b/database/seeds/MinecraftServiceTableSeeder.php index a441bc56a..ba207dfde 100644 --- a/database/seeds/MinecraftServiceTableSeeder.php +++ b/database/seeds/MinecraftServiceTableSeeder.php @@ -252,8 +252,8 @@ EOF; apk update apk add curl openjdk8 -FUCK_FORGE_NOT_HAVING_A_GOOD_WAY_TO_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 $FUCK_FORGE_NOT_HAVING_A_GOOD_WAY_TO_GET_VERSIONS | sed 's/ //g') +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 From 63deed91939537c69476d70054ee998cd2a96110 Mon Sep 17 00:00:00 2001 From: Polarcraft Date: Sun, 9 Jul 2017 20:01:45 -0500 Subject: [PATCH 4/4] Quick Fix With this fix, I removed the installation of Java 8 from the container and set the script container to be java8. --- database/seeds/MinecraftServiceTableSeeder.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/database/seeds/MinecraftServiceTableSeeder.php b/database/seeds/MinecraftServiceTableSeeder.php index ba207dfde..74d777f42 100644 --- a/database/seeds/MinecraftServiceTableSeeder.php +++ b/database/seeds/MinecraftServiceTableSeeder.php @@ -250,7 +250,7 @@ EOF; # # Server Files: /mnt/server apk update -apk add curl openjdk8 +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') @@ -261,6 +261,7 @@ curl -sS http://files.minecraftforge.net/maven/net/minecraftforge/forge/$LATEST_ 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([ @@ -277,6 +278,7 @@ EOF; 'config_from' => null, 'startup' => 'java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}', 'script_install' => $script, + 'script_container' => 'frolvlad/alpine-oraclejdk8:cleaned', ]); }