Compare commits

..

13 Commits
1.1.0 ... 1.3.0

Author SHA1 Message Date
Geoff Bourne
ec0329efb1 ci: added option to sign git tags 2020-06-20 15:42:45 -05:00
Geoff Bourne
477caa12c3 ci: switched image push to use Gitub Actions 2020-06-20 15:35:37 -05:00
Geoff Bourne
8f82ff9b1d Added support for Catserver type 2020-06-20 15:28:30 -05:00
Geoff Bourne
7d97fdcbec Clarified setting VERSION for unavailable Mohist builds 2020-06-20 09:07:38 -05:00
Geoff Bourne
5ee0150154 docs: added development note about generating release notes 2020-06-19 16:09:09 -05:00
Geoff Bourne
1bcacfc474 docs: added a bunch more development notes 2020-06-19 15:34:56 -05:00
Geoff Bourne
34603184a4 Activated useSystemProxies java property when proxy config set
Fixes #415
2020-06-19 15:33:33 -05:00
Geoff Bourne
2ee5a25c91 ci: adjusted main github action name 2020-06-19 13:23:05 -05:00
Geoff Bourne
60ef1b8867 ci: fixed github action tags matching 2020-06-19 13:15:23 -05:00
Geoff Bourne
3eaf756aa2 ci: adjusted github actions to build non-multiarch branches/tags 2020-06-19 11:41:53 -05:00
Geoff Bourne
bc318fa185 Added support for Mohist servers 2020-06-19 11:31:56 -05:00
Geoff Bourne
f93c42a23f Added support for tagging during docker-versions-create.sh 2020-06-19 11:31:41 -05:00
Geoff Bourne
f5dde77efe Enabled iterative development with SCRIPTS var 2020-06-19 11:05:32 -05:00
28 changed files with 278 additions and 56 deletions

View File

@@ -1,10 +1,21 @@
# This is a basic workflow to help you get started with Actions
name: build
name: Build and publish non-multiarch branches/tags
on:
push:
branches: [ master ]
branches:
- master
- openj9
- openj9-nightly
- adopt11
- adopt13
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-openj9"
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
pull_request:
branches: [ master ]
@@ -25,4 +36,4 @@ jobs:
tag_with_sha: true
cache_froms: itzg/minecraft-server:latest
add_git_labels: true
push: false
push: true

74
DEVELOPMENT.md Normal file
View File

