From 34603184a47688cf77b6838d29c51059f1391570 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 19 Jun 2020 15:33:33 -0500 Subject: [PATCH 1/7] Activated useSystemProxies java property when proxy config set Fixes #415 --- start-configuration | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/start-configuration b/start-configuration index a41cae58..f5f9e23a 100644 --- a/start-configuration +++ b/start-configuration @@ -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 @@ -115,11 +116,11 @@ case "${TYPE^^}" in ;; MAGMA) - exec ${SCRIPTS:-/}start-magma "$@" + exec ${SCRIPTS:-/}start-deployMagma "$@" ;; MOHIST) - exec ${SCRIPTS:-/}start-mohist "$@" + exec ${SCRIPTS:-/}start-deployMohist "$@" ;; *) From 1bcacfc474016d49672df7ae7f8f3f8d96999cce Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 19 Jun 2020 15:34:56 -0500 Subject: [PATCH 2/7] docs: added a bunch more development notes --- DEVELOPMENT.md | 41 +++++++++++++++++++++++++++++- start-magma => start-deployMagma | 0 start-mohist => start-deployMohist | 5 ++-- 3 files changed, 43 insertions(+), 3 deletions(-) rename start-magma => start-deployMagma (100%) mode change 100755 => 100644 rename start-mohist => start-deployMohist (95%) mode change 100755 => 100644 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d879bc7b..a3cb3fa2 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -1,4 +1,17 @@ -Individual scripts can be iteratively developed and tested using the following procedure. +## 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: @@ -26,3 +39,29 @@ 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 -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). + diff --git a/start-magma b/start-deployMagma old mode 100755 new mode 100644 similarity index 100% rename from start-magma rename to start-deployMagma diff --git a/start-mohist b/start-deployMohist old mode 100755 new mode 100644 similarity index 95% rename from start-mohist rename to start-deployMohist index c9fcecd2..78bb1a47 --- a/start-mohist +++ b/start-deployMohist @@ -1,11 +1,12 @@ #!/bin/bash . ${SCRIPTS:-/}start-utils -requireVar VANILLA_VERSION 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}/ @@ -37,4 +38,4 @@ fi export SKIP_LOG4J_CONFIG=true # Continue to Final Setup -exec ${SCRIPTS:-/}start-finalSetup01World $@ +exec ${SCRIPTS:-/}start-finalSetup01World "$@" From 5ee0150154f89ffd4b0ec20a4901b3fd7751397b Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 19 Jun 2020 16:09:09 -0500 Subject: [PATCH 3/7] docs: added development note about generating release notes --- DEVELOPMENT.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index a3cb3fa2..2012f2f2 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -65,3 +65,10 @@ The [multiarch branch](https://github.com/itzg/docker-minecraft-server/tree/mult 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 +``` From 7d97fdcbec04c1ce0bfadda2bec94d6201bcdfea Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 Jun 2020 09:07:38 -0500 Subject: [PATCH 4/7] Clarified setting VERSION for unavailable Mohist builds --- start-deployMohist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/start-deployMohist b/start-deployMohist index 78bb1a47..b6178e8a 100644 --- a/start-deployMohist +++ b/start-deployMohist @@ -13,6 +13,7 @@ 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 @@ -25,6 +26,7 @@ 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 From 8f82ff9b1d43c7e06d0e137a2e3a1855afe08273 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 Jun 2020 15:28:21 -0500 Subject: [PATCH 5/7] Added support for Catserver type --- DEVELOPMENT.md | 2 +- README.md | 9 +++++++++ start-configuration | 4 ++++ start-deployCatserver | 32 ++++++++++++++++++++++++++++++++ start-deployMohist | 2 +- 5 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 start-deployCatserver diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2012f2f2..9076767b 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -22,7 +22,7 @@ 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 +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: diff --git a/README.md b/README.md index da9fdbeb..0f5d1b93 100644 --- a/README.md +++ b/README.md @@ -534,6 +534,15 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with > **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 diff --git a/start-configuration b/start-configuration index f5f9e23a..223c9df1 100644 --- a/start-configuration +++ b/start-configuration @@ -123,6 +123,10 @@ case "${TYPE^^}" in exec ${SCRIPTS:-/}start-deployMohist "$@" ;; + CATSERVER) + exec ${SCRIPTS:-/}start-deployCatserver "$@" + ;; + *) log "Invalid type: '$TYPE'" log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTB, CURSEFORGE, SPONGEVANILLA" diff --git a/start-deployCatserver b/start-deployCatserver new file mode 100644 index 00000000..ce9ea6cd --- /dev/null +++ b/start-deployCatserver @@ -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 "$@" diff --git a/start-deployMohist b/start-deployMohist index b6178e8a..9a0ca008 100644 --- a/start-deployMohist +++ b/start-deployMohist @@ -33,7 +33,7 @@ fi export SERVER="/data/${baseName}" if [ ! -f ${SERVER} ]; then - log "Downloading ${SERVER}" + log "Downloading ${baseName}" curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}" fi From 477caa12c3509b3c398d3baea83c5e1b35f12e85 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 Jun 2020 15:35:37 -0500 Subject: [PATCH 6/7] ci: switched image push to use Gitub Actions --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6b8fdd84..760d3bb4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: Build non-multiarch branches/tags +name: Build and publish non-multiarch branches/tags on: push: @@ -36,4 +36,4 @@ jobs: tag_with_sha: true cache_froms: itzg/minecraft-server:latest add_git_labels: true - push: false + push: true From ec0329efb126e1e4d41bcd15bf437a34cdc78e78 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 20 Jun 2020 15:42:45 -0500 Subject: [PATCH 7/7] ci: added option to sign git tags --- DEVELOPMENT.md | 2 +- docker-versions-create.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 9076767b..237baff7 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -52,7 +52,7 @@ Several base-image variants are maintained in order to offer choices in JDK prov 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 -t 1.2.0 +./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. diff --git a/docker-versions-create.sh b/docker-versions-create.sh index 6de22938..8ed98c54 100755 --- a/docker-versions-create.sh +++ b/docker-versions-create.sh @@ -10,7 +10,7 @@ function TrapExit { batchMode=false -while getopts "hbt:" arg +while getopts "hbt:s" arg do case $arg in b) @@ -19,6 +19,9 @@ do t) tag=${OPTARG} ;; + s) + tagArgs="-s -m 'Signed during docker-versions-create" + ;; h) echo " Usage $0 [options] @@ -28,6 +31,7 @@ Options: 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