Change to Geyser

This commit is contained in:
Marc Baloup 2023-04-07 16:04:06 +02:00
parent d9ab4d6d7a
commit da43c38710
4 changed files with 28 additions and 76 deletions

View File

@ -1,22 +1,19 @@
FROM eclipse-temurin:17-jdk FROM eclipse-temurin:17-jdk
ARG RUNNABLE_SERVER_JAR ARG RUNNABLE_JAR
# create directories # create directories
WORKDIR /data WORKDIR /data
RUN mkdir bin bundle workdir RUN mkdir bin bundle workdir
# add executable files # add executable files
ADD $RUNNABLE_SERVER_JAR bin/paper.jar ADD $RUNNABLE_JAR bin/geyser.jar
ADD run.sh bin/run.sh ADD run.sh bin/run.sh
# download paper libraries and apply patches
RUN java -DbundlerRepoDir=/data/bundle -Dpaperclip.patchonly=true -jar /data/bin/paper.jar
# configure max heap size # configure max heap size
ENV MAXMEM=1024M ENV MAXMEM=1024M
EXPOSE 25565 EXPOSE 19132/udp
VOLUME /data/workdir VOLUME /data/workdir
WORKDIR /data/workdir WORKDIR /data/workdir

View File

@ -3,9 +3,8 @@ Docker Compose Example
```yml ```yml
version: "3" version: "3"
services: services:
paper: (server-name):
image: "cr.pandacube.fr/paper:(version)" image: "cr.pandacube.fr/geyser:(version)"
container_name: (server name)
stdin_open: true # docker run -i stdin_open: true # docker run -i
tty: true # docker run -t tty: true # docker run -t
user: "1000:1000" # uid and gid of owner of working dir user: "1000:1000" # uid and gid of owner of working dir
@ -17,5 +16,5 @@ services:
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
ports: ports:
- "0.0.0.0:(port):25565" - "0.0.0.0:(port):19132/udp"
``` ```

View File

@ -1,75 +1,39 @@
#!/bin/bash #!/bin/bash
URL_PROJECT='https://api.papermc.io/v2/projects/paper' URL_BUILD='https://download.geysermc.org/v2/projects/geyser/versions/latest/builds/latest'
echo "Getting Paper last build id for MC "$MC_VERSION"..." echo "Getting Geyser last build infos..."
URL_VERSION=$URL_PROJECT'/versions/'$MC_VERSION
# get paper build version # get paper build version
if ! curl -s $URL_VERSION -o version_infos.json; then if ! curl -s $URL_BUILD -o build_infos.json; then
echo -e "Error: Cant join API" echo -e "Error: Cant join API"
exit 1 exit 1
fi fi
if ! jq -r '.version' -e < build_infos.json > /dev/null; then
if ! jq -r '.builds[-1]' -e < version_infos.json > build_number.txt; then echo -e "API returned an error"
echo -e "API returned an error (probably MC_VERSION is not valid)"
exit 1 exit 1
fi fi
PAPER_BUILD=`cat build_number.txt` GEYSER_VERSION=$(jq -r '.version' < build_infos.json)
URL_BUILD=$URL_VERSION'/builds/'$PAPER_BUILD GEYSER_BUILD=$(jq -r '.build' < build_infos.json)
echo "Geyser verion $GEYSER_VERSION build #$GEYSER_BUILD"
DOWNLOAD_URL=$URL_BUILD'/downloads/standalone'
RUNNABLE_JAR='Geyser-'$GEYSER_VERSION'-'$GEYSER_BUILD'.jar'
echo "Downloadling Geyser Standalone..."
echo "From "$DOWNLOAD_URL
echo "To "$RUNNABLE_JAR
curl -o $RUNNABLE_JAR $DOWNLOAD_URL
DOWNLOAD_REOBF=$URL_BUILD'/downloads/paper-'$MC_VERSION'-'$PAPER_BUILD'.jar' DOCKER_TAG="cr.pandacube.fr/geyser:"$GEYSER_VERSION"-"$GEYSER_BUILD
echo "Building docker image of Geyser Standalone "$DOCKER_TAG
docker build --build-arg RUNNABLE_JAR=$RUNNABLE_JAR -t $DOCKER_TAG .
# the runnable jar is actually paperclip
RUNNABLE_SERVER_JAR='Paper-'$MC_VERSION'-'$PAPER_BUILD'.jar'
#UBER_SERVER_JAR='Paper-uberjar-'$MC_VERSION'-'$PAPER_BUILD'.jar'
echo "Downloadling Paperclip for Paper-"$MC_VERSION"-"$PAPER_BUILD"..."
echo "From "$DOWNLOAD_REOBF
echo "To "$RUNNABLE_SERVER_JAR
curl -o $RUNNABLE_SERVER_JAR $DOWNLOAD_REOBF
#java -version
# run it to generate final jar, but not launching the actual server (-v option)
#echo "Running Paperclip..."
#mkdir bundle
#java -DbundlerRepoDir=bundle -Dpaperclip.patchonly=true -jar $RUNNABLE_SERVER_JAR
# important that versions/ comes first. It will be extracted first,
# and following extraction will not override any file
#find bundle/versions/ bundle/libraries/ -type f -name '*.jar' > jars.txt
DOCKER_TAG="cr.pandacube.fr/paper:"$MC_VERSION"-"$PAPER_BUILD
echo "Building docker image with pre-downloaded and pre-patched files, with tag "$DOCKER_TAG
docker build --build-arg RUNNABLE_SERVER_JAR=$RUNNABLE_SERVER_JAR -t $DOCKER_TAG .
#DOCKER_IMAGE_FILE="Paper-docker-"$MC_VERSION"-"$PAPER_BUILD".tar.gz"
#echo "Saving docker image to "$DOCKER_IMAGE_FILE
#docker save $DOCKER_TAG | gzip > $DOCKER_IMAGE_FILE
echo "Pushing image to Pandacubes container registry" echo "Pushing image to Pandacubes container registry"
docker push $DOCKER_TAG docker push $DOCKER_TAG
#mkdir uberjar
#for jar in `cat jars.txt`; do
# unzip -d uberjar -nq $jar
#done
#(
# cd uberjar
# # exclude some stuff, especially about jar signature and stuff
# rm -f META-INF/*.SF META-INF/*.DSA META-INF/*.RSA
# # create the uber jar
# zip -r '../'$UBER_SERVER_JAR *
#)
#mvn install:install-file -Dfile=$UBER_SERVER_JAR -DgroupId=io.papermc.paper -DartifactId=paper -Dversion=$MC_VERSION-$PAPER_BUILD-SNAPSHOT -Dpackaging=jar

10
run.sh
View File

@ -1,11 +1,3 @@
#!/bin/sh #!/bin/sh
exec java -Xmx$MAXMEM -XX:+UseG1GC -XX:+ParallelRefProcEnabled \ exec java -Xmx$MAXMEM -XX:+UseG1GC -jar /data/bin/geyser.jar
-XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions \
-XX:G1ReservePercent=15 -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=30 \
-XX:G1HeapRegionSize=8M -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 \
-XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 \
-XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 \
-XX:MaxHeapFreeRatio=30 -XX:MinHeapFreeRatio=5 \
-DbundlerRepoDir=/data/bundle \
-jar /data/bin/paper.jar nogui