From 942a125e0403df4091f7f36c6b3ba526dcc9da04 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 12 Jan 2021 17:30:58 -0600 Subject: [PATCH 1/8] ci: Added non-versioned cache as restore-key fallback --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ee798d9b..e509dbcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,6 +69,7 @@ jobs: key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}- + ${{ runner.os }}-buildx- - name: Login to DockerHub uses: docker/login-action@v1 From d95abfce82c589c13829fee6a5dfc5aa491d06c2 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 12 Jan 2021 17:33:03 -0600 Subject: [PATCH 2/8] ci: Added openj9-11 tags pattern --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e509dbcb..0f491bf5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,7 @@ on: tags: - "[0-9]+.[0-9]+.[0-9]+" - "[0-9]+.[0-9]+.[0-9]+-openj9" + - "[0-9]+.[0-9]+.[0-9]+-openj9-11" - "[0-9]+.[0-9]+.[0-9]+-openj9-nightly" - "[0-9]+.[0-9]+.[0-9]+-adopt11" - "[0-9]+.[0-9]+.[0-9]+-adopt13" From cd0fdfc95b6f1272bf0d1ff74132e4cf78111bbc Mon Sep 17 00:00:00 2001 From: Eugene Date: Wed, 13 Jan 2021 23:47:15 +0100 Subject: [PATCH 3/8] Add an option to override the icon which already has been set. (#723) --- README.md | 4 ++++ start-minecraftFinalSetup | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 372c46a4..cd598dc4 100644 --- a/README.md +++ b/README.md @@ -766,6 +766,10 @@ downloaded, scaled, and converted from any other image format: docker run -d -e ICON=http://..../some/image.png ... +The server icon which has been set doesn't get overridden by default. It can be changed and overridden by setting `OVERRIDE_ICON` to `TRUE`. + + docker run -d -e ICON=http://..../some/other/image.png -e OVERRIDE_ICON=TRUE... + ### Rcon To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables. diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 545dfc10..812a9bb0 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -14,17 +14,19 @@ if [ -n "$WHITELIST" ]; then echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt fi -if [ -n "$ICON" -a ! -e server-icon.png ]; then - log "Using server icon from $ICON..." - # Not sure what it is yet...call it "img" - curl -sSL -o /tmp/icon.img $ICON - specs=$(identify /tmp/icon.img | awk '{print $2,$3}') - if [ "$specs" = "PNG 64x64" ]; then - mv /tmp/icon.img /data/server-icon.png - else - log "Converting image to 64x64 PNG..." - convert /tmp/icon.img -resize 64x64! /data/server-icon.png - fi +if [ -n "$ICON" ]; then + if [ ! -e server-icon.png ] || [ "${OVERRIDE_ICON}" == "TRUE" ]; then + log "Using server icon from $ICON..." + # Not sure what it is yet...call it "img" + curl -sSL -o /tmp/icon.img $ICON + specs=$(identify /tmp/icon.img | awk '{print $2,$3}') + if [ "$specs" = "PNG 64x64" ]; then + mv /tmp/icon.img /data/server-icon.png + else + log "Converting image to 64x64 PNG..." + convert /tmp/icon.img -resize 64x64! /data/server-icon.png + fi + fi fi if ! isTrue ${SKIP_LOG4J_CONFIG}; then From ad46f10b550478003e314f6dec24a244580c7c50 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 17 Jan 2021 10:09:41 -0600 Subject: [PATCH 4/8] Added option to override whitelist and ops files #726 --- README.md | 6 ++++++ start-minecraftFinalSetup | 18 ++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd598dc4..66808883 100644 --- a/README.md +++ b/README.md @@ -753,12 +753,18 @@ To whitelist players for your Minecraft server, pass the Minecraft usernames sep If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible. +> NOTE: When `WHITELIST` is used the server property `white-list` will automatically get set to `true`. + +> By default, the players in `WHITELIST` are **added** to the final `whitelist.json` file by the Minecraft server. If you set `OVERRIDE_WHITELIST` to "true" then the `whitelist.json` file will be recreated on each server startup. + ### Op/Administrator Players To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as docker run -d -e OPS=user1,user2 ... +> By default, the players in `OPS` are **added** to the final `ops.json` file by the Minecraft server. If you set `OVERRIDE_OPS` to "true" then the `ops.json` file will be recreated on each server startup. + ### Server icon A server icon can be configured using the `ICON` variable. The image will be automatically diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index 812a9bb0..4ee8b71c 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -3,15 +3,25 @@ . ${SCRIPTS:-/}start-utils if [ -n "$OPS" ]; then - log "Setting/adding ops" - rm -rf /data/ops.txt.converted + log "Updating ops" + rm -f /data/ops.txt.converted echo $OPS | awk -v RS=, '{print}' > /data/ops.txt + + if isTrue "${OVERRIDE_OPS}"; then + log "Recreating ops.json file at server startup" + rm -f /data/ops.json + fi fi if [ -n "$WHITELIST" ]; then - log "Setting whitelist" - rm -rf /data/white-list.txt.converted + log "Updating whitelist" + rm -f /data/white-list.txt.converted echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt + + if isTrue "${OVERRIDE_WHITELIST}"; then + log "Recreating whitelist.json file at server startup" + rm -f /data/whitelist.json + fi fi if [ -n "$ICON" ]; then From 69e308d420d88922bfb14596c75dbf99464cc4d3 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Tue, 19 Jan 2021 21:36:21 -0600 Subject: [PATCH 5/8] Split eula header into two lines of comments #728 - Found that https://github.com/Yoosk/ServerStarter hard coded expectation that eula property was on third line --- start-utils | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/start-utils b/start-utils index b461a836..81876838 100644 --- a/start-utils +++ b/start-utils @@ -145,7 +145,8 @@ requireVar() { } function writeEula() { - if ! echo "# Generated via Docker on $(date) + if ! echo "# Generated via Docker +# $(date) eula=${EULA,,} " >/data/eula.txt; then log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}" From 4c2829e3d24395a9de5f236e63a1d470a92f1d68 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 21 Jan 2021 13:36:41 -0600 Subject: [PATCH 6/8] docs: Added a simple docker compose example --- examples/docker-compose-simple.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/docker-compose-simple.yml diff --git a/examples/docker-compose-simple.yml b/examples/docker-compose-simple.yml new file mode 100644 index 00000000..dfaea2a5 --- /dev/null +++ b/examples/docker-compose-simple.yml @@ -0,0 +1,11 @@ +version: "3" + +services: + mc: + image: itzg/minecraft-server + ports: + - 25565:25565 + environment: + EULA: "TRUE" + volumes: + ./data:/data From 54027049d367fe0aacb3ae18223c209c5f75fb09 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sun, 24 Jan 2021 12:31:56 -0600 Subject: [PATCH 7/8] docs: Added compose example to data attaching section --- README.md | 20 ++++++++++++++++++-- examples/docker-compose-simple.yml | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 66808883..8ca50289 100644 --- a/README.md +++ b/README.md @@ -116,8 +116,24 @@ to map a directory on your host machine to the container's `/data` directory, su docker run -d -v /path/on/host:/data ... -When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` -and start the server again with `docker start CONTAINERID` to pick up the new configuration. +When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINER_ID` to pick up the new configuration. + +As example, using Docker compose, create the following `docker-compose.yml` in its own directory and the container will automatically create/attach the relative directory `data` to the container: + +```yaml +version: "3" + +services: + mc: + image: itzg/minecraft-server + ports: + - 25565:25565 + environment: + EULA: "TRUE" + volumes: + # attach the relative directory 'data' to the container's /data path + ./data:/data +``` ## Versions diff --git a/examples/docker-compose-simple.yml b/examples/docker-compose-simple.yml index dfaea2a5..afb7a35f 100644 --- a/examples/docker-compose-simple.yml +++ b/examples/docker-compose-simple.yml @@ -8,4 +8,5 @@ services: environment: EULA: "TRUE" volumes: + # attach the relative directory 'data' to the container's /data path ./data:/data From ffec50141ab86f9fc52a7317f8c92e74b87ff7e9 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 28 Jan 2021 20:55:08 -0600 Subject: [PATCH 8/8] Fixed MODS provides from github release URLs For #731 --- start-finalSetupModpack | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/start-finalSetupModpack b/start-finalSetupModpack index 7e477582..3e4416ee 100644 --- a/start-finalSetupModpack +++ b/start-finalSetupModpack @@ -81,16 +81,23 @@ if [[ "$MODS" ]]; then do if isURL $i; then log "Downloading mod/plugin $i ..." - effective_url=$(resolveEffectiveUrl "$i") - if isValidFileURL jar "${effective_url}"; then - out_file=$(getFilenameFromUrl "${effective_url}") - if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then + if isValidFileURL jar "$i"; then + if ! curl -fsSL -o "${out_dir}/$(getFilenameFromUrl "${i}")" "${i}"; then log "ERROR: failed to download from $i into $out_dir" exit 2 fi else - log "ERROR: $effective_url resolved from $i is not a valid jar URL" - exit 2 + effective_url=$(resolveEffectiveUrl "$i") + if isValidFileURL jar "${effective_url}"; then + out_file=$(getFilenameFromUrl "${effective_url}") + if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then + log "ERROR: failed to download from $i into $out_dir" + exit 2 + fi + else + log "ERROR: $effective_url resolved from $i is not a valid jar URL" + exit 2 + fi fi else log "ERROR Invalid URL given in MODS: $i"