Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,24 @@ If you have attached a host directory to the `/data` volume, then you can instal

[You can also auto-download plugins using `SPIGET_RESOURCES`.](#auto-downloading-spigotmcbukkitpapermc-plugins-with-spiget)

### Running a Folia server

Enable Folia server mode by adding a `-e TYPE=FOLIA` to your command-line.

By default, the container will run the latest build of [Folia server](https://papermc.io/downloads) but you can also choose to run a specific build with `-e FOLIABUILD=26`.

docker run -d -v /path/on/host:/data \
-e TYPE=FOLIA \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server

If you are hosting your own copy of Folia you can override the download URL with `FOLIA_DOWNLOAD_URL=<url>`.

If you have attached a host directory to the `/data` volume, then you can install plugins via the `plugins` subdirectory. You can also [attach a `/plugins` volume](#optional-plugins-mods-and-config-attach-points). If you add plugins while the container is running, you'll need to restart it to pick those up.

[You can also auto-download plugins using `SPIGET_RESOURCES`.](#auto-downloading-spigotmcbukkitpapermc-plugins-with-spiget)

> NOTE: The Folia type inherits from the Paper type. Paper's variables will override the Folia ones.

### Running a Pufferfish server

A [Pufferfish](https://github.com/pufferfish-gg/Pufferfish) server, which is "a highly optimized Paper fork designed for large servers requiring both maximum performance, stability, and "enterprise" features."
Expand Down
4 changes: 4 additions & 0 deletions scripts/start-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ case "${TYPE^^}" in
exec "${SCRIPTS:-/}start-deployPaper" "$@"
;;

FOLIA)
exec "${SCRIPTS:-/}start-deployFolia" "$@"
;;

FORGE)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployForge" "$@"
Expand Down
11 changes: 11 additions & 0 deletions scripts/start-deployFolia
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [[ $FOLIA_DOWNLOAD_URL ]]; then
export PAPER_DOWNLOAD_URL="$FOLIA_DOWNLOAD_URL"
fi

if [[ $FOLIABUILD ]]; then
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have suggested FOLIA_BUILD, but yes it was unfortunately already PAPERBUILD without underscore.

export PAPERBUILD="$FOLIABUILD"
fi

PAPER_PROJECT="folia" PAPER_NAME="FoliaMC" exec ${SCRIPTS:-/}start-deployPaper "$@"
34 changes: 20 additions & 14 deletions scripts/start-deployPaper
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,28 @@ handleDebugMode
ourScript="$0"
ourArgs=("$@")

# Check if we're running Folia.
if [[ -z $PAPER_PROJECT ]]; then
PAPER_PROJECT="paper"
PAPER_NAME="PaperMC"
fi

function handleMissingVersion() {
expectedVersion=${VANILLA_VERSION}
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}" -H "accept: application/json")
if [[ $VERSION = LATEST ]]; then
tries=0
while ((tries++ < 5)); do
VANILLA_VERSION=$(echo "$versions" | jq -r ".versions[$((- tries))]")
if [[ $(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
if [[ $(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}" -H "accept: application/json" \
| jq '.builds[-1]') != null ]]; then
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by ${PAPER_NAME}"
# re-execute the current script with the newly computed version
exec "$ourScript" "${ourArgs[@]}"
fi
done
fi
log "ERROR: ${expectedVersion} is not published by PaperMC"
log "ERROR: ${expectedVersion} is not published by ${PAPER_NAME}"
log " Set VERSION to one of the following: "
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
exit 1
Expand All @@ -40,13 +46,13 @@ elif [[ $PAPER_DOWNLOAD_URL ]]; then
zarg=(-z "$SERVER")
fi

echo "Preparing custom PaperMC jar from $PAPER_DOWNLOAD_URL"
echo "Preparing custom ${PAPER_NAME} jar from $PAPER_DOWNLOAD_URL"

curl -fsSL -o "$SERVER" "${zarg[@]}" "${PAPER_DOWNLOAD_URL}"
else
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
# Paper API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config

build=${PAPERBUILD:=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
build=${PAPERBUILD:=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}" -H "accept: application/json" \
| jq '.builds[-1]')}
case $? in
0)
Expand All @@ -55,7 +61,7 @@ else
handleMissingVersion
;;
*)
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
echo "ERROR: unknown error while looking up ${PAPER_NAME} version=${VANILLA_VERSION}"
exit 1
;;
esac
Expand All @@ -64,29 +70,29 @@ else
handleMissingVersion
fi

export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
| jq -r '.downloads.application.name')
if [ $? != 0 ]; then
echo "ERROR: failed to lookup PaperMC download file from version=${VANILLA_VERSION} build=${build}"
echo "ERROR: failed to lookup ${PAPER_NAME} download file from version=${VANILLA_VERSION} build=${build}"
exit 1
fi

if [ -f "$SERVER" ]; then
zarg=(-z "$SERVER")
fi

log "Removing old PaperMC versions ..."
log "Removing old ${PAPER_NAME} versions ..."
shopt -s nullglob
for f in paper-*.jar; do
[[ $f != $SERVER ]] && rm $f
done

log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
log "Downloading ${PAPER_NAME} $VANILLA_VERSION (build $build) ..."
curl -fsSL -o "$SERVER" "${zarg[@]}" \
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
"https://papermc.io/api/v2/projects/${PAPER_PROJECT}/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
-H "accept: application/java-archive"
if [ $? != 0 ]; then
echo "ERROR: failed to download PaperMC from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
echo "ERROR: failed to download ${PAPER_NAME} from version=${VANILLA_VERSION} build=${build} download=${SERVER}"
exit 1
fi
fi
Expand Down