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 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index d879bc7b..237baff7 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: @@ -9,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: @@ -26,3 +39,36 @@ 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 +``` 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/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 diff --git a/start-configuration b/start-configuration index 49e06751..fcf724c3 100644 --- a/start-configuration +++ b/start-configuration @@ -33,6 +33,7 @@ fi 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 @@ -112,11 +113,15 @@ case "${TYPE^^}" in ;; MAGMA) - exec ${SCRIPTS:-/}start-magma "$@" + exec ${SCRIPTS:-/}start-deployMagma "$@" ;; MOHIST) - exec ${SCRIPTS:-/}start-mohist "$@" + exec ${SCRIPTS:-/}start-deployMohist "$@" + ;; + + CATSERVER) + exec ${SCRIPTS:-/}start-deployCatserver "$@" ;; *) 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-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 86% rename from start-mohist rename to start-deployMohist index c9fcecd2..9a0ca008 --- a/start-mohist +++ b/start-deployMohist @@ -1,17 +1,19 @@ #!/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}/ 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 @@ -24,17 +26,18 @@ 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 ${SERVER}" + 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 $@ +exec ${SCRIPTS:-/}start-finalSetup01World "$@"