@@ -0,0 +1,74 @@
## Adding a server type
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
1. Copy an existing "start-deploy*" script, such as [start-deployMohist](start-deployMohist) and rename it accordingly making sure to retain the "start-deploy" prefix
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-finalSetup01World` at the end of the script
3. Develop and test the changes using the [iterative process described below](#iterative-script-development)
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration](start-configuration)
5. Add a section to the [README](README.md). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
6. [Submit a pull request](https://github.com/itzg/docker-minecraft-server/pulls)
## Iterative script development
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
First, build a baseline of the image to include the packages needed by existing or new scripts:
```shell script
docker build -t mc-dev .
```
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
```shell script
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev
```
From within the container you can run individual scripts via the attached `/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually:
```shell script
export VANILLA_VERSION=1.12.2
/scripts/start-magma
```
...or pre-pending script execution:
```shell script
VANILLA_VERSION=1.12.2 /scripts/start-magma
```
> NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
## Multi-base-image variants
Several base-image variants are maintained in order to offer choices in JDK provider and version. The variants are maintained in their respective branches:
- openj9
- openj9-nightly
- adopt11
- adopt13
- multiarch
The [docker-versions-create.sh](docker-versions-create.sh) script is configured with the branches to maintain and is used to merge changes from the master branch into the mulit-base variant branches. The script also manages git tagging the master branch along with the merged branches. So a typical use of the script would be like:
```shell script
./docker-versions-create.sh -s -t 1.2.0
```
> Most often the major version will be bumped unless a bug or hotfix needs to be published in which case the patch version should be incremented.
> The build and publishing of those branches and their tags is currently performed within Docker Hub.
## multiarch support
The [multiarch branch](https://github.com/itzg/docker-minecraft-server/tree/multiarch) supports running the image on amd64, arm64, and armv7 (aka RaspberryPi). Unlike the mainline branches, it is based on Ubuntu 18.04 since the openjdk package provided by Ubuntu includes full JIT support on all of the processor types.
The multiarch images are built and published by [a Github action](https://github.com/itzg/docker-minecraft-server/actions?query=workflow%3A%22Build+and+publish+multiarch%22), which [is configured in that branch](https://github.com/itzg/docker-minecraft-server/blob/multiarch/.github/workflows/build-multiarch.yml).
## Generating release notes
The following git command can be used to provide the bulk of release notes content:
```shell script
git log --invert-grep --grep "^ci:" --grep "^misc:" --pretty="- %s" 1.1.0..1.2.0
```

View File

@@ -525,6 +525,24 @@ A [Magma](https://magmafoundation.org/) server, which is a combination of Forge
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
## Running a Mohist server
A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
-e TYPE=MOHIST
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
## Running a Catserver type server
A [Catserver](http://catserver.moe/) type server can be used with
-e TYPE=CATSERVER
> **NOTE** Catserver only provides a single release stream, so `VERSION` is ignored
## Running a server with a Feed the Beast modpack
> **NOTE** requires `itzg/minecraft-server:multiarch` image

View File

@@ -10,12 +10,32 @@ function TrapExit {
batchMode=false
while getopts "b" arg
while getopts "hbt:s" arg
do
case $arg in
b)
batchMode=true
;;
t)
tag=${OPTARG}
;;
s)
tagArgs="-s -m 'Signed during docker-versions-create"
;;
h)
echo "
Usage $0 [options]
Options:
-b enable batch mode, which avoids interactive prompts and causes script to fail immediately
when any merge fails
-t TAG tag and push the current revision on master with the given tag
and apply respective tags to each branch
-s enable signed tags
-h display this help and exit
"
exit
;;
*)
echo "Unsupported arg $arg"
exit 2
@@ -34,6 +54,10 @@ test -d ./.git || { echo ".git folder was not found. Please start this script fr
git checkout master
git pull --all || { echo "Can't pull the repo!"; \
exit 1; }
if [[ $tag ]]; then
git tag $tag
git push origin $tag
fi
git_branches=$(git branch -a)
@@ -57,6 +81,10 @@ for branch in "${branches_list[@]}"; do
git commit -m "Auto merge branch with master" -a
# push may fail if remote doesn't have this branch yet. In this case - sending branch
git push || git push -u origin "$branch" || { echo "Can't push changes to the origin."; exit 1; }
if [[ $tag ]]; then
git tag "$tag-$branch"
git push origin "$tag-$branch"
fi
elif ${batchMode}; then
status=$?
echo "Git merge failed in batch mode"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
echo "Java process suspended by Autopause function"

6
start
View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
umask 0002
chmod g+w /data
@@ -45,7 +45,7 @@ if [ $(id -u) = 0 ]; then
echo 'hosts: files dns' > /etc/nsswitch.conf
fi
exec su-exec ${runAsUser}:${runAsGroup} /start-configuration $@
exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
else
exec /start-configuration $@
exec ${SCRIPTS:-/}start-configuration $@
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
log "Autopause functionality enabled"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
shopt -s nullglob
@@ -40,6 +40,7 @@ rm /data/.verify_access || true
if [[ $PROXY ]]; then
export http_proxy="$PROXY"
export https_proxy="$PROXY"
export JAVA_TOOL_OPTIONS+="-Djava.net.useSystemProxies=true"
log "INFO: Giving proxy time to startup..."
sleep 5
fi
@@ -69,53 +70,61 @@ cd /data || exit 1
export ORIGINAL_TYPE=${TYPE^^}
if isTrue "${ENABLE_AUTOPAUSE}"; then
/start-autopause
${SCRIPTS:-/}start-autopause
fi
log "Resolving type given ${TYPE}"
case "${TYPE^^}" in
*BUKKIT|SPIGOT)
exec /start-deployBukkitSpigot "$@"
exec ${SCRIPTS:-/}start-deployBukkitSpigot "$@"
;;
PAPER)
exec /start-deployPaper "$@"
exec ${SCRIPTS:-/}start-deployPaper "$@"
;;
TUINITY)
exec /start-deployTuinity "$@"
exec ${SCRIPTS:-/}start-deployTuinity "$@"
;;
FORGE)
exec /start-deployForge "$@"
exec ${SCRIPTS:-/}start-deployForge "$@"
;;
FABRIC)
exec /start-deployFabric "$@"
exec ${SCRIPTS:-/}start-deployFabric "$@"
;;
FTB|CURSEFORGE)
exec /start-deployFTB "$@"
exec ${SCRIPTS:-/}start-deployFTB "$@"
;;
VANILLA)
exec /start-deployVanilla "$@"
exec ${SCRIPTS:-/}start-deployVanilla "$@"
;;
SPONGEVANILLA)
exec /start-deploySpongeVanilla "$@"
exec ${SCRIPTS:-/}start-deploySpongeVanilla "$@"
;;
CUSTOM)
exec /start-deployCustom "$@"
exec ${SCRIPTS:-/}start-deployCustom "$@"
;;
CURSE_INSTANCE)
exec /start-validateCurseInstance "$@"
exec ${SCRIPTS:-/}start-validateCurseInstance "$@"
;;
MAGMA)
exec /start-magma "$@"
exec ${SCRIPTS:-/}start-deployMagma "$@"
;;
MOHIST)
exec ${SCRIPTS:-/}start-deployMohist "$@"
;;
CATSERVER)
exec ${SCRIPTS:-/}start-deployCatserver "$@"
;;
*)

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
set -e
@@ -102,4 +102,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

