Skip to content

Commit

Permalink
V1
Browse files Browse the repository at this point in the history
V1
  • Loading branch information
BeastGamer81 authored Apr 1, 2024
2 parents 85c8ba1 + 26ea9de commit cee224c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:
push:
branches:
- docker
- beta
jobs:
push:
name: 'klovitegg:beta'
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update \
&& apt-get -y upgrade \
&& apt -y --no-install-recommends install curl wget unzip git tar bash lsof software-properties-common ca-certificates openssl figlet \
&& apt -y --no-install-recommends install curl wget unzip git npm nodejs tar bash lsof software-properties-common ca-certificates openssl figlet zip unzip \
&& useradd -ms /bin/bash container

WORKDIR /opt

RUN curl -s "https://get.sdkman.io" | bash && source ".sdkman/bin/sdkman-init.sh"
RUN curl -s "https://get.sdkman.io" | bash && bash "/root/.sdkman/bin/sdkman-init.sh"

USER container
ENV USER=container HOME=/home/container
Expand All @@ -19,4 +19,4 @@ WORKDIR /home/container
COPY ./entrypoint.sh /entrypoint.sh
COPY ./install.sh /install.sh

CMD ["/bin/bash", "/entrypoint.sh"]
CMD ["/bin/bash", "/install.sh"]
66 changes: 27 additions & 39 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

display() {
echo -e "\033c"
echo "
==========================================================================
Expand Down Expand Up @@ -33,6 +32,14 @@ curl -s -o tmp/jq -L https://github.com/jqlang/jq/releases/download/jq-1.7rc1/jq
chmod +x tmp/jq
fi
}
installsdkman() {
if [ ! "$(command -v sdk version)" ]; then
curl -s "https://get.sdkman.io" | bash
source ".sdkman/bin/sdkman-init.sh"
fi
}



installPhp() {
installJq
Expand Down Expand Up @@ -71,17 +78,11 @@ jq() {
}

# Validation functions
validateJavaVersion() {
if [ ! "$(command -v java)" ]; then
echo "Java is missing! Please ensure the 'Java' Docker image is selected in the startup options and then restart the server."
sleep 5
exit
fi

JAVA_VERSION=$(getJavaVersion)

installJq

installsdkman
VER_EXISTS=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r --arg VERSION $MINECRAFT_VERSION '.versions[] | contains($VERSION)' | grep -m1 true)
LATEST_VERSION=$(curl -s https://api.papermc.io/v2/projects/paper | jq -r '.versions' | jq -r '.[-1]')

Expand All @@ -90,39 +91,24 @@ validateJavaVersion() {
fi

MINECRAFT_VERSION_CODE=$(echo "$MINECRAFT_VERSION" | cut -d. -f1-2 | tr -d '.')
if [ "$MINECRAFT_VERSION_CODE" -ge "120" ]; then
if [ "$JAVA_VERSION" -lt "18" ]; then
echo "$(tput setaf 1)Invalid docker image. Change it to Java 18"
sleep 10
exit
fi
elif [ "$MINECRAFT_VERSION_CODE" -ge "118" ]; then
if [ "$JAVA_VERSION" -lt "17" ]; then
echo "$(tput setaf 1)Invalid docker image. Change it to Java 17"
sleep 10
exit
fi
elif [ "$MINECRAFT_VERSION_CODE" -ge "117" ]; then
if [ "$JAVA_VERSION" -lt "16" ]; then
echo "$(tput setaf 1)Invalid docker image. Change it to Java 16 or Java 17"
sleep 10
exit
fi
fi
}
if [ "$MINECRAFT_VERSION_CODE" -ge "120" ]; then
sdk install java 21.0.2-tem
elif [ "$MINECRAFT_VERSION_CODE" -ge "117" ]; then
sdk install java 17.0.0-tem
elif [ "$MINECRAFT_VERSION_CODE" -ge "112" ]; then
sdk install java 11.0.22-tem
elif [ "$MINECRAFT_VERSION_CODE" -eq "18" ]; then
sdk install java 8.0.392-tem
fi


# Launch functions
launchJavaServer() {

if [ "$1" != "proxy" ]; then
validateJavaVersion
fi

# Remove 200 mb to prevent server freeze
number=200
memory=$((SERVER_MEMORY - number))

java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
java -Xms128M -Xmx${memory}M -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -DPaper.IgnoreJavaVersion=true -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar nogui
}

launchPMMPServer() {
Expand All @@ -146,11 +132,13 @@ launchPMMPServer() {
}

launchNodeServer() {
if [ ! "$(command -v node)" ]; then
echo "Node.js is missing! Please ensure the 'NodeJS' Docker image is selected in the startup options and then restart the server."
sleep 5
exit
fi
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

nvm install $NODE_VERSION
nvm use $NODE_VERSION

if [ -n "$NODE_DEFAULT_ACTION" ]; then
action="$NODE_DEFAULT_ACTION"
else
Expand Down
25 changes: 12 additions & 13 deletions egg.json → klovitegg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,11 @@
},
"exported_at": "2023-08-23T20:49:03+05:30",
"name": "MultiEgg | KlovitEgg",
"author": "dark@zexade.com",
"author": "dark@klovit.tech",
"description": null,
"features": null,
"docker_images": {
"Java 18": "ghcr.io\/pterodactyl\/yolks:java_18",
"Java 17": "ghcr.io\/pterodactyl\/yolks:java_17",
"Java 16": "ghcr.io\/pterodactyl\/yolks:java_16",
"Java 11": "ghcr.io\/pterodactyl\/yolks:java_11",
"Java 8": "ghcr.io\/pterodactyl\/yolks:java_8",
"NodeJS 20": "ghcr.io\/parkervcp\/yolks:nodejs_20",
"NodeJS 19": "ghcr.io\/parkervcp\/yolks:nodejs_19",
"NodeJS 18": "ghcr.io\/parkervcp\/yolks:nodejs_18",
"NodeJS 17": "ghcr.io\/parkervcp\/yolks:nodejs_17",
"NodeJS 16": "ghcr.io\/parkervcp\/yolks:nodejs_16",
"NodeJS 14": "ghcr.io\/parkervcp\/yolks:nodejs_14",
"NodeJS 12": "ghcr.io\/parkervcp\/yolks:nodejs_12"
"Klovit Egg": "ghcr.io\/beastgamer81\/klovitegg:latest"
},
"file_denylist": [
"install.sh",
Expand Down Expand Up @@ -62,6 +51,16 @@
"rules": "required|string|in:PM5,PM4",
"field_type": "text"
},
{
"name": "Node Version",
"description": "The version of Node to download. Leave at latest to always get the latest version. Invalid versions will default to latest.",
"env_variable": "NODE_VERSION",
"default_value": "latest",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string|max:20",
"field_type": "text"
},
{
"name": "NodeJS Main file",
"description": "The file that starts the app.\r\nCan be .js and .ts",
Expand Down

0 comments on commit cee224c

Please sign in to comment.