32
start-deployCatserver Normal file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
set -o pipefail
set -e
latestAsset=$(
curl -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/latest | \
jq '.assets[] | select(.name | match(".*-universal.jar"))'
)
if [[ -z "${latestAsset}" ]]; then
log "ERROR: latest release of Catserver is missing universal.jar asset"
exit 1
fi
isDebugging && log "Latest asset ${latestAsset}"
latestJarName=$(echo ${latestAsset} | jq --raw-output '.name')
latestJarId=$(echo ${latestAsset} | jq --raw-output '.id')
export SERVER="/data/${latestJarName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${latestJarName}"
curl -H "Accept:application/octet-stream" -o "$SERVER" -fsSL https://api.github.com/repos/Luohuayu/CatServer/releases/assets/${latestJarId}
fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if isURL ${CUSTOM_SERVER}; then
filename=$(basename ${CUSTOM_SERVER})
@@ -28,4 +28,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
export FTB_BASE_DIR=/data/FeedTheBeast
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
@@ -135,4 +135,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then
fi
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -eu
. /start-utils
. ${SCRIPTS:-/}start-utils
export TYPE=FABRIC
@@ -75,4 +75,4 @@ else
fi
# Contineut to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
export TYPE=FORGE
@@ -113,4 +113,4 @@ else
fi
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

4
start-magma → start-deployMagma Executable file → Normal file
View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
@@ -15,4 +15,4 @@ fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

43
start-deployMohist Normal file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
set -o pipefail
set -e
isDebugging && set -x
requireVar VANILLA_VERSION
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1
fi
latestBuildRelPath=$(
curl -fsSL "${mohistJob}lastSuccessfulBuild/api/json" |
jq -r '.artifacts[0].relativePath'
)
baseName=$(basename "${latestBuildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
log " and set VERSION accordingly"
exit 1
fi
export SERVER="/data/${baseName}"
if [ ! -f ${SERVER} ]; then
log "Downloading ${baseName}"
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
fi
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec ${SCRIPTS:-/}start-finalSetup01World "$@"

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
: ${PAPERBUILD:=latest}
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
@@ -20,4 +20,4 @@ export TYPE=SPIGOT
export SKIP_LOG4J_CONFIG=true
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
export TYPE=spongevanilla
@@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
fi
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if [ "${VERSION}" != "LATEST" ]; then
log "ERROR: Tunity server type only supports VERSION=LATEST"
@@ -24,4 +24,4 @@ fi
export TYPE=SPIGOT
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
isDebugging && set -x
set -o pipefail
@@ -43,4 +43,4 @@ fi
isDebugging && ls -l
# Continue to Final Setup
exec /start-finalSetup01World $@
exec ${SCRIPTS:-/}start-finalSetup01World $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
set -e
isDebugging && set -x
@@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
fi
fi
exec /start-finalSetup02Modpack $@
exec ${SCRIPTS:-/}start-finalSetup02Modpack $@

View File

@@ -2,7 +2,7 @@
set -e
. /start-utils
. ${SCRIPTS:-/}start-utils
# CURSE_URL_BASE used in manifest downloads below
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
@@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
fi
fi
exec /start-finalSetup03Modconfig $@
exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
if [[ "$MODCONFIG" ]]; then
@@ -24,4 +24,4 @@ case "X$MODCONFIG" in
esac
fi
exec /start-finalSetup04ServerProperties $@
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
# FUNCTIONS
function setServerProp {
@@ -194,4 +194,4 @@ if isDebugging; then
cat /data/server.properties
fi
exec /start-finalSetup05EnvVariables $@
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
@@ -25,4 +25,4 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
done < <(env)
fi
exec /start-minecraftFinalSetup $@
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if [ -n "$OPS" ]; then
log "Setting/adding ops"

View File

@@ -99,4 +99,11 @@ function versionLessThan {
return 1
fi
fi
}
}
requireVar() {
if [ ! -v $1 ]; then
log "ERROR: $1 is required to be set"
exit 1
fi
}

View File

@@ -1,6 +1,6 @@
#!/bin/bash
. /start-utils
. ${SCRIPTS:-/}start-utils
if ! [[ -v CURSE_INSTANCE_JSON ]]; then
log "ERROR: CURSE_INSTANCE_JSON needs to be set"
@@ -15,4 +15,4 @@ fi
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
# Continue to Final Setup
exec /start-finalSetup01World "$@"
exec ${SCRIPTS:-/}start-finalSetup01World "$@"