Compare commits

...

60 Commits

Author SHA1 Message Date
dependabot[bot]
dc149eaa01 build(deps): bump mkdocstrings from 0.22.0 to 0.23.0 in /docs (#2368) 2023-09-04 09:13:50 -05:00
dependabot[bot]
f14b77db05 build(deps): bump the patches group in /docs with 1 update (#2367) 2023-09-04 09:09:17 -05:00
Geoff Bourne
df53fe3971 Removing chmod g+w at start to tighten security (#2363) 2023-08-29 22:01:34 -05:00
DanielN
bb57d7e99f Disable healthcheck for unsupported versions (#2360) 2023-08-27 09:41:42 -05:00
Geoff Bourne
03034d2f15 docs: clarified path for zip file modpack (#2361) 2023-08-26 13:38:14 -05:00
Geoff Bourne
8fd1495795 Support skipping existing whitelist/ops files and restore as default (#2358) 2023-08-22 21:34:47 -05:00
Geoff Bourne
dba2556e4e Corrected use of VERSION when building Bukkit from source (#2341) 2023-08-20 13:00:06 -05:00
Geoff Bourne
cdec1c0c19 modrinth: allow installer to ignore missing files (#2352) 2023-08-20 09:11:55 -05:00
Geoff Bourne
3aa0dd2db6 modrinth: resolve issue with null versionId in manifest (#2349) 2023-08-18 18:37:19 -05:00
Geoff Bourne
c3829aa435 docs: clarified FORGE_VERSION usage (#2348) 2023-08-18 08:15:32 -05:00
Geoff Bourne
356c1af046 modrinth: ensure requested loader for modpack is optional (#2347) 2023-08-17 17:14:08 -05:00
Geoff Bourne
6bd4de3af5 Fixed copying of OPS_FILE and WHITELIST_FILE (#2346) 2023-08-17 16:12:12 -05:00
Geoff Bourne
4040e971f5 Improve whitelist/ops handling with caching, UUID, and offline support (#2342) 2023-08-16 19:41:22 -05:00
Atlas16A
316b79bf72 Add Ngrok example (#2328) 2023-08-13 17:55:16 -05:00
Geoff Bourne
9eb1fbaf1f modrinth: rename input to MODRINTH_MODPACK (#2334) 2023-08-12 19:56:18 -05:00
Geoff Bourne
1cc0c8a0fc modrinth: resolve "only DEFLATED entries can have EXT" (#2332) 2023-08-12 09:48:18 -05:00
Geoff Bourne
c59414c5c1 packwiz: cache maven metadata (#2329) 2023-08-10 22:06:18 -05:00
Geoff Bourne
008693184e build: skip some of the setuponly tests by default (#2327) 2023-08-08 11:32:41 -05:00
Geoff Bourne
55df8b3d87 Set mc-monitor timeout less than health check timeout (#2326) 2023-08-08 11:02:37 -05:00
Geoff Bourne
5470245b45 docs: clarify stop grace period given announce delay (#2325) 2023-08-07 15:00:03 -05:00
Geoff Bourne
95d15555f4 Added CURSEFORGE_FILES support (#2322) 2023-08-06 15:12:29 -05:00
Geoff Bourne
3ffcbb32dd Corrected REMOVE_OLD_MODS to process file-wise (#2317) 2023-08-03 13:04:26 -05:00
Geoff Bourne
2fbe2bbe68 auto-cf: updated API parsing for NeoForge mod loader type (#2308) 2023-07-30 09:15:14 -05:00
Geoff Bourne
396d202d9f ftb: added FTB_FORCE_REINSTALL (#2305) 2023-07-29 20:09:54 -05:00
Geoff Bourne
cb6b793f37 docs: corrected Java 20 typo (#2301) 2023-07-21 15:02:29 -05:00
Sebastian Janzen
086552fbe5 typo (#2296) 2023-07-17 07:52:24 -05:00
Geoff Bourne
b028e655d2 Include SPIGET_RESOURCES support for hybrid server types (#2292) 2023-07-14 22:21:58 -05:00
Geoff Bourne
374fa9ad5b auto-cf: clarify why some mods need to be manually downloaded (#2288) 2023-07-13 08:06:52 -05:00
Geoff Bourne
7d8f70635c auto-cf: stop startup with info when manual mod downloads are needed (#2286) 2023-07-12 08:45:49 -05:00
Geoff Bourne
4d4d21e2fa Allow blank REPLACE_ENV_VARIABLE_PREFIX when processing in-place files (#2285) 2023-07-11 09:08:48 -05:00
Geoff Bourne
7f7636e85e Added auto-cf excludes for BMC1 Fabric (#2280) 2023-07-08 14:30:29 -05:00
Geoff Bourne
953e3bf8fc docs: added Better MC example (#2279) 2023-07-08 13:35:52 -05:00
Geoff Bourne
8fabf17c21 Allow REPLACE_ENV_VARIABLE_PREFIX to be an empty string (#2278) 2023-07-07 21:13:01 -05:00
Geoff Bourne
fc14b79a29 Use CXF compatible with Java 8 (#2277)
Also
- modrinth modpack support when optional env is absent
2023-07-07 16:58:14 -05:00
Geoff Bourne
3fb36477dd Corrected VERSION resolution with FTBA type (#2274) 2023-07-06 20:05:15 -05:00
Geoff Bourne
3311cf479f misc: add FABRIC to error message with expected types (#2272) 2023-07-06 09:11:12 -05:00
LeaderbotX400
fd8d6bb32a Add iris-flywheel-compat exclude to cf-exclude-include.json (#2271) 2023-07-05 11:36:16 -05:00
Geoff Bourne
7f4cf0fc48 misc: upgrade all Go tools to Go 1.20 (#2270) 2023-07-05 09:34:15 -05:00
Geoff Bourne
d3dd14c87d Remove .mc-health.env when not needed (#2267) 2023-07-03 18:18:52 -05:00
Geoff Bourne
b79014e47f examples: simplified filebrowser example (#2266) 2023-07-02 20:56:40 -05:00
Geoff Bourne
98e939d937 auto_cf: write mods needing manual download to file (#2263) 2023-07-02 09:22:12 -05:00
Geoff Bourne
2611551076 Ensure datapacks cleanup doesn't remove vanillatweaks (#2262) 2023-07-01 19:45:18 -05:00
Darion Spaargaren
4a942dbc02 Allow skipping autopause/autostop using a file (#2261) 2023-06-30 09:50:30 -05:00
Geoff Bourne
ce65bcc840 docs: adjusted wording of CF_MODPACK_ZIP option (#2260) 2023-06-28 19:07:25 -05:00
Max
d276c58d29 Fix typo in auto CurseForge docs (#2259) 2023-06-27 12:24:46 -05:00
Geoff Bourne
495c4440fd Update rcon-cli to remove config file loading message (#2258) 2023-06-26 08:43:26 -05:00
Geoff Bourne
bb472eb8b7 Added CUSTOM_JAR_EXEC (#2253) 2023-06-24 11:38:15 -05:00
Geoff Bourne
0bcd72cb0d build: use raw instead of match for stable tag metadata (#2251) 2023-06-23 14:04:44 -05:00
Geoff Bourne
ae46cd3ad2 build: use match instead of pep440 for stable tag selection (#2250) 2023-06-23 13:19:25 -05:00
Anton Bardov
b89844d5b2 Added support for Magma version tags (#2247) 2023-06-23 12:47:23 -05:00
Geoff Bourne
56d68a6e76 Corrected stable tag build configuration (#2249) 2023-06-23 11:56:27 -05:00
Geoff Bourne
a6c3943136 Provide stable image tag that tracks latest repo tag (#2248) 2023-06-23 11:40:47 -05:00
Geoff Bourne
d0f5227f58 modrinth: reduce API pressure with initial bulk get of projects (#2243) 2023-06-21 22:12:16 -05:00
Geoff Bourne
879d315a02 docs: tighten up wording in auto-pause section (#2241) 2023-06-20 08:14:35 -05:00
Geoff Bourne
c9c6147960 auto_cf: allow explicit inclusions to override default exclusions (#2240)
Also
- removed carry-on from default exclusions
2023-06-19 12:03:37 -05:00
dependabot[bot]
bfa74a73be build(deps): bump docker/build-push-action from 4.1.0 to 4.1.1 (#2238) 2023-06-19 08:20:19 -05:00
Geoff Bourne
b615dbf6c4 Add resolveVersion for TYPE=CURSEFORGE (#2237) 2023-06-18 19:58:29 -05:00
Geoff Bourne
e5fe913a74 Ensure VERSION is resolved from existing Fabric install (#2235)
Also
* Cleaned up some of the deployment docs info
2023-06-18 15:31:39 -05:00
Geoff Bourne
a566f99018 Fix up-to-date handling of MODS/PLUGINS/MODS_FILE (#2234) 2023-06-18 09:44:31 -05:00
Geoff Bourne
87e2f2b177 Switch Quilt and Purpur to image helper (#2229) 2023-06-17 13:00:22 -05:00
117 changed files with 917 additions and 992 deletions

View File

@@ -1,7 +1,16 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: pip
directory: "/docs"
schedule:
interval: weekly
groups:
patches:
patterns:
- "*"
update-types:
- patch

View File

@@ -102,6 +102,7 @@ jobs:
env:
IMAGE_TO_TEST: ${{ github.repository_owner }}/minecraft-server:test-${{ matrix.variant }}-${{ github.run_id }}
HAS_IMAGE_REPO_ACCESS: ${{ secrets.DOCKER_USER != '' && secrets.DOCKER_PASSWORD != '' }}
MAIN_VARIANT: java17
runs-on: ubuntu-20.04
steps:
- name: Checkout
@@ -120,14 +121,20 @@ jobs:
${{ github.repository_owner }}/minecraft-server
ghcr.io/${{ github.repository_owner }}/minecraft-server
tags: |
type=ref,event=tag,enable=${{ matrix.variant == 'java17' }}
# For the "main" variant, it gets the tag as-is, without suffix
type=ref,event=tag,enable=${{ matrix.variant == env.MAIN_VARIANT }}
# and each variant (including main one) gets the tag with the variant suffix, such as 2023.1.1-java17
type=ref,event=tag,suffix=-${{ matrix.variant }}
type=ref,event=branch,suffix=-${{ matrix.variant }},enable=${{ github.ref_name != 'master' }}
type=raw,value=${{ matrix.variant }},enable=${{ github.ref_name == 'master' }}
# for building test/* branch images
type=ref,event=branch,suffix=-${{ matrix.variant }},enable=${{ github.ref_name != github.event.repository.default_branch }}
# latest repo tag gets a moving 'stable' image tag applied to the main variant
type=raw,value=stable,enable=${{ github.ref_type == 'tag' && matrix.variant == env.MAIN_VARIANT }}
# apply the variant as a moving tag for most recent commit per variant
type=raw,value=${{ matrix.variant }},enable=${{ github.ref_name == github.event.repository.default_branch }}
# NOTE this identifies which variant will be published as "latest", which isn't
# necessarily the newest version of Java
flavor: |
latest=${{ matrix.variant == 'java17' && github.ref_name == 'master' }}
latest=${{ matrix.variant == env.MAIN_VARIANT && github.ref_name == github.event.repository.default_branch }}
labels: |
org.opencontainers.image.authors=Geoff Bourne <itzgeoff@gmail.com>
@@ -138,7 +145,7 @@ jobs:
uses: docker/setup-qemu-action@v2.2.0
- name: Build for test
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
with:
platforms: linux/amd64
tags: ${{ env.IMAGE_TO_TEST }}
@@ -156,8 +163,7 @@ jobs:
env:
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
VARIANT: ${{ matrix.variant }}
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
CF_API_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
CF_API_KEY: ${{ secrets.CF_API_KEY }}
run: |
tests/test.sh
@@ -177,14 +183,14 @@ jobs:
password: ${{ github.token }}
- name: Build and push
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
if: github.actor == github.repository_owner
with:
platforms: ${{ matrix.platforms }}
push: >
${{
github.ref_type == 'tag'
|| github.ref_name == 'master'
|| github.ref_name == github.event.repository.default_branch
|| startsWith(github.ref_name, 'test/')
|| ( github.event_name == 'pull_request'
&& env.HAS_IMAGE_REPO_ACCESS

View File

@@ -54,7 +54,7 @@ jobs:
uses: docker/setup-buildx-action@v2
- name: Confirm multi-arch build
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
with:
platforms: ${{ matrix.platforms }}
# ensure latest base image is used
@@ -64,7 +64,7 @@ jobs:
cache-from: type=gha,scope=${{ matrix.variant }}
- name: Build for test
uses: docker/build-push-action@v4.1.0
uses: docker/build-push-action@v4.1.1
with:
# Only build single platform since loading multi-arch image into daemon fails with
# "docker exporter does not currently support exporting manifest lists"
@@ -83,8 +83,7 @@ jobs:
env:
MINECRAFT_VERSION: ${{ matrix.mcVersion }}
VARIANT: ${{ matrix.variant }}
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
CF_API_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
CF_API_KEY: ${{ secrets.CF_API_KEY }}
DEBUG: ${{ runner.debug }}
run: |
tests/test.sh

View File

@@ -22,31 +22,27 @@ COPY --chmod=644 files/sudoers* /etc/sudoers.d
EXPOSE 25565
ARG EASY_ADD_VER=0.7.1
ARG EASY_ADD_VER=0.8.0
ADD https://github.com/itzg/easy-add/releases/download/${EASY_ADD_VER}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
RUN chmod +x /usr/bin/easy-add
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.2.0 --var app=restify --file {{.app}} \
--var version=1.7.0 --var app=restify --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.6.1 --var app=rcon-cli --file {{.app}} \
--var version=1.6.2 --var app=rcon-cli --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=0.11.0 --var app=mc-monitor --file {{.app}} \
--var version=0.12.2 --var app=mc-monitor --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.8.3 --var app=mc-server-runner --file {{.app}} \
--var version=1.9.0 --var app=mc-server-runner --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.31.0
ARG MC_HELPER_VERSION=1.34.7
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1

View File

@@ -511,8 +511,10 @@ Extra variables:
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
-e TYPE=MAGMA
-e MAGMA_VERSION=9f3a3c25
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2", "1.16.5", etc.
> To switch the MAGMA version, you need to take the name of the desired tag from the magmafoundation git repository, [for example, to version 1.18](https://git.magmafoundation.org/magmafoundation/Magma-1-18-x/-/tags).
### Running a Mohist server
@@ -599,7 +601,7 @@ Crucible is only available for 1.7.10, so be sure to set `VERSION=1.7.10`.
[Modrinth Modpacks](https://modrinth.com/modpacks) can automatically be installed along with the required mod loader (Forge or Fabric) by setting `TYPE` to "MODRINTH". Upgrading (and downgrading) takes care of cleaning up old files and upgrading (and downgrading) the mod loader.
The desired modpack project is specified with the `MODRINTH_PROJECT` environment variable and must be one of:
The desired modpack project is specified with the `MODRINTH_MODPACK` environment variable and must be one of:
- The project "slug", which is located in the URL shown here:
@@ -617,7 +619,7 @@ Furthermore, the resolved modpack version can be narrowed by setting `VERSION` t
The selected version can also be narrowed to a particular mod loader by setting `MODRINTH_LOADER` to either "forge", "fabric", or "quilt".
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_PROJECT`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_MODPACK`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here
![](docs/img/modrinth-version-id.drawio.png)
@@ -893,66 +895,6 @@ You may also download or copy over individual mods using the `MODS` environment
docker run -d -e MODS=https://www.example.com/mods/mod1.jar,/plugins/common,/plugins/special/mod2.jar ...
### ForgeAPI usage to use non-version specific projects
**NOTE:** This potentially could lead to unexpected behavior if the Mod receives an update with unexpected behavior.
This is more complicated because you will be pulling/using the latest mod for the release of your game. To get started make sure you have a [CursedForge API Key](https://docs.curseforge.com/#getting-started). Then use the environmental parameters in your docker build.
Please be aware of the following when using these options for your mods:
* Mod Release types: Release, Beta, and Alpha.
* Mod dependencies: Required and Optional
* Mod family: Fabric, Forge, and Bukkit.
Parameters to use the ForgeAPI:
* `MODS_FORGEAPI_KEY` - Required
* `MODS_FORGEAPI_FILE` - Required or use MODS_FORGEAPI_PROJECTIDS (Overrides MODS_FORGEAPI_PROJECTIDS)
* `MODS_FORGEAPI_PROJECTIDS` - Required or use MODS_FORGEAPI_FILE
* `MODS_FORGEAPI_RELEASES` - Default is release, Options: [Release|Beta|Alpha]
* `MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES` - Default is False, attempts to download required mods (releaseType Release) defined in Forge.
* `MODS_FORGEAPI_IGNORE_GAMETYPE` - Default is False, Allows for filtering mods on family type: FORGE, FABRIC, and BUKKIT. (Does not filter for Vanilla or custom)
* `REMOVE_OLD_FORGEAPI_MODS` - Default is False
* `REMOVE_OLD_DATAPACKS_DEPTH` - Default is 1
* `REMOVE_OLD_DATAPACKS_INCLUDE` - Default is *.jar
Example of expected forge api project ids, releases, and key:
```yaml
MODS_FORGEAPI_PROJECTIDS: 306612,256717
MODS_FORGEAPI_RELEASES: Release
MODS_FORGEAPI_KEY: $WRX...
```
Example of expected ForgeAPI file format.
**Field Description**:
* `name` is currently unused, but can be used to document each entry.
* `projectId` id is the id found on the CurseForge website for a particular mod
* `releaseType` Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha).
* `fileName` is used for version pinning if latest file will not work for you.
```json
[
{
"name": "fabric api",
"projectId": "306612",
"releaseType": "release"
},
{
"name": "fabric voice mod",
"projectId": "416089",
"releaseType": "beta"
},
{
"name": "Biomes o plenty",
"projectId": "220318",
"fileName": "BiomesOPlenty-1.18.1-15.0.0.100-universal.jar",
"releaseType": "release"
}
]
```
### Generic pack files
To install all the server content (jars, mods, plugins, configs, etc.) from a zip or tgz file, then set `GENERIC_PACK` to the container path or URL of the archive file. This can also be used to apply a CurseForge modpack that is missing a server start script and/or Forge installer.
@@ -991,7 +933,7 @@ https://edge.forgecdn.net/files/2871/647/ToastControl-1.15.2-3.0.1.jar
```
> Blank lines and lines that start with a `#` will be ignored
> [This compose file](examples/docker-compose-mods-file.yml) shows another example of using this feature.
> [This compose file](examples/mods-file/docker-compose.yml) shows another example of using this feature.
> It is recommended to combine this option with `REMOVE_OLD_MODS=TRUE` to ensure the mods/plugins remain consistent with the file's listing.

View File

@@ -17,7 +17,7 @@ When the environment variable `REPLACE_ENV_IN_PLACE` is set to `true` (the defau
Variables that you want to replace need to be declared inside curly brackets and prefixed with a dollar sign, such as `${CFG_YOUR_VARIABLE}`, which is same as many scripting languages.
You can also change `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_", to limit which environment variables are allowed to be used. For example, with "CFG_" as the prefix, the variable `${CFG_DB_HOST}` would be subsituted, but not `${DB_HOST}`.
You can also change `REPLACE_ENV_VARIABLE_PREFIX`, which defaults to "CFG_", to limit which environment variables are allowed to be used. For example, with "CFG_" as the prefix, the variable `${CFG_DB_HOST}` would be substituted, but not `${DB_HOST}`. The prefix can be set to an empty string to allow for matching any variable name.
If you want to use a file's content for value, such as when using secrets mounted as files, declare the placeholder named like normal in the file and declare an environment variable named the same but with the suffix `_FILE`.

View File

@@ -70,7 +70,9 @@ To enable remote JMX, such as for profiling with VisualVM or JMC, add the enviro
## Enable Aikar's Flags
[Aikar has done some research](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/) into finding the optimal JVM flags for GC tuning, which becomes more important as more users are connected concurrently. The set of flags documented there can be added using
[Aikar has done some research](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/) into finding the optimal JVM flags for GC tuning, which becomes more important as more users are connected concurrently. [PaperMC also has an explanation](https://docs.papermc.io/paper/aikars-flags) of what the JVM flags are doing.
The set of flags documented there can be added using
-e USE_AIKAR_FLAGS=true

View File

@@ -61,7 +61,11 @@ If you would like to `docker attach` to the Minecraft server console with color
To allow time for players to finish what they're doing during a graceful server shutdown, set `STOP_SERVER_ANNOUNCE_DELAY` to a number of seconds to delay after an announcement is posted by the server.
> **NOTE** be sure to adjust Docker's shutdown timeout accordingly, such as using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/).
!!! warning "Increase stop grace period"
The Docker stop grace period must be increased to a value longer than the announce delay. The value to use that is longer than announce delay will vary based upon the amount of time it takes for final world data saving. If the container exits with exit code 137, then that indicates a longer grace period is needed.
The grace period can be increased using [the -t option on docker-compose down](https://docs.docker.com/compose/reference/down/) or set the [stop_grace_period](https://docs.docker.com/compose/compose-file/05-services/#stop_grace_period) in the compose file.
## OpenJ9 Specific Options

View File

@@ -42,47 +42,83 @@ values.
### Whitelist Players
!!! note
!!! warning "For public servers"
It is very important to set this with servers exposed to the internet where you want only limited players to join.
It is very important to consider setting a whitelist of expected players.
To whitelist players for your Minecraft server, you can:
- Provide a list of usernames and/or UUIDs separated by commas via the `WHITELIST` environment variable
`docker run -d -e WHITELIST=user1,uuid2 ...`
- Provide the url or path to a whitelist file via `WHITELIST_FILE` environment variable
`docker run -d -e WHITELIST_FILE=/extra/whitelist.json ...`
- Provide a list of usernames and/or UUIDs separated by commas or newlines via the `WHITELIST` environment variable
- Provide the URL or container path to a whitelist file via `WHITELIST_FILE` that will be retrieved/copied into the standard location
When either is set, [whitelisting of connecting users](https://minecraft.fandom.com/wiki/Server.properties#white-list) is enabled . If managing the list manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property.
!!! example
If whitelist configuration already exists, `WHITELIST_FILE` will not be retrieved and any usernames in `WHITELIST` are **added** to the whitelist configuration. You can enforce regeneration of the whitelist on each server startup by setting `OVERRIDE_WHITELIST` to "true". This will delete the whitelist file before processing whitelist configuration.
In a compose file, a text block can be used to improve maintainability, such as
!!! note
```yaml
WHITELIST: |
user1
user2
user3
```
You can provide both `WHITELIST_FILE` and `WHITELIST`, which are processed in that order.
When either is set, [whitelisting of connecting users](https://minecraft.fandom.com/wiki/Server.properties#white-list) is enabled.
To change the behavior when the whitelist file already exists, set the variable `EXISTING_WHITELIST_FILE` to one of the following options:
`SKIP` (default)
: Skip processing of the whitelist file when one is already present. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `WHITELIST` or `WHITELIST_FILE` provided. When using both, `WHITELIST` will take precedence. This is the same as setting the legacy variable `OVERRIDE_WHITELIST` to "true".
`MERGE`
: Merge the list of users from `WHITELIST` into the existing file. `WHITELIST_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST`
: When `WHITELIST_FILE` is provided it will overwrite an existing whitelist file. Also, if `WHITELIST` is provided, then those users will be merged into the newly copied file.
!!! note
UUIDs passed via `WHITELIST` need to be the dashed variant, otherwise it not be recognised and instead added as a username.
If running Minecraft 1.7.5 or earlier, these variables will apply to `white-list.txt`, with 1.7.6 implementing support for `whitelist.json`. Make sure your `WHITELIST_FILE` is in the appropriate format.
To [enforce the whitelist changes immediately](https://minecraft.fandom.com/wiki/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true".
For versions prior to 1.7.3, `white-list.txt` will be maintained instead. Only usernames are supported for those versions.
To [enforce the whitelist changes immediately](https://minecraft.fandom.com/wiki/Server.properties#enforce-whitelist) when whitelist commands are used , set `ENFORCE_WHITELIST` to "true". If managing the whitelist file manually, `ENABLE_WHITELIST` can be set to "true" to set the `white-list` property.
### Op/Administrator Players
Similar to the whitelist, to add users as operators (aka adminstrators) to your Minecraft server, you can:
Similar to the whitelist, users can be provisioned as operators (aka administrators) to your Minecraft server by
- Provide te url or path to an ops file via `OPS_FILE` environment variable
`docker run -d -e OPS_FILE=https://config.example.com/extra/ops.json ...`
- Provide a list of usernames and/or UUIDs separated by commas via the `OPS` environment variable
`docker run -d -e OPS=user1,uuid2 ...`
- Providing a list of usernames and/or UUIDs separated by commas or newlines via the `OPS` environment variable
- Providing the URL or container path to an ops file via `OPS_FILE` that will be retrieved/copied into the standard location
If ops configuration already exists, `OPS_FILE` will not be retrieved and any usernames in `OPS` are **added** to the ops configuration. You can enforce regeneration of the ops configuration on each server startup by setting `OVERRIDE_OPS` to "true". This will delete the ops file before processing ops configuration.
!!! example
!!! note
In a compose file, a text block can be used to improve maintainability, such as
Similar to whitelists, you can provide both `OPS_FILE` and `OPS`, and Minecraft 1.7.5 or earlier will use `ops.txt` rather than `ops.json`.
```yaml
OPS: |
user1
user2
user3
```
To change the behavior when the ops file already exists, set the variable `EXISTING_OPS_FILE` to one of the following options:
`SKIP` (default)
: Skip processing of the ops file when one is already present. This is the same as setting the legacy variable `OVERRIDE_OPS` to "false".
`SYNCHRONIZE`
: Synchronize the list of users in the file with the `OPS` or `OPS_FILE` provided. When using both, `OPS` will take precedence. The `level` and `bypassesPlayerLimit` will be retained from previous entries. This is the same as setting the legacy variable `OVERRIDE_OPS` to "true".
`MERGE`
: Merge the list of users from `OPS` into the existing file. `OPS_FILE` cannot be used with this option.
`SYNC_FILE_MERGE_LIST`
: When `OPS_FILE` is provided it will overwrite an existing ops file. Also, if `OPS` is provided, then those users will be merged into the newly copied file.
!!! note
For versions prior to 1.7.3, `ops.txt` will be maintained instead. Only usernames are supported for those versions.
### Enable/disable initial selection of datapacks

View File

@@ -29,7 +29,7 @@ where, in this case, the standard server port 25565, will be exposed on your hos
**DO NOT** port forward RCON on 25575 without first setting `RCON_PASSWORD` to a secure value. It is highly recommended to only use RCON within the container, such as with `rcon-cli`.
By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](versions/java.md) and the [`TYPE`](types-and-platforms/) can be configured to create many variations of desired Minecraft server.
By default, the container will download the latest version of the "vanilla" [Minecraft: Java Edition server](https://www.minecraft.net/en-us/download/server) provided by Mojang. The [`VERSION`](versions/java.md) and the [`TYPE`](types-and-platforms/index.md) can be configured to create many variations of desired Minecraft server.
## Using [Docker Compose](https://docs.docker.com/compose/)
@@ -59,8 +59,8 @@ To apply changes made to the compose file, just run `docker compose up -d` again
Follow the logs of the container using `docker compose logs -f`, check on the status with `docker compose ps`, and stop the container using `docker compose stop`.
!!! note "Full Setup Example"
Here is a [reference guide to setting up a server from scratch using docker compose](misc/deployment/docker-compose-full-example/).
!!! note "More Compose Examples"
There are more [examples located in the Github repo](https://github.com/itzg/docker-minecraft-server/tree/master/examples).
!!! note "More Examples"
There are more [examples located in the Github repo](https://github.com/itzg/docker-minecraft-server/tree/master/examples).
!!! note "Deployment Examples"
The [deployments page](misc/deployment/index.md) provides more examples of deployment with and beyond Docker Compose.

View File

@@ -1,41 +1,31 @@
# AutoPause
# Auto-Pause
### Description
An auto-pause functionality is provided that monitors whether clients are connected to the server. If a client is not connected for a specified time, the Java process is put into a pause state. When a client attempts to connect while the process is paused, then process will be restored to a running state. The experience for the client does not change. This feature can be enabled by setting the environment variable `ENABLE_AUTOPAUSE` to "true".
There are various bug reports on [Mojang](https://bugs.mojang.com) about high CPU usage of servers with newer versions, even with few or no clients connected (e.g. [this one](https://bugs.mojang.com/browse/MC-149018), in fact the functionality is based on [this comment in the thread](https://bugs.mojang.com/browse/MC-149018?focusedCommentId=593606&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-593606)).
!!! important
An autopause functionality has been added to this image to monitor whether clients are connected to the server. If for a specified time no client is connected, the Java process is stopped. When knocking on the server port (e.g. by the ingame Multiplayer server overview), the process is resumed. The experience for the client does not change.
Of course, even loaded chunks are not ticked when the process is stopped.
**You must greatly increase or disable max-tick-time watchdog functionality.** From the server's point of view, the pausing causes a single tick to take as long as the process is stopped, so the server watchdog might intervene after the process is continued, possibly forcing a container restart. To prevent this, ensure that the `max-tick-time` in the `server.properties` file is set to a very large value or -1 to disable it entirely, which is highly recommended. That can be set with `MAX_TICK_TIME` as described in [the section below](../../configuration/server-properties.md#max-tick-time).
!!! note
**You must greatly increase or disable max-tick-time watchdog functionality.** From the server's point of view, the pausing causes a single tick to take as long as the process is stopped, so the server watchdog might intervene after the process is continued, possibly forcing a container restart. To prevent this, ensure that the `max-tick-time` in the `server.properties` file is set to a very large value or -1 to disable it entirely, which is highly recommended. That can be set with `MAX_TICK_TIME` as described in [the section below](../../configuration/server-properties.md#max-tick-time).
Non-vanilla versions might have their own configuration file, you might have to disable their watchdogs separately. For PaperMC servers, you need to send the JVM flag `-Ddisable.watchdog=true`, this can be done with the docker env variable `-e JVM_DD_OPTS=disable.watchdog:true`
On startup the `server.properties` file is checked and, if applicable, a warning is printed to the terminal. When the server is created (no data available in the persistent directory), the properties file is created with the Watchdog disabled.
On startup the `server.properties` file is checked and, if applicable, a warning is printed to the terminal. When the server is created (no data available in the persistent directory), the properties file is created with the Watchdog disabled.
The utility used to wake the server (`knock(d)`) works at network interface level. So the correct interface has to be set using the `AUTOPAUSE_KNOCK_INTERFACE` variable when using non-default networking environments (e.g. host-networking, Portainer oder NAS solutions). See the description of the variable below.
A file called `.paused` is created in `/data` directory when the server is paused and removed when the server is resumed. Other services may check for this file's existence before waking the server.
A `.skip-pause` file can be created in the `/data` directory to make the server skip autopausing, for as long as the file is present. The autopause timer will also be reset.
A starting, example compose file has been provided in [examples/docker-compose-autopause.yml](https://github.com/itzg/docker-minecraft-server/blob/master/examples/docker-compose-autopause.yml).
### Enabling Autopause
Enable the Autopause functionality by setting:
```
-e ENABLE_AUTOPAUSE=TRUE
```
Autopause is not compatible with `EXEC_DIRECTLY=true` and the two cannot be set together.
Auto-pause is not compatible with `EXEC_DIRECTLY=true` and the two cannot be set together.
!!! note
When configuring kubernetes readiness/liveness health checks with auto-pause enabled, be sure to reference the `mc-health` wrapper script rather than `mc-status` directly.
## Additional configuration
The following environment variables define the behaviour of auto-pausing:
- `AUTOPAUSE_TIMEOUT_EST`, default `3600` (seconds)
@@ -53,7 +43,7 @@ The following environment variables define the behaviour of auto-pausing:
To troubleshoot, add `DEBUG_AUTOPAUSE=true` to see additional output
### Rootless Autopause
## Rootless Auto-Pause
If you're running the container as rootless, you might need to set change the default port forwarder from RootlessKit to slirp4netns.

View File

@@ -1,4 +1,4 @@
# AutoStop
# Auto-Stop
An option to stop the server after a specified time has been added for niche applications (e.g. billing saving on AWS Fargate). The function is incompatible with the Autopause functionality, as they basically cancel out each other.
@@ -6,6 +6,8 @@ An option to stop the server after a specified time has been added for niche app
the docker container variables have to be set accordingly (restart policy set to "no") and that the container has to be manually restarted.
A `.skip-stop` file can be created in the `/data` directory to make the server skip autostopping, for as long as the file is present. The autostop timer will also be reset.
A starting, example compose file has been provided in [examples/docker-compose-autostop.yml](https://github.com/itzg/docker-minecraft-server/blob/master/examples/docker-compose-autostop.yml).
Enable the Autostop functionality by setting:

View File

@@ -17,7 +17,6 @@ First, build a baseline of the image to include the packages needed by existing
PowerShell: (Example of building and testing ForgeAPI)
```powershell
$env:MODS_FORGEAPI_KEY='$2a$...'
$env:FOLDER_TO_TEST="forgeapimods_projectids"
$env:IMAGE_TO_TEST="mc-dev"
docker build -t $env:IMAGE_TO_TEST .
@@ -36,7 +35,6 @@ docker build --build-arg BASE_IMAGE=$env:BASE_IMAGE -t $env:IMAGE_TO_TEST .
Bash: (Example of building and testing ForgeAPI)
```bash
export MODS_FORGEAPI_KEY='$2a$...'
export FOLDER_TO_TEST="forgeapimods_file"
export IMAGE_TO_TEST="mc-dev"
docker build -t $IMAGE_TO_TEST .
@@ -55,14 +53,14 @@ docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc
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
export VERSION=1.12.2
/scripts/start-magma
```
...or pre-pending script execution:
```shell script
VANILLA_VERSION=1.12.2 /scripts/start-magma
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.

View File

@@ -1 +0,0 @@
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.

View File

@@ -1,26 +0,0 @@
Rather than type the server options below, the port mappings above, etc
every time you want to create new Minecraft server, you can now use
[Docker Compose](https://docs.docker.com/compose/). Start with a
`docker-compose.yml` file like the following:
``` yaml
version: "3"
services:
mc:
image: itzg/minecraft-server
ports:
- 25565:25565
environment:
EULA: "TRUE"
tty: true
stdin_open: true
restart: unless-stopped
```
and in the same directory as that file run
docker-compose up -d
Now, go play...or adjust the `environment` section to configure
this server instance.

View File

@@ -1,8 +0,0 @@
- itzg Helm Chart:
- [GitHub repo](https://github.com/itzg/minecraft-server-charts)
- [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/)
- [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts)
### Examples
The [examples directory](https://github.com/itzg/docker-minecraft-server/tree/master/examples) also provides examples of deploying the [itzg/minecraft-server](https://hub.docker.com/r/itzg/minecraft-server/) Docker image.

View File

@@ -1,10 +1,22 @@
# More Deployment Info
## Using Helm
- itzg Helm Chart:
- [GitHub repo](https://github.com/itzg/minecraft-server-charts)
- [Helm Chart repo](https://itzg.github.io/minecraft-server-charts/)
- [mcsh/server-deployment](https://github.com/mcserverhosting-net/charts)
## Supporting Articles
Below are supporting articles for server deployment.
- "Zero to Minecraft Server with Docker Desktop and Compose"
https://dev.to/rela-v/zero-to-minecraft-server-with-docker-desktop-and-compose-500a
- This is a reference guide/tutorial on how to set up a vanilla Minecraft server using this project, including step-by-step instructions, and information on topics such as port-forwarding.
## Deploying onto AWS
If you're looking for a simple way to deploy this to the Amazon Web Services Cloud, check out the [Minecraft Server Deployment (CloudFormation) repository](https://github.com/vatertime/minecraft-spot-pricing). This repository contains a CloudFormation template that will get you up and running in AWS in a matter of minutes. Optionally it uses Spot Pricing so the server is very cheap, and you can easily turn it off when not in use.

View File

@@ -25,3 +25,8 @@ healthcheck:
```
Some orchestration systems, such as Portainer, don't allow for disabling the default `HEALTHCHECK` declared by this image. In those cases you can approximate the disabling of healthchecks by setting the environment variable `DISABLE_HEALTHCHECK` to `true`.
### Healthchecks for older versions
This container disables Healthchecks for Versions before b1.8 as those versions do not support any kind of server pinging.
For more information see [Server List Ping](https://wiki.vg/Server_List_Ping#Beta_1.8_to_1.3)

View File

@@ -0,0 +1,45 @@
# Auto-download from CurseForge
Mods and plugins can be auto-downloaded and upgraded from CurseForge by setting `CURSEFORGE_FILES` to a comma or space delimited list of [project-file references](#project-file-references). References removed from the declaration are automatically cleaned up and setting `CURSEFORGE_FILES` to an empty string removes all previously managed project-files.
A specific file can be omitted from each reference to allow for auto-selecting the newest version of the selected mod/plugin. The resolved `VERSION` and `TYPE` will be taken into consideration for selecting the appropriate file.
!!! warning "CurseForge API key usage"
A CurseForge API key must be allocated and set with `CF_API_KEY` [as described here](../types-and-platforms/mod-platforms/auto-curseforge.md#api-key).
## Project-file references
The following formats are supported in the list of project-file references:
- A project page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei`. _The newest applicable file will be automatically selected._
- A file page URL, such as `https://www.curseforge.com/minecraft/mc-mods/jei/files/4593548`
- Project slug, such as `jei`. _The newest applicable file will be automatically selected._
- Project ID, such as `238222`. _The newest applicable file will be automatically selected._
- Project slug or ID, `:`, and a file ID, such as `jei:4593548` or `238222:4593548`
- Project slug or ID, `@`, and a partial filename, such as `jei@10.2.1.1005`
An `@` followed by the container path to a listing file can also be provided as a project-file reference. Each line is processed as a reference where blank lines and comments that start with `#` are ignored.
For example, `CURSEFORGE_FILES` can be set to "@/extras/cf-mods.txt" where the container file `/extras/cf-mods.txt` contains
```text
# This comment is ignored
jei:10.2.1.1005
# This and previous blank line are ignore
geckolib
aquaculture
naturalist
```
!!! tip "Docker Compose"
Making use of the space delimited option, compose file declarations can be organized nicely with a [multi-line string](https://yaml-multiline.info/), such as
```yaml
CURSEFORGE_FILES: |
geckolib
aquaculture
naturalist
```

View File

@@ -1,65 +0,0 @@
# Forge API
## ForgeAPI usage to use non-version specific projects
!!! warning "Deprecated"
This approach will soon be deprecated in favor of a variation of `AUTO_CURSEFORGE`.
!!! warning
This potentially could lead to unexpected behavior if the Mod receives an update with unexpected behavior.
This is more complicated because you will be pulling/using the latest mod for the release of your game. To get started make sure you have a [CursedForge API Key](https://docs.curseforge.com/#getting-started). Then use the environmental parameters in your docker build.
Please be aware of the following when using these options for your mods:
* Mod Release types: Release, Beta, and Alpha.
* Mod dependencies: Required and Optional
* Mod family: Fabric, Forge, and Bukkit.
Parameters to use the ForgeAPI:
* `MODS_FORGEAPI_KEY` - Required
* `MODS_FORGEAPI_FILE` - Required or use MODS_FORGEAPI_PROJECTIDS (Overrides MODS_FORGEAPI_PROJECTIDS)
* `MODS_FORGEAPI_PROJECTIDS` - Required or use MODS_FORGEAPI_FILE
* `MODS_FORGEAPI_RELEASES` - Default is release, Options: [Release|Beta|Alpha]
* `MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES` - Default is False, attempts to download required mods (releaseType Release) defined in Forge.
* `MODS_FORGEAPI_IGNORE_GAMETYPE` - Default is False, Allows for filtering mods on family type: FORGE, FABRIC, and BUKKIT. (Does not filter for Vanilla or custom)
* `REMOVE_OLD_FORGEAPI_MODS` - Default is False
* `REMOVE_OLD_DATAPACKS_DEPTH` - Default is 1
* `REMOVE_OLD_DATAPACKS_INCLUDE` - Default is *.jar
Example of expected forge api project ids, releases, and key:
```yaml
MODS_FORGEAPI_PROJECTIDS: 306612,256717
MODS_FORGEAPI_RELEASES: Release
MODS_FORGEAPI_KEY: $WRX...
```
Example of expected ForgeAPI file format.
**Field Description**:
* `name` is currently unused, but can be used to document each entry.
* `projectId` id is the id found on the CurseForge website for a particular mod
* `releaseType` Type corresponds to forge's R, B, A icon for each file. Default Release, options are (release|beta|alpha).
* `fileName` is used for version pinning if latest file will not work for you.
```json
[
{
"name": "fabric api",
"projectId": "306612",
"releaseType": "release"
},
{
"name": "fabric voice mod",
"projectId": "416089",
"releaseType": "beta"
},
{
"name": "Biomes o plenty",
"projectId": "220318",
"fileName": "BiomesOPlenty-1.18.1-15.0.0.100-universal.jar",
"releaseType": "release"
}
]
```

View File

@@ -47,16 +47,14 @@ These paths work well if you want to have a common set of modules in a separate
## Zip file modpack
Like the `WORLD` option above, you can specify the URL or path of a "mod pack"
to download and install into `mods` for Forge/Fabric or `plugins` for Bukkit/Spigot.
To use this option pass the environment variable `MODPACK`, such as
Like the `WORLD` option above, you can specify the URL or container path of a "mod pack" to download and install into `mods` for Forge/Fabric or `plugins` for Bukkit/Spigot. To use this option pass the environment variable `MODPACK`, such as
```shell
docker run -d -e MODPACK=http://www.example.com/mods/modpack.zip ...
```
!!! note
The referenced URL must be a zip file with one or more jar files at the
The referenced URL/file must be a zip file with one or more jar files at the
top level of the zip archive. Make sure the jars are compatible with the
particular `TYPE` of server you are running.

View File

@@ -2,17 +2,29 @@
[Modrinth](https://modrinth.com/) is an open source modding platform with a clean, easy to use website for finding [Fabric and Forge mods](https://modrinth.com/mods). At startup, the container will automatically locate and download the newest versions of mod/plugin files that correspond to the `TYPE` and `VERSION` in use. Older file versions downloaded previously will automatically be cleaned up.
- **MODRINTH_PROJECTS** : comma separated list of project slugs (short name) or IDs. The project ID can be located in the "Technical information" section. The slug is the part of the page URL that follows `/mod/`:
- **MODRINTH_PROJECTS** : comma or newline separated list of project slugs (short name) or IDs. The project ID is located in the "Technical information" section. The slug is the part of the page URL that follows `/mod/`:
```
https://modrinth.com/mod/fabric-api
----------
|
+-- project slug
```
Also, specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found at 'Metadata' section. Valid version types are `release`, `beta`, `alpha`. For instance:
```
-e MODRINTH_PROJECTS=fabric-api,fabric-api:PbVeub96,fabric-api:beta
```
- **MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES**=true : required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true`
- **MODRINTH_ALLOWED_VERSION_TYPE**=release : the version type is used to determine the newest version to use from each project. The allowed values are `release`, `beta`, `alpha`.
Also, a specific version/type can be declared using colon symbol and version id/type after the project slug. The version id can be found in the 'Metadata' section. Valid version types are `release`, `beta`, `alpha`.
!!! example
| Description | Example |
|---------------------------------|-----------------------|
| Select latest version | `fabric-api` |
| Select specific version | `fabric-api:PbVeub96` |
| Select latest beta version | `fabric-api:beta` |
| Latest version using project ID | `P7dR8mSH` |
## Extra options
`MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES`
: Required dependencies of the project will _always_ be downloaded and optional dependencies can also be downloaded by setting this to `true`. The default is "true"
`MODRINTH_ALLOWED_VERSION_TYPE`
: The version type is used to determine the newest version to use from each project. The allowed values are `release` (default), `beta`, `alpha`.

View File

@@ -1,9 +1,9 @@
mkdocs
mkdocs-material-extensions
mkdocs-material
mkdocs-autorefs
mkdocstrings
mkdocs-literate-nav
mdx-gh-links
mkdocs-click
mkdocs-static-i18n
mkdocs == 1.5.2
mkdocs-material-extensions == 1.1.1
mkdocs-material == 9.2.7
mkdocs-autorefs == 0.5.0
mkdocstrings == 0.23.0
mkdocs-literate-nav == 0.6.0
mdx-gh-links == 0.3.1
mkdocs-click == 0.8.0
mkdocs-static-i18n == 1.0.2

View File

@@ -58,7 +58,10 @@ For example:
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
If the authors of the modpack have disallowed project distribution, then the desired **client** modpack zip will need to be manually downloaded and made available to the container. The path to that file must be passed to `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, the modpack slug or page URL must still be provided.
!!! note "Mods need download report"
A file called `MODS_NEED_DOWNLOAD.txt` will be created in the `/data` directory that lists the mods that need to be manually downloaded and where to get them.
If you wish to use a unpublished modpack zip, set the container path to the file in `CF_MODPACK_ZIP`. Similarly, the container path to a modpack manifest JSON can be passed to `CF_MODPACK_MANIFEST`. In either case, **the modpack slug or page URL must still be provided**.
The latest file will be located and used by default, but if a specific version is desired you can use one of the following options. With any of these options **do not select a server file** -- they lack the required manifest and defeat the ability to consistently automate startup.
@@ -84,7 +87,7 @@ The following examples all refer to version 1.0.7 of ATM8:
-e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7
```
## Exlude client mods
## Exclude client mods
Quite often there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods:
@@ -98,7 +101,7 @@ For more complex scenarios, global and per modpack exclusions can be declared in
If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true" to ensure the exclude/includes are re-evaluated.
!!! important
These options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
These options are provided to empower you to get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing.
## Extra options

View File

@@ -19,6 +19,8 @@ This mod platform type will automatically take care of downloading and installin
```
- `FTB_MODPACK_VERSION_ID`: optional, the numerical ID of the version to install. If not specified, the latest version will be installed. The "Version ID" can be obtained by hovering over a server file entry and grabbing [this ID in the URL](../../img/ftba-version-id-popup.png).
- `FTB_FORCE_REINSTALL`: if the files become inconsistent, such as when accidentally removing them, the FTB can be forced to re-run by setting this to "true"
### Upgrading
If a specific `FTB_MODPACK_VERSION_ID` was not specified, simply restart the container to pick up the newest modpack version. If using a specific version ID, recreate the container with the new version ID.

View File

@@ -2,7 +2,9 @@
[Modrinth Modpacks](https://modrinth.com/modpacks) can automatically be installed along with the required mod loader (Forge or Fabric) by setting `MOD_PLATFORM` or `TYPE` to "MODRINTH". Upgrading (and downgrading) takes care of cleaning up old files and upgrading (and downgrading) the mod loader.
The desired modpack project is specified with the `MODRINTH_PROJECT` environment variable and must be one of:
## Modpack project
The desired modpack project is specified with the `MODRINTH_MODPACK` environment variable and must be one of:
- The project "slug", which is located in the URL shown here:
@@ -12,14 +14,30 @@ The desired modpack project is specified with the `MODRINTH_PROJECT` environment
![](../../img/modrinth-project-id.drawio.png)
- The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page.
## Modpack version
The automatic modpack version resolving can be narrowed in a few ways:
The latest release or beta version, respectively, of the Modrinth modpack is selected when `VERSION` is "LATEST" or "SNAPSHOT". That can be overridden by setting `MODRINTH_DEFAULT_VERSION_TYPE` to "release", "beta", or "alpha".
Furthermore, the resolved modpack version can be narrowed by setting `VERSION` to a specific Minecraft version, such as "1.19.2".
The resolved modpack version can be narrowed by setting `VERSION` to a specific Minecraft version, such as "1.19.2".
The selected version can also be narrowed to a particular mod loader by setting `MODRINTH_LOADER` to either "forge", "fabric", or "quilt".
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_PROJECT`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_MODPACK`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here
![](../../img/modrinth-version-id.drawio.png)
## Ignore missing files
Some mods, such as [MCInstance Loader](https://modrinth.com/mod/mcinstance-loader), use temporary files from the modpack and delete them when finished. In order to avoid the installer from detecting the absent file(s) and re-installing, those files can be ignored by passing a comma or newline delimited list to `MODRINTH_IGNORE_MISSING_FILES`.
!!! example
In a Compose file
```yaml
environment:
MODRINTH_IGNORE_MISSING_FILES: |
config/mcinstanceloader/pack.mcinstance
```

View File

@@ -1,31 +1,36 @@
Enable [Forge server](http://www.minecraftforge.net/) mode by adding a `-e TYPE=FORGE` to your command-line.
A [Forge server](http://www.minecraftforge.net/) can be automatically downloaded, upgraded, and run by setting the environment variable `TYPE` to "FORGE".
The overall version is specified by `VERSION`, [as described in the section above](../../versions/minecraft.md) and will run the recommended Forge version by default. You can also choose to run a specific Forge version with `FORGE_VERSION`, such as `-e FORGE_VERSION=14.23.5.2854`.
!!! example
```
docker run -d -v /path/on/host:/data \
-e TYPE=FORGE \
-e VERSION=1.12.2 -e FORGE_VERSION=14.23.5.2854 \
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
```
```
docker run -e TYPE=FORGE ...
```
or in a compose file
```yaml
environment:
TYPE: FORGE
```
To use a pre-downloaded Forge installer, place it in the attached `/data` directory and
specify the name of the installer file with `FORGE_INSTALLER`, such as:
The overall version is specified by `VERSION`, [as described in the section above](../../versions/minecraft.md) and provides the same benefits of upgrading as new versions are released. By default, the recommended version of Forge for that Minecraft version will be selected. The latest version can be selected instead by setting the environment variable `FORGE_VERSION` to "latest". You can also choose a specific Forge version by setting `FORGE_VERSION` with that version, such as "14.23.5.2854".
```
docker run -d -v /path/on/host:/data ... \
-e FORGE_INSTALLER=forge-1.11.2-13.20.0.2228-installer.jar ...
```
!!! example
To download a Forge installer from a custom location, such as your own file repository, specify
the URL with `FORGE_INSTALLER_URL`, such as:
```
docker run -e TYPE=FORGE -e VERSION=1.12.2 -e FORGE_VERSION=14.23.5.2854 ...
```
or in a compose file
```yaml
environment:
TYPE: FORGE
VERSION: "1.12.2"
FORGE_VERSION: "14.23.5.2854"
```
```
docker run -d -v /path/on/host:/data ... \
-e FORGE_INSTALLER_URL=http://HOST/forge-1.11.2-13.20.0.2228-installer.jar ...
```
To use a pre-downloaded Forge installer, place it in a location mounted into the container and specify the container path with `FORGE_INSTALLER`. To download a Forge installer from a custom location, such as your own file repository, specify the URL with `FORGE_INSTALLER_URL`.
In both of the cases above, there is no need for the `VERSION` or `FORGEVERSION` variables.
In both of the cases above, there is no need for the `VERSION` or `FORGE_VERSION` variables.
!!! note

View File

@@ -48,3 +48,21 @@ Configuration options with defaults:
- `CRUCIBLE_RELEASE`=latest
Crucible is only available for 1.7.10, so be sure to set `VERSION=1.7.10`.
## Custom
To use a custom server jar or class files, set `TYPE` to "CUSTOM" and continue with one of the following options:
The custom jar to be used can be set with `CUSTOM_SERVER` as either a URL to download or the path to a file within the container.
Alternatively, the final `-jar` invocation can be replaced by setting `CUSTOM_JAR_EXEC` to "`-cp <classpath> <classname>`" or "`-jar <jar file>`" form, such as
```
-cp worldedit.jar:Carpet-Server.jar net.minecraft.server.MinecraftServer
```
!!! note
When using `docker run` make sure to quote the entire value since it has spaces in it, such as
-e CUSTOM_JAR_EXEC="-cp worldedit.jar:Carpet-Server.jar net.minecraft.server.MinecraftServer"

View File

@@ -11,11 +11,12 @@
cannot be cast to class java.net.URLClassLoader
```
When using the image `itzg/minecraft-server` without a tag, the `latest` image tag is implied from the table below. To use a different version of Java, please use an alternate tag to run your Minecraft server container.
When using the image `itzg/minecraft-server` without a tag, the `latest` image tag is implied from the table below. To use a different version of Java, please use an alternate tag to run your Minecraft server container. The `stable` tag is similar to `latest`; however, it tracks [the most recent repository release/tag](https://github.com/itzg/docker-minecraft-server/releases/latest).
| Tag name | Java version | Linux | JVM Type | Architecture |
|-------------------|--------------|--------|-------------|-------------------|
| latest | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| stable | 17 | Ubuntu | Hotspot | amd64,arm64,armv7 |
| java8 | 8 | Alpine | Hotspot | amd64 |
| java8-jdk | 8 | Ubuntu | Hotspot+JDK | amd64 |
| java8-multiarch | 8 | Ubuntu | Hotspot | amd64,arm64,armv7 |
@@ -29,8 +30,8 @@ When using the image `itzg/minecraft-server` without a tag, the `latest` image t
| java17-openj9 | 17 | Debian | OpenJ9 | amd64 |
| java17-graalvm-ce | 17 | Oracle | GraalVM CE | amd64,arm64 |
| java17-alpine | 17 | Alpine | Hotspot | amd64 |
| java20-alpine | 19 | Alpine | Hotspot | amd64 |
| java20 | 19 | Ubuntu | Hotspot | amd64,arm64 |
| java20-alpine | 20 | Alpine | Hotspot | amd64 |
| java20 | 20 | Ubuntu | Hotspot | amd64,arm64 |
For example, to use Java version 8 on any supported architecture:

View File

@@ -2,7 +2,8 @@ To use a different Minecraft version, pass the `VERSION` environment variable (c
- LATEST (the default)
- SNAPSHOT
- or a specific version, such as "1.7.9"
- a specific version, such as "1.7.9"
- or an alpha and beta version, such as "b1.7.3" (server download might not exist)
For example, to use the latest snapshot:

3
examples/.gitignore vendored
View File

@@ -1,2 +1,3 @@
data/
modpacks/
modpacks/
.env

View File

@@ -7,7 +7,7 @@ services:
- "25565:25565"
environment:
EULA: "true"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
@@ -15,7 +15,7 @@ services:
MEMORY: 4G
volumes:
- mc-data:/data
- ./downloads:/downloads
- ../downloads:/downloads
# Since Docker's default volume driver creates volumes owned by root, this
# init container will change ownership to match final UID of mc service, above
init-filebrowser:
@@ -29,12 +29,16 @@ services:
filebrowser:
image: filebrowser/filebrowser
depends_on:
- init-filebrowser
init-filebrowser:
condition: service_completed_successfully
user: "1000:1000"
environment:
FB_DATABASE: /database/filebrowser.db
volumes:
# Default FB_ROOT is /srv
# In this example, the left-side needs to be the same as /data volume of mc service
- mc-data:/srv
- filebrowser-db:/database
- ./filebrowser.json:/.filebrowser.json
ports:
- "25580:80"

View File

@@ -0,0 +1,21 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
MOD_PLATFORM: AUTO_CURSEFORGE
# Set CF_API_KEY=... in a .env file next to this compose file and don't source control that file
CF_API_KEY: ${CF_API_KEY}
CF_SLUG: better-mc-fabric-bmc1
CF_FILENAME_MATCHER: v18.5
MEMORY: 4G
volumes:
- mc:/data
- ../downloads:/downloads
ports:
- "25565:25565"
volumes:
mc: {}

View File

@@ -0,0 +1,17 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server
environment:
EULA: true
TYPE: FORGE
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
VERSION: 1.19.2
CURSEFORGE_FILES: |
geckolib
aquaculture
naturalist
ports:
- "25565:25565"

View File

@@ -2,12 +2,12 @@ version: "3"
services:
mc:
image: ${IMAGE:-itzg/minecraft-server}
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: FABRIC
ports:
- 25565:25565
- "25565:25565"
volumes:
- fabric:/data

View File

@@ -0,0 +1,22 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server
tty: true
stdin_open: true
ports:
- "25565:25565"
environment:
EULA: "TRUE"
restart: unless-stopped
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data
ngrok:
image: shkoliar/ngrok:latest
ports:
- 4551:4551
environment:
- PARAMS=tcp -region=us -authtoken=YourAuthTokenHere mc:25565

View File

@@ -10,10 +10,12 @@ services:
environment:
EULA: "TRUE"
TYPE: FABRIC
MODS_FORGEAPI_PROJECTIDS: 433175
MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_KEY}
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "TRUE"
REMOVE_OLD_FORGEAPI_MODS: "TRUE"
MEMORY: "2G"
CURSEFORGE_FILES: |
fabric-api
chunky-pregenerator
# allocate from https://console.curseforge.com/ and set in .env file
CF_API_KEY: ${CF_API_KEY}
# YAML Heredoc, be sure to use '|-' this will remove the first newline and final new line.
# This is versus '|' that will leaving with two empty strings at top and bottom.
RCON_CMDS_STARTUP: |-

1
examples/downloads/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.jar

View File

@@ -9,16 +9,15 @@ services:
- "25565:25565"
environment:
EULA: "TRUE"
TYPE: MODRINTH
MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2
MOD_PLATFORM: MODRINTH
MODRINTH_MODPACK: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2
# or for auto-upgrading to latest
# MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric
# MODRINTH_MODPACK: https://modrinth.com/modpack/cobblemon-fabric
# or just cobblemon-fabric or 5FFgwNNP
# and could replace version URL with
# MODRINTH_VERSION: nvrqJg44
# MODRINTH_VERSION: 1.3.2
# MODRINTH_VERSION: "Cobblemon [Fabric] 1.3.2"
SETUP_ONLY: "true"
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data

View File

@@ -2,7 +2,7 @@ version: "3"
services:
mc:
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: PAPER

View File

@@ -10,7 +10,7 @@ services:
MODS_FILE: /extras/mods.txt
REMOVE_OLD_MODS: "true"
ports:
- 25565:25565
- "25565:25565"
volumes:
- data:/data
- ./mods.txt:/extras/mods.txt:ro

View File

@@ -7,14 +7,14 @@ services:
- "25565:25565"
environment:
EULA: "true"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
# CF_API_KEY=... must be set in .env file or as environment variable
CF_API_KEY: ${CF_API_KEY}
CF_SLUG: one-block-modded
# Modpack client zip must be manually downloaded from
# https://www.curseforge.com/minecraft/modpacks/one-block-modded
# due to authors disallowing project distribution
CF_MODPACK_ZIP: /modpacks/Modded+OneBock.zip
CF_MODPACK_ZIP: /modpacks/Modded+OneBlock.zip
CF_SET_LEVEL_FROM: OVERRIDES
DEBUG: "false"
MEMORY: 4G
@@ -23,4 +23,4 @@ services:
- ./modpacks:/modpacks:ro
volumes:
mc-data: {}
mc-data: {}

View File

@@ -7,7 +7,7 @@ services:
- "25565:25565"
environment:
EULA: "true"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/
CF_SLUG: the-pixelmon-modpack
CF_FILENAME_MATCHER: "9.1.2"

View File

@@ -0,0 +1,15 @@
version: "3"
services:
mc:
image: itzg/minecraft-server
environment:
EULA: "true"
TYPE: QUILT
ports:
- "25565:25565"
volumes:
- data:/data
volumes:
data: {}

View File

@@ -0,0 +1,18 @@
version: "3.8"
services:
mc:
image: itzg/minecraft-server:java8-multiarch
environment:
EULA: true
MOD_PLATFORM: AUTO_CURSEFORGE
# Set CF_API_KEY=... in a .env file next to this compose file and don't source control that file
CF_API_KEY: ${CF_API_KEY}
CF_SLUG: rlcraft
CF_FILENAME_MATCHER: 2.9.3
CF_FORCE_SYNCHRONIZE: true
MEMORY: 4G
volumes:
- ./data:/data
ports:
- "25565:25565"

View File

@@ -7,7 +7,7 @@ services:
- "25565:25565"
environment:
EULA: "true"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/
CF_FORCE_SYNCHRONIZE: "true"
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/valhelsia-5/files/4429560

View File

@@ -7,7 +7,7 @@ services:
- "25565:25565"
environment:
EULA: "true"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: # allocate from https://console.curseforge.com/
CF_SLUG: vault-hunters-1-18-2
CF_FILENAME_MATCHER: "Update-10.0.0"

View File

@@ -62,7 +62,13 @@ do
# Server startup
if mc_server_listening ; then
TIME_THRESH=$(($(current_uptime)+$AUTOPAUSE_TIMEOUT_INIT))
logAutopause "MC Server listening for connections - pausing in $AUTOPAUSE_TIMEOUT_INIT seconds"
if [ -e /data/.skip-pause ] ; then
logAutopause "'/data/.skip-pause' file is present - skipping pausing"
else
logAutopause "MC Server listening for connections - pausing in $AUTOPAUSE_TIMEOUT_INIT seconds"
fi
STATE=K
fi
;;
@@ -71,6 +77,9 @@ do
if java_clients_connected ; then
logAutopause "Client connected - waiting for disconnect"
STATE=E
elif [ -e /data/.skip-pause ] ; then
logAutopause "'/data/.skip-pause' file is present - skipping pausing"
STATE=E
else
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
logAutopause "No client connected since startup / knocked - pausing"
@@ -92,6 +101,10 @@ do
if java_clients_connected ; then
logAutopause "Client reconnected - waiting for disconnect"
STATE=E
elif [ -e /data/.skip-pause ] ; then
TIME_THRESH=$(($(current_uptime)+$AUTOPAUSE_TIMEOUT_EST))
logAutopause "'/data/.skip-pause' file is present - skipping pausing"
STATE=E
else
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
logAutopause "No client reconnected - pausing"

View File

@@ -28,7 +28,13 @@ do
# Server startup
if mc_server_listening ; then
TIME_THRESH=$(($(current_uptime)+AUTOSTOP_TIMEOUT_INIT))
logAutostop "MC Server listening for connections - stopping in $AUTOSTOP_TIMEOUT_INIT seconds"
if [ -e /data/.skip-stop ] ; then
logAutostop "'/data/.skip-stop' file is present - skipping stopping"
else
logAutostop "MC Server listening for connections - stopping in $AUTOSTOP_TIMEOUT_INIT seconds"
fi
STATE=II
fi
;;
@@ -37,6 +43,9 @@ do
if java_clients_connected ; then
logAutostop "Client connected - waiting for disconnect"
STATE=E
elif [ -e /data/.skip-stop ] ; then
logAutostop "'/data/.skip-stop' file is present - skipping stopping"
STATE=E
else
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
logAutostop "No client connected since startup - stopping server"
@@ -58,6 +67,10 @@ do
if java_clients_connected ; then
logAutostop "Client reconnected - waiting for disconnect"
STATE=E
elif [ -e /data/.skip-stop ] ; then
TIME_THRESH=$(($(current_uptime)+$AUTOSTOP_TIMEOUT_EST))
logAutostop "'/data/.skip-stop' file is present - skipping stopping"
STATE=E
else
if [[ $(current_uptime) -ge $TIME_THRESH ]] ; then
logAutostop "No client reconnected - stopping"

View File

@@ -4,7 +4,6 @@
"armor-toughness-bar",
"biomeinfo",
"block-drops-jei-addon",
"carry-on",
"cherished-worlds",
"controlling",
"ctm",
@@ -17,6 +16,9 @@
"entityculling",
"extreme-sound-muffler",
"ignitioncoil",
"inmisaddon",
"irisshaders",
"iris-flywheel-compat",
"just-enough-harvestcraft",
"just-enough-resources-jer",
"legendary-tooltips",
@@ -39,6 +41,7 @@
"rubidium",
"rubidium-extra",
"skin-layers-3d",
"sodium",
"textrues-rubidium-options",
"thaumic-jei",
"tips",

View File

@@ -1,13 +1,12 @@
---
site_name: Minecraft Server on Docker (Java Edition)
site_url: https://docker-minecraft-server.readthedocs.io/
site_url: https://docker-minecraft-server.readthedocs.io/en/latest/
site_description: Documentation for Minecraft Server on Docker
repo_url: https://github.com/itzg/docker-minecraft-server
edit_uri: blob/master/docs/
theme:
name: material
features:
- navigation.instant
- navigation.tracking
- navigation.tabs
- navigation.tabs.sticky
@@ -54,9 +53,6 @@ copyright: Copyright &copy; itzg 2023.
plugins:
- search
- autorefs
- literate-nav:
nav_file: README.md
implicit_index: true
- mkdocstrings:
handlers:
python:
@@ -68,8 +64,11 @@ plugins:
show_signature_annotations: true
# https://github.com/ultrabug/mkdocs-static-i18n
- i18n:
default_language: en
languages:
en:
- locale: en
name: English
build: true
default: true
- literate-nav:
nav_file: README.md
implicit_index: true

1
notes/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/*.bkp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

93
notes/rbac-processing.mmd Normal file
View File

@@ -0,0 +1,93 @@
[Scia Reto](https://sciareto.org) mind map
> __version__=`1.1`,showJumps=`true`
---
# RBAC processing
## inputs
### whitelist
#### command or space limited
##### uuid
##### username
### ops
#### username
#### uuid
### whitelist file
#### url?
##### yes
###### download
##### no
###### copy
### override whitelist?
#### yes
##### replace all with given input list
#### no
##### append only
## format
### version \< 1\.7\.6?
#### yes
##### text file listing usernames
###### white\-list\.txt
###### ops\.txt
#### no
> leftSide=`true`
##### json file
###### array of objects
####### name
######## can be any string, even an empty one
####### uuid
> leftSide=`true`
######## username to UUID API
- LINK
<pre>https://wiki.vg/Mojang_API#Username_to_UUID</pre>
######## needs to be "dashed" UUID syntax
> leftSide=`true`
####### ops?
######## yes
######### also includes
########## level
########### integer, usually a 4
########## bypassesPlayerLimit
########### boolean

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 67 KiB

View File

@@ -8,7 +8,6 @@
: "${GID:=1000}"
umask 0002
chmod g+w /data
if isTrue "${ENABLE_RCON:-true}" && ! [ -v RCON_PASSWORD ] && ! [ -v RCON_PASSWORD_FILE ]; then
RCON_PASSWORD=$(openssl rand -hex 12)

View File

@@ -105,31 +105,6 @@ function fixJavaPath() {
fi
}
function resolveVersion() {
VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
case "X$VERSION" in
X|XLATEST|Xlatest)
if ! VANILLA_VERSION=$(get --json-path '$.latest.release' "$VERSIONS_JSON"); then
log "ERROR: version lookup failed: $VANILLA_VERSION"
exit 1
fi
;;
XSNAPSHOT|Xsnapshot)
if ! VANILLA_VERSION=$(get --json-path '$.latest.snapshot' "$VERSIONS_JSON"); then
log "ERROR: version lookup failed: $VANILLA_VERSION"
exit 1
fi
;;
*)
VANILLA_VERSION=$VERSION
;;
esac
export VANILLA_VERSION
MAJOR_VANILLA_VERSION=$(get_major_version "$VANILLA_VERSION")
export MAJOR_VANILLA_VERSION
log "Resolved version given ${VERSION} into ${VANILLA_VERSION} and major version ${MAJOR_VANILLA_VERSION}"
}
if ! fixJavaPath; then
log "ERROR: could not locate path that contains java"
@@ -160,7 +135,7 @@ then
"${SCRIPTS:-/}start-rconcmds"
fi
: ${MOD_PLATFORM:=}
: "${MOD_PLATFORM:=}"
case "${TYPE^^}" in
AUTO_CURSEFORGE|MODRINTH|CURSEFORGE|FTB|FTBA)
MOD_PLATFORM="$TYPE"
@@ -184,11 +159,14 @@ if [[ $MOD_PLATFORM ]]; then
MODRINTH)
exec "${SCRIPTS:-/}start-deployModrinth" "$@"
;;
*)
log "ERROR; Invalid MOD_PLATFORM: '$MOD_PLATFORM'"
exit 1
;;
esac
fi
resolveVersion
log "Resolving type given ${TYPE}"
case "${TYPE^^}" in
*BUKKIT|SPIGOT)
@@ -204,7 +182,6 @@ case "${TYPE^^}" in
;;
FORGE)
evaluateJavaCompatibilityForForge
exec "${SCRIPTS:-/}start-deployForge" "$@"
;;
@@ -261,20 +238,14 @@ case "${TYPE^^}" in
;;
CRUCIBLE)
log "**********************************************************************"
log "WARNING: The image tag itzg/minecraft-server:java8 is recommended"
log " since some mods require Java 8"
log " Exception traces reporting ClassCastException: class jdk.internal.loader.ClassLoaders\$AppClassLoader"
log " can be fixed with java8"
log "**********************************************************************"
exec "${SCRIPTS:-/}start-deployCrucible" "$@"
;;
*)
log "Invalid type: '$TYPE'"
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
log " CURSEFORGE, SPONGEVANILLA, PURPUR, CUSTOM,"
log " MAGMA, MOHIST, CATSERVER, AIRPLANE, PUFFERFISH, CANYON, LIMBO, CRUCIBLE"
log "ERROR: Invalid TYPE: '$TYPE'"
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FOLIA, PURPUR, FABRIC, QUILT,"
log " SPONGEVANILLA, CUSTOM, MAGMA, MOHIST, CATSERVER, AIRPLANE, PUFFERFISH,"
log " CANYON, LIMBO, CRUCIBLE"
exit 1
;;

View File

@@ -66,13 +66,11 @@ if ! mc-image-helper install-curseforge "${args[@]}"; then
exit 1
fi
# grab SERVER, FAMILY and export it
# grab SERVER, TYPE, VERSION and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
# grab the version resolved from modpack
VANILLA_VERSION="$VERSION"
export VANILLA_VERSION
resolveFamily
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -1,6 +1,7 @@
#!/bin/bash
. ${SCRIPTS:-/}start-utils
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
set -e
@@ -20,7 +21,7 @@ function buildSpigotFromSource {
logn ''
curl -sSL -o /data/temp/BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && \
java $jvmOpts -jar /data/temp/BuildTools.jar --rev $VANILLA_VERSION 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
java $jvmOpts -jar /data/temp/BuildTools.jar --rev "$VERSION" 2>&1 |tee /data/spigot_build.log| while read l; do echo -n .; done; log "done"
case ${TYPE^^} in
SPIGOT)
@@ -60,14 +61,14 @@ function downloadSpigot {
esac
if [[ ${VERSION^^} = LATEST ]]; then
VANILLA_VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]')
VERSION=$(restify https://getbukkit.org/download/spigot --attribute='property=og:title' | jq -r '.[0] | .attributes | select(.property == "og:title") | .content | split(" ") | .[-1]')
fi
if [[ -z $downloadUrl ]]; then
if versionLessThan 1.16.5 || ([[ ${getbukkitFlavor} = "craftbukkit" ]] && [[ ${VANILLA_VERSION} = "1.16.5" ]]); then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
if versionLessThan 1.16.5 || ([[ ${getbukkitFlavor} = "craftbukkit" ]] && [[ ${VERSION} = "1.16.5" ]]); then
downloadUrl="https://cdn.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VERSION}.jar"
else
downloadUrl="https://download.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VANILLA_VERSION}.jar"
downloadUrl="https://download.getbukkit.org/${getbukkitFlavor}/${getbukkitFlavor}-${VERSION}.jar"
fi
fi
@@ -108,15 +109,16 @@ EOF
function setServerVar {
case "$TYPE" in
*BUKKIT|*bukkit)
export SERVER=craftbukkit_server-${VANILLA_VERSION}.jar
export SERVER=craftbukkit_server-${VERSION}.jar
;;
*)
export SERVER=spigot_server-${VANILLA_VERSION}.jar
export SERVER=spigot_server-${VERSION}.jar
;;
esac
}
if isTrue "$BUILD_SPIGOT_FROM_SOURCE" || isTrue "$BUILD_FROM_SOURCE"; then
resolveVersion
setServerVar
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
buildSpigotFromSource

View File

@@ -24,6 +24,11 @@ loadForgeVars() {
isDebugging && set -x
if [[ ${VERSION^^} == LATEST ]]; then
log "WARNING for the old TYPE=CURSEFORGE mechanism it is best to set VERSION to a specific value"
fi
resolveVersion
: "${FTB_BASE_DIR:=${CF_BASE_DIR:-/data/FeedTheBeast}}"
export FTB_BASE_DIR

View File

@@ -29,4 +29,4 @@ fi
export FAMILY=HYBRID
exec "${SCRIPTS:-/}start-setupWorld" "$@"
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -6,7 +6,7 @@ set -o pipefail
set -e
isDebugging && set -x
requireVar VANILLA_VERSION
resolveVersion
: "${CRUCIBLE_RELEASE:=latest}"
crucibleReleasesUrl=https://api.github.com/repos/CrucibleMC/Crucible/releases
@@ -16,14 +16,14 @@ else
crucibleReleaseUrl=${crucibleReleasesUrl}/tags/${CRUCIBLE_RELEASE}
fi
if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /Crucible-${VANILLA_VERSION}-.*\.jar/)].browser_download_url" \
if ! downloadUrl=$(get --json-path "$.assets[?(@.name =~ /Crucible-${VERSION}-.*\.jar/)].browser_download_url" \
--accept "application/vnd.github.v3+json" "$crucibleReleaseUrl"); then
log "ERROR: failed to access ${CRUCIBLE_RELEASE} release of Crucible"
exit 1
fi
if [[ $downloadUrl = null ]]; then
log "ERROR: failed to locate Crucible jar for $VANILLA_VERSION from ${CRUCIBLE_RELEASE}"
log "ERROR: failed to locate Crucible jar for $VERSION from ${CRUCIBLE_RELEASE}"
exit 1
fi
@@ -57,4 +57,4 @@ fi
export SERVER
export FAMILY=HYBRID
exec "${SCRIPTS:-$(dirname "$0")}/start-setupWorld" "$@"
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -1,18 +1,22 @@
#!/bin/bash
: "${CUSTOM_SERVER:=}"
: "${GENERIC_PACK:=}"
: "${CUSTOM_JAR_EXEC:=}"
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
if isURL ${CUSTOM_SERVER}; then
filename=$(basename ${CUSTOM_SERVER})
if isURL "${CUSTOM_SERVER}"; then
filename=$(basename "${CUSTOM_SERVER}")
export SERVER=/data/${filename}
if [[ -f ${SERVER} ]] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "Using previously downloaded jar at ${SERVER}"
else
log "Downloading custom server jar from ${CUSTOM_SERVER} ..."
if ! curl -sSL -o ${SERVER} ${CUSTOM_SERVER}; then
if ! curl -sSL -o "${SERVER}" "${CUSTOM_SERVER}"; then
log "Failed to download from ${CUSTOM_SERVER}"
exit 2
fi
@@ -25,6 +29,9 @@ elif [[ ${GENERIC_PACK} ]]; then
log "Using custom server jar from generic pack at ${CUSTOM_SERVER} ..."
export SERVER=${CUSTOM_SERVER}
elif [[ ${CUSTOM_JAR_EXEC} ]]; then
log "CUSTOM_JAR_EXEC is in use, so \$SERVER will not be set"
else
log "CUSTOM_SERVER is not properly set to a URL or existing jar file"
exit 2
@@ -34,4 +41,4 @@ fi
# Allow for overriding Family on custom for testing.
export FAMILY="${FAMILY:-HYBRID}"
exec ${SCRIPTS:-/}start-setupWorld $@
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -1,5 +1,7 @@
#!/bin/bash
: "${FTB_FORCE_REINSTALL:=false}"
ftbInstallMarker=".ftb-installed"
# shellcheck source=start-utils
@@ -32,7 +34,7 @@ elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
exit 1
fi
if ! [ -f "${ftbInstallMarker}" ] || [ "$(cat "${ftbInstallMarker}")" != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
if isTrue "$FTB_FORCE_REINSTALL" || ! [ -f "${ftbInstallMarker}" ] || [ "$(cat "${ftbInstallMarker}")" != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
ftbInstaller=/data/ftb-installer
if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer"
@@ -64,6 +66,8 @@ fi
forgeVersion=$(jq -r '.targets|unique[] | select(.name == "forge") | .version' version.json)
fabricVersion=$(jq -r '.targets|unique[] | select(.name == "fabric") | .version' version.json)
mcVersion=$(jq -r '.targets|unique[] | select(.name == "minecraft") | .version' version.json)
VERSION="$mcVersion"
export VERSION
variants=(
"forge-${mcVersion}-${forgeVersion}.jar"

View File

@@ -19,9 +19,10 @@ if [[ $FABRIC_LAUNCHER ]]; then
if ! mc-image-helper install-fabric-loader \
--results-file=${resultsFile} \
--from-local-file="$FABRIC_LAUNCHER"; then
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER"
log "ERROR failed to use provided Fabric launcher"
exit 1
fi
# Custom fabric jar url
elif [[ $FABRIC_LAUNCHER_URL ]]; then
if ! mc-image-helper install-fabric-loader \
@@ -30,19 +31,21 @@ elif [[ $FABRIC_LAUNCHER_URL ]]; then
log "ERROR failed to install Fabric launcher from $FABRIC_LAUNCHER_URL"
exit 1
fi
# Official fabric launcher
else
if ! mc-image-helper install-fabric-loader \
--results-file=${resultsFile} \
--minecraft-version="${VANILLA_VERSION}" \
--minecraft-version="${VERSION}" \
--installer-version="${FABRIC_LAUNCHER_VERSION}" \
--loader-version="${FABRIC_LOADER_VERSION}"; then
log "ERROR failed to install Fabric launcher from $VANILLA_VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION"
log "ERROR failed to install Fabric launcher given $VERSION, $FABRIC_LAUNCHER_VERSION, $FABRIC_LOADER_VERSION"
exit 1
fi
fi
# grab SERVER and export it
# grab SERVER, etc and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"

View File

@@ -7,8 +7,6 @@
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
isDebugging && set -x
# NOTE: VERSION rather than VANILLA_VERSION is specified to allow for latest supported
# Forge version to be selected.
if [[ ${FORGE_INSTALLER} ]]; then
if ! mc-image-helper install-forge \
--output-directory=/data \

View File

@@ -4,10 +4,17 @@
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
: "${VANILLA_VERSION?}"
: "${MAGMA_VERSION:=}"
if ! downloadUrl=$(get --json-path '$.link' "https://api.magmafoundation.org/api/v2/${VANILLA_VERSION}/latest"); then
log "ERROR failed to locate latest Magma download for ${VANILLA_VERSION}. Is that version supported?"
resolveVersion
if ! downloadUrl=$(get --json-path '$.link' "https://api.magmafoundation.org/api/v2/${VERSION}/latest/${MAGMA_VERSION}"); then
log "ERROR failed to locate latest Magma download for ${VERSION}. Is that version supported?"
exit 1
fi
if [[ $downloadUrl == null ]]; then
log "ERROR Magma does not seem to be available for $VERSION"
exit 1
fi
@@ -19,4 +26,4 @@ fi
export SERVER
export FAMILY=HYBRID
exec "${SCRIPTS:-/}start-setupWorld" "$@"
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -6,18 +6,28 @@ set -eu
resultsFile=/data/.install-modrinth.env
requireVar MODRINTH_PROJECT
: "${MODRINTH_MODPACK:=${MODRINTH_PROJECT:-}}"
: "${MODRINTH_LOADER:=}"
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
: "${MODRINTH_IGNORE_MISSING_FILES:=}"
if [[ ! $MODRINTH_MODPACK ]]; then
log "ERROR: MODRINTH_MODPACK must be set when using TYPE/MOD_PLATFORM of MODRINTH"
exit 1
fi
isDebugging && set -x
args=(
--results-file="$resultsFile"
--project="${MODRINTH_PROJECT}"
--project="${MODRINTH_MODPACK}"
--output-directory=/data
)
if [[ $MODRINTH_IGNORE_MISSING_FILES ]]; then
args+=(--ignore-missing-files "$MODRINTH_IGNORE_MISSING_FILES")
fi
case "${VERSION^^}" in
LATEST)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
@@ -48,13 +58,11 @@ if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then
exit 1
fi
# grab SERVER, FAMILY and export it
# grab SERVER, TYPE, VERSION and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
# grab the version resolved from modpack
VANILLA_VERSION="$VERSION"
export VANILLA_VERSION
resolveFamily
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -6,14 +6,14 @@ set -o pipefail
set -e
isDebugging && set -x
requireVar VANILLA_VERSION
resolveVersion
: "${MOHIST_BUILD:=lastSuccessfulBuild}"
mohistJobs=https://ci.codemc.io/job/MohistMC/job/
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
mohistJob=${mohistJobs}Mohist-${VERSION}/
if ! get --exists "${mohistJob}"; then
log "ERROR: mohist builds do not exist for ${VANILLA_VERSION}"
log "ERROR: mohist builds do not exist for ${VERSION}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly"
exit 1
@@ -25,7 +25,7 @@ buildRelPath=$(
baseName=$(basename "${buildRelPath}")
if [[ ${baseName} != *-server.jar* ]]; then
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
log "ERROR: mohist build for ${VERSION} is not a valid server jar, found ${baseName}"
log " check https://ci.codemc.io/job/MohistMC/ for available versions"
log " and set VERSION accordingly"
exit 1
@@ -40,4 +40,4 @@ fi
export FAMILY=HYBRID
exec "${SCRIPTS:-$(dirname "$0")}/start-setupWorld" "$@"
exec "${SCRIPTS:-/}start-spiget" "$@"

View File

@@ -15,7 +15,8 @@ fi
: "${PUFFERFISH_BUILD:=lastSuccessfulBuild}"
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${MAJOR_VANILLA_VERSION}/${PUFFERFISH_BUILD}/api/json")
majorVersion=$(get_major_version "$VERSION")
PUFFERFISH_BUILD_JSON=$(curl -X GET -s "https://ci.pufferfish.host/job/Pufferfish-${majorVersion}/${PUFFERFISH_BUILD}/api/json")
# Example: "url": "https://ci.pufferfish.host/job/Pufferfish-1.18/50/",
PUFFERFISH_BUILD_URL=$(jq -n "$PUFFERFISH_BUILD_JSON" | jq -jc '.url // empty' )
# Example: "fileName": "pufferfish-paperclip-1.18.2-R0.1-SNAPSHOT-reobf.jar",

View File

@@ -4,8 +4,6 @@ set -eu
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
requireVar VANILLA_VERSION
export TYPE=QUILT
: "${QUILT_LAUNCHER:=}"
: "${QUILT_LAUNCHER_URL:=}"
: "${QUILT_INSTALLER_URL:=}"
@@ -14,47 +12,50 @@ export TYPE=QUILT
isDebugging && set -x
# Custom quilt jar
resultsFile=/data/.quilt.env
if [[ $QUILT_LAUNCHER ]]; then
export SERVER=${QUILT_LAUNCHER}
# Custom quilt jar url
log "WARNING: use of QUILT_LAUNCHER is a deprecated feature."
SERVER="$QUILT_LAUNCHER"
export SERVER
resolveVersion
export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@"
elif [[ $QUILT_LAUNCHER_URL ]]; then
export SERVER=quilt-server-$(echo -n "$QUILT_LAUNCHER_URL" | mc-image-helper hash)
# Official quilt installer
log "ERROR: QUILT_LAUNCHER_URL is not longer supported. Pre-download and use QUILT_LAUNCHER."
exit 2
elif [[ $QUILT_INSTALLER_URL ]]; then
if ! mc-image-helper install-quilt \
--loader-version="$QUILT_LOADER_VERSION" \
--minecraft-version="$VERSION" \
--output-directory=/data \
--results-file="$resultsFile" \
--installer-url="$QUILT_INSTALLER_URL"; then
log "ERROR: failed to install Quilt given custom installer URL $QUILT_INSTALLER_URL"
exit 2
fi
else
if [[ ${QUILT_INSTALLER_VERSION^^} = LATEST ]]; then
log "Checking Quilt Installer version information."
QUILT_INSTALLER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/maven-metadata.xml)
if ! mc-image-helper install-quilt \
--loader-version="$QUILT_LOADER_VERSION" \
--minecraft-version="$VERSION" \
--output-directory=/data \
--results-file="$resultsFile" \
--installer-version="$QUILT_INSTALLER_VERSION"; then
log "ERROR: failed to install Quilt given installer version $QUILT_INSTALLER_VERSION"
exit 2
fi
if [[ ${QUILT_LOADER_VERSION^^} = LATEST ]]; then
log "Checking Quilt Loader version information."
QUILT_LOADER_VERSION=$(maven-metadata-release https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-loader/maven-metadata.xml)
fi
export INSTALLER=quilt-installer-${QUILT_INSTALLER_VERSION}.jar
export SERVER=quilt-server-${VANILLA_VERSION}-${QUILT_LOADER_VERSION}-launch.jar
export QUILT_INSTALLER_URL="https://maven.quiltmc.org/repository/release/org/quiltmc/quilt-installer/${QUILT_INSTALLER_VERSION}/quilt-installer-${QUILT_INSTALLER_VERSION}.jar"
fi
if [[ ! -e ${SERVER} && ! -z ${QUILT_INSTALLER_URL} ]]; then
log "Downloading and installing $QUILT_INSTALLER_URL ..."
if ! get -o "$INSTALLER" "$QUILT_INSTALLER_URL"; then
log "Failed to download from given location $QUILT_INSTALLER_URL"
exit 2
fi
if ! java -jar ${INSTALLER} install server ${VANILLA_VERSION} ${QUILT_LOADER_VERSION} --install-dir=./ --download-server; then
log "Failed to install $INSTALLER"
exit 2
fi
if ! mv quilt-server-launch.jar ${SERVER}; then
log "Failed to rename $SERVER"
exit 2
fi
fi
if [[ ! -e ${SERVER} ]]; then
log "$SERVER does not exist, cannot launch server!"
exit 1
fi
# grab SERVER, VERSION and export it
set -a
# shellcheck disable=SC1090
source "${resultsFile}"
set +a
export FAMILY=FABRIC
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -1,5 +1,6 @@
#!/bin/bash
# shellcheck source=start-utils
. ${SCRIPTS:-/}start-utils
export TYPE=spongevanilla
@@ -24,20 +25,20 @@ esac
if [ -z $SPONGEVERSION ]; then
log "Choosing Version for Sponge"
if [ "$SPONGEBRANCH" == "stable" ]; then
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version'`
SPONGEVERSION=$(curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.stable.latest.version')
else
SPONGEVERSION=`curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version'`
SPONGEVERSION=$(curl -fsSL https://dl-api.spongepowered.org/v1/org.spongepowered/$TYPE | jq -r '.buildTypes.bleeding.latest.version')
fi
fi
VANILLA_VERSION="$SPONGEVERSION"
export VANILLA_VERSION
VERSION="$SPONGEVERSION"
export VERSION
export SERVER="spongevanilla-$SPONGEVERSION.jar"
if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "Downloading $SERVER ..."
curl -sSL -o $SERVER https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER
curl -sSL -o "$SERVER" "https://repo.spongepowered.org/maven/org/spongepowered/$TYPE/$SPONGEVERSION/$SERVER"
fi
export FAMILY=SPONGE
exec ${SCRIPTS:-/}start-setupWorld "$@"
exec "${SCRIPTS:-/}start-setupWorld" "$@"

View File

@@ -5,18 +5,19 @@
isDebugging && set -x
set -o pipefail
export SERVER="minecraft_server.${VANILLA_VERSION// /_}.jar"
resolveVersion
export SERVER="minecraft_server.${VERSION// /_}.jar"
if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
debug "Finding version manifest for $VANILLA_VERSION"
versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VANILLA_VERSION "$VANILLA_VERSION" --raw-output '[.versions[]|select(.id == $VANILLA_VERSION)][0].url')
debug "Finding version manifest for $VERSION"
versionManifestUrl=$(get 'https://launchermeta.mojang.com/mc/game/version_manifest.json' | jq --arg VERSION "$VERSION" --raw-output '[.versions[]|select(.id == $VERSION)][0].url')
result=$?
if [ $result != 0 ]; then
log "ERROR: failed to obtain version manifest URL ($result)"
exit 1
fi
if [ "$versionManifestUrl" = "null" ]; then
log "ERROR: couldn't find a matching manifest entry for $VANILLA_VERSION"
log "ERROR: couldn't find a matching manifest entry for $VERSION"
exit 1
fi
debug "Found version manifest at $versionManifestUrl"
@@ -25,11 +26,11 @@ if [ ! -e "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
log "ERROR: failed to obtain version manifest from $versionManifestUrl ($result)"
exit 1
elif [ "$serverDownloadUrl" = "null" ]; then
log "ERROR: there is not a server download for version $VANILLA_VERSION"
log "ERROR: there is not a server download for version $VERSION"
exit 1
fi
log "Downloading $VANILLA_VERSION server..."
log "Downloading $VERSION server..."
debug "Downloading server from $serverDownloadUrl"
get -o "$SERVER" "$serverDownloadUrl"
result=$?

View File

@@ -2,6 +2,7 @@
: "${DEBUG_EXEC:=false}"
: "${SETUP_ONLY:=false}"
: "${CUSTOM_JAR_EXEC:=}"
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
@@ -220,12 +221,18 @@ function copyFilesForCurseForge() {
cp -f /data/eula.txt "${FTB_DIR}/"
}
if versionLessThan 1.7; then
if versionLessThan 'b1.8'; then
echo "
DISABLE_HEALTHCHECK=true
" > /data/.mc-health.env
elif versionLessThan 1.7; then
echo "
MC_HEALTH_EXTRA_ARGS=(
--use-server-list-ping
)
" > /data/.mc-health.env
else
rm -f /data/.mc-health.env
fi
mcServerRunnerArgs=(
@@ -295,12 +302,23 @@ else
log "Starting the Minecraft server..."
# Specifically want the variables to expand to args, so...
# shellcheck disable=SC2206
finalArgs=(
$JVM_XX_OPTS
$JVM_OPTS
$expandedDOpts
-jar "$SERVER"
)
if [[ $CUSTOM_JAR_EXEC ]]; then
# shellcheck disable=SC2206
finalArgs+=($CUSTOM_JAR_EXEC)
else
finalArgs+=(-jar "$SERVER")
fi
# shellcheck disable=SC2206
finalArgs+=(
"$@" $EXTRA_ARGS
)

View File

@@ -2,6 +2,8 @@
set -e -o pipefail
: "${VANILLATWEAKS_FILE:=}"
: "${VANILLATWEAKS_SHARECODE:=}"
: "${REMOVE_OLD_DATAPACKS:=false}"
: "${DATAPACKS_FILE:=}"
: "${REMOVE_OLD_DATAPACKS_DEPTH:=1} "
@@ -74,4 +76,12 @@ elif [[ "$DATAPACKS_FILE" ]]; then
fi
fi
exec "${SCRIPTS:-/}start-setupForgeApiMods" "$@"
if [[ ${VANILLATWEAKS_FILE} || ${VANILLATWEAKS_SHARECODE} ]]; then
mc-image-helper vanillatweaks \
--output-directory="/data" \
--world-subdir="${LEVEL:-world}" \
--share-codes="$VANILLATWEAKS_SHARECODE" \
--pack-files="$VANILLATWEAKS_FILE"
fi
exec "${SCRIPTS:-/}start-setupModpack" "$@"

View File

@@ -8,14 +8,14 @@ set -e
: "${REPLACE_ENV_IN_PLACE:=${REPLACE_ENV_VARIABLES:-false}}"
: "${REPLACE_ENV_PATHS:=/data}"
: "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}"
: "${REPLACE_ENV_VARIABLE_PREFIX:=${ENV_VARIABLE_PREFIX:-CFG_}}"
: "${REPLACE_ENV_VARIABLE_PREFIX=${ENV_VARIABLE_PREFIX:-CFG_}}"
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
: "${PATCH_DEFINITIONS:=}"
: "${DEBUG:=false}"
if isTrue "${REPLACE_ENV_IN_PLACE}"; then
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix $REPLACE_ENV_VARIABLE_PREFIX ..."
log "Replacing env variables in ${REPLACE_ENV_PATHS} that match the prefix '$REPLACE_ENV_VARIABLE_PREFIX' ..."
mc-image-helper interpolate \
--replace-env-file-suffixes="${REPLACE_ENV_SUFFIXES}" \

View File

@@ -1,244 +0,0 @@
#!/bin/bash
set -e -o pipefail
: "${MODS_FORGEAPI_KEY:=}"
: "${REMOVE_OLD_FORGEAPI_MODS:=false}"
: "${MODS_FORGEAPI_PROJECTIDS:=}"
: "${MODS_FORGEAPI_FILE:=}"
: "${MODS_FORGEAPI_RELEASES:=RELEASE}"
: "${MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES:=false}"
: "${MODS_FORGEAPI_IGNORE_GAMETYPE:=false}"
: "${REMOVE_OLD_MODS_DEPTH:=1} "
: "${REMOVE_OLD_MODS_INCLUDE:=*.jar,*-version.json}"
# FORGEAPI_BASE_URL used in manifest downloads below
FORGEAPI_BASE_URL=${FORGEAPI_BASE_URL:-https://api.curseforge.com/v1}
RELEASE_NUMBER_FILTER=1
MINECRAFT_GAME_ID=432
FILTER_BY_FAMILY=false
DOWNLOADED_MODIDS=()
out_dir=/data/mods
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
# Remove old mods/plugins
if isTrue "${REMOVE_OLD_FORGEAPI_MODS}"; then
removeOldMods "/data/mods"
fi
# Family filter is on by default for Forge, Fabric, and Bukkit
updateFamilyFilter(){
if isFamily "FORGE" "FABRIC" "BUKKIT"; then
FILTER_BY_FAMILY=true
fi
}
ensureModKey(){
if [ -z "$MODS_FORGEAPI_KEY" ]; then
log "ERROR: MODS_FORGEAPI_KEY REQUIRED to Connect to FORGE API, you supplied: ${MODS_FORGEAPI_KEY}"
exit 2
fi
}
# Set the global release type per the text.
# NOTE: downcasing release type for comparing types.
updateReleaseNumber(){
releaseType=$1
if [ "release" = "${releaseType,,}" ] || [ 1 = "${releaseType,,}" ]; then
RELEASE_NUMBER_FILTER=1
elif [ "beta" = "${releaseType,,}" ] || [ 2 = "${releaseType,,}" ]; then
RELEASE_NUMBER_FILTER=2
elif [ "alpha" = "${releaseType,,}" ] || [ 3 = "${releaseType,,}" ]; then
RELEASE_NUMBER_FILTER=3
fi
}
retrieveVersionTypeNumber(){
VERSION_NAME="Minecraft ${MAJOR_VANILLA_VERSION}"
minecraft_types=$(curl -X GET -s \
"${FORGEAPI_BASE_URL}/games/${MINECRAFT_GAME_ID}/version-types" \
-H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'')
if [ ! "$minecraft_types" ]; then
log "ERROR: unable to retrieve version types for ${VERSION_NAME} from ForgeAPI. Check Forge API key or supplied Minecraft version"
exit 2
fi
TYPE_ID=$(jq -n "$minecraft_types" | jq --arg VERSION_NAME "$VERSION_NAME" -jc '
.data[]? | select(.name==$VERSION_NAME) | .id')
if [ ! "$TYPE_ID" ]; then
log "ERROR: unable to retrieve version types for ${VERSION_NAME} from ForgeAPI"
exit 2
fi
}
modFileByProjectID(){
project_id=$(echo "$1" | tr -d '"')
project_id_release_type=$2
project_id_file_name=$3
unset PROJECT_FILE
# if Type id isn't defined use minecraft version to go get it.
if [ ! "$TYPE_ID" ]; then
retrieveVersionTypeNumber
fi
# JQ is struggling with larger page sizes so having to pagination for mods with a lot of releases
pageSize=42
index=0
total_count=1
while [ $index -lt $total_count ]; do
project_files=$(curl -X GET -s \
"${FORGEAPI_BASE_URL}/mods/${project_id}/files?gameVersionTypeId=${TYPE_ID}&index=${index}&pageSize=${pageSize}" \
-H 'Accept: application/json' -H 'x-api-key: '${MODS_FORGEAPI_KEY}'')
if [ ! "$project_files" ]; then
log "ERROR: unable to retrieve any project id files for ${project_id} from ForgeAPI"
exit 2
fi
# Use project files to grab out the total count of mods.
total_count=$(jq -n "$project_files" | jq -c '.pagination.totalCount' )
# Checking for a individual release type input, if not use global
if [ "$project_id_release_type" ]; then
updateReleaseNumber "$project_id_release_type"
unset project_id_release_type
else
updateReleaseNumber $MODS_FORGEAPI_RELEASES
fi
# grabs the highest ID of the releaseTypes selected.
# Default is 1 for Release, Beta is 2, and Alpha is 3. Using less than we can validate highest release.
if [ "$project_id_file_name" ]; then
# Looks for file by name
current_project_file=$(jq -n "$project_files" | jq --arg FILE_NAME "$project_id_file_name" -jc '
.data | map(select(.fileName<=($FILE_NAME))) | .[0] // empty')
elif isFalse "${MODS_FORGEAPI_IGNORE_GAMETYPE}" && $FILTER_BY_FAMILY ; then
# Looks for file by version and server type in lowercase
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" --arg GAME_TYPE "${FAMILY,,}" --arg VERSION "$VANILLA_VERSION" -jc '
.data | sort_by(.id) | reverse | map(select(.gameVersions[] | ascii_downcase | contains ($GAME_TYPE))) | map(select(.gameVersions[] | contains ($VERSION))) | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
else
# Looks for file by version only.
current_project_file=$(jq -n "$project_files" | jq --arg RELEASE_FILTER "$RELEASE_NUMBER_FILTER" --arg VERSION "$VANILLA_VERSION" -jc '
.data | sort_by(.id) | reverse | map(select(.gameVersions[] | contains ($VERSION))) | map(select(.releaseType<=($RELEASE_FILTER|tonumber))) | .[0] // empty')
fi
# Logic to grab the latest release over the entire pagination
if [ ! "$PROJECT_FILE" ]; then
PROJECT_FILE=$current_project_file
elif [ "$current_project_file" ]; then
current_project_file_id=$(jq -n "$current_project_file" | jq -jc '.id // empty' )
PROJECT_FILE_ID=$(jq -n "$PROJECT_FILE" | jq -jc '.id // empty' )
if (( current_project_file_id > PROJECT_FILE_ID )); then
PROJECT_FILE=$current_project_file
fi
fi
# check to see if we have gone to far or lost our index and exit with an error
if [ -z "$index" ] || [ -z "$total_count" ] || [ $index -ge "$total_count" ]; then
log "ERROR: Unable to retrieve any files for ${project_id} from ForgeAPI also Validate files have release type associated with no. ${RELEASE_NUMBER_FILTER}"
exit 2
fi
# Increment start index to new set.
index=$((index + pageSize))
done
if [ ! "$PROJECT_FILE" ]; then
log "ERROR: Unable to retrieve any files for ${project_id}, Release Type: ${RELEASE_NUMBER_FILTER}, FAMILY_TYPE: ${FAMILY,,}"
exit 2
fi
}
downloadModPackfromModFile() {
if [ ! "$PROJECT_FILE" ]; then
log "ERROR: Project File not found from the ForgeAPI"
exit 2
fi
# trys to make the output directory incase it doesnt exist.
mkdir -p "$out_dir"
debug "DEBUG: PROJECT_FILE: ${PROJECT_FILE}"
# grabs needed values from our json return
file_name=$(jq -n "$PROJECT_FILE" | jq -jc '.fileName // empty' )
download_url=$(jq -n "$PROJECT_FILE" | jq -jc '.downloadUrl // empty' )
mod_id=$(jq -n "$PROJECT_FILE" | jq -jc '.modId // empty' )
if [ ! -f "${out_dir}/${file_name}" ]; then
echo "Downloading ${download_url}"
# Track the mods we have downloaded.
DOWNLOADED_MODIDS+=("${mod_id}")
if ! get --skip-up-to-date -o "${out_dir}/${file_name}" "${download_url}"; then
log "ERROR: failed to download from ${download_url}"
exit 2
fi
fi
}
downloadDependencies(){
if [ "$PROJECT_FILE" ]; then
dependencies=$(jq -n "$PROJECT_FILE" | jq -jc '.dependencies' )
required_dependencies=$(jq -n "$dependencies" | jq --arg REQUIRED_FILTER "3" -jc '
map(select(.relationType==($REQUIRED_FILTER|tonumber)))')
if [ "$required_dependencies" ]; then
while read -r current_dependency; do
mod_id=$(jq -n "$current_dependency" | jq -jc '.modId' )
# Validate we have not tried to download the mod yet.
if [[ ! "${DOWNLOADED_MODIDS[*]}" =~ $mod_id ]]; then
modFileByProjectID "$mod_id" "release"
downloadModPackfromModFile
fi
# needs to be piped in to keep look in main process
done < <(jq -n "$required_dependencies" | jq -c '.[]?')
fi
fi
}
# Use forge api json file to filter and download the correct mods
if [ "$MODS_FORGEAPI_FILE" ] && [ -z "$MODS_FORGEAPI_PROJECTIDS" ]; then
ensureModKey
updateFamilyFilter
if [ ! -f "$MODS_FORGEAPI_FILE" ]; then
log "ERROR: given MODS_FORGEAPI_FILE file does not exist"
exit 2
fi
debug "DEBUG: MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_FILE}"
# Needs loop here to look up release types befor calling download.
while read -r current_project; do
debug "DEBUG: current_project: ${current_project}"
# Per stack overflow we can use //empty to return empty string that works with -z
project_id=$(jq -n "$current_project" | jq -r '.projectId // empty' )
current_release_type=$(jq -n "$current_project" | jq -r '.releaseType // empty' )
current_file_name=$(jq -n "$current_project" | jq -r '.fileName // empty' )
# Validate we have not tried to download the mod yet.
if [[ ! "${DOWNLOADED_MODIDS[*]}" =~ $project_id ]]; then
modFileByProjectID "$project_id" "$current_release_type" "$current_file_name"
downloadModPackfromModFile
if isTrue "${MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES}"; then
downloadDependencies
fi
fi
# needs to be piped in to keep look in main process
done < <(jq -c '.[]?' $MODS_FORGEAPI_FILE)
fi
# Use only project ids and global release data.
if [ "$MODS_FORGEAPI_PROJECTIDS" ] && [ -z "$MODS_FORGEAPI_FILE" ]; then
ensureModKey
updateFamilyFilter
for project_id in ${MODS_FORGEAPI_PROJECTIDS//,/ }; do
# Validate we have not tried to download the mod yet.
if [[ ! "${DOWNLOADED_MODIDS[*]}" =~ $project_id ]]; then
modFileByProjectID $project_id
downloadModPackfromModFile
if isTrue "${MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES}"; then
downloadDependencies
fi
fi
done
fi
exec "${SCRIPTS:-/}start-setupModpack" "$@"

View File

@@ -143,51 +143,6 @@ function handleListings() {
fi
}
function handleCurseForgeManifest() {
if [[ "$MANIFEST" ]]; then
if [[ -e "$MANIFEST" ]]; then
EFFECTIVE_MANIFEST_FILE=$MANIFEST
elif isURL "$MANIFEST"; then
EFFECTIVE_MANIFEST_FILE=/tmp/manifest.json
EFFECTIVE_MANIFEST_URL=$(curl -Ls -o /dev/null -w "%{effective_url}" "$MANIFEST")
curl -Ls -o $EFFECTIVE_MANIFEST_FILE "$EFFECTIVE_MANIFEST_URL"
else
log "MANIFEST='$MANIFEST' is not a valid manifest url or location"
exit 2
fi
case "X$EFFECTIVE_MANIFEST_FILE" in
X*.json)
if [ -f "${EFFECTIVE_MANIFEST_FILE}" ]; then
MOD_DIR=${FTB_BASE_DIR:-/data}/mods
if [ ! -d "$MOD_DIR" ]
then
log "Creating mods dir $MOD_DIR"
mkdir -p "$MOD_DIR"
fi
log "Starting manifest download..."
jq -r '.files[] | (.projectID|tostring) + " " + (.fileID|tostring)' "${EFFECTIVE_MANIFEST_FILE}" | while read -r p f
do
if [ ! -f $MOD_DIR/${p}_${f}.jar ]
then
redirect_url="$(curl -Ls -o /dev/null -w "%{effective_url}" "${CURSE_URL_BASE}/${p}")"
url="$redirect_url/download/${f}/file"
log Downloading curseforge mod $url
# Manifest usually doesn't have mod names. Using id should be fine, tho
curl -sSL "${url}" -o $MOD_DIR/${p}_${f}.jar
fi
done
else
log "Could not find manifest file, insufficient privileges, or malformed path."
fi
;;
*)
log "Invalid manifest file for modpack. Please make sure it is a .json file."
;;
esac
fi
}
function handleGenericPacks() {
: "${GENERIC_PACKS:=${GENERIC_PACK}}"
: "${GENERIC_PACKS_PREFIX:=}"
@@ -289,23 +244,58 @@ function handleModrinthProjects() {
mc-image-helper modrinth \
--output-directory=/data \
--projects="${MODRINTH_PROJECTS}" \
--game-version="${VANILLA_VERSION}" \
--game-version="${VERSION}" \
--loader="$loader" \
--download-optional-dependencies="$MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES" \
--allowed-version-type="$MODRINTH_ALLOWED_VERSION_TYPE"
fi
}
function handleCurseForgeFiles() {
args=()
if usesMods && ! usesPlugins; then
args+=(--default-category mc-mods)
elif usesPlugins && ! usesMods; then
args+=(--default-category bukkit-plugins)
fi
case "${TYPE,,}" in
forge|fabric|quilt)
args+=(--mod-loader "$TYPE")
;;
esac
# shellcheck disable=SC2086
# since we want CURSEFORGE_FILES to expand
mc-image-helper curseforge-files \
"${args[@]}" \
${CURSEFORGE_FILES}
}
handlePackwiz
handleModpackZip
handleListings
handleCurseForgeManifest
if [[ $MANIFEST ]]; then
log "ERROR: MANIFEST is no longer supported."
log " Use MOD_PLATFORM=AUTO_CURSEFORGE and CF_MODPACK_MANIFEST instead"
exit 1
fi
if [[ $MODS_FORGEAPI_KEY || $MODS_FORGEAPI_FILE || $MODS_FORGEAPI_PROJECTIDS ]]; then
log "ERROR the MODS_FORGEAPI_FILE / MODS_FORGEAPI_PROJECTIDS feature is no longer supported"
log " Use CURSEFORGE_FILES instead."
exit 1
fi
handleGenericPacks
handleModrinthProjects
if usesMods || usesPlugins; then
handleCurseForgeFiles
fi
exec "${SCRIPTS:-/}start-setupModconfig" "$@"

View File

@@ -6,7 +6,7 @@
: "${SYNC_SKIP_NEWER_IN_DESTINATION:=${PLUGINS_SYNC_UPDATE:-true}}"
: "${REPLACE_ENV_DURING_SYNC:=true}"
: "${REPLACE_ENV_SUFFIXES:=yml,yaml,txt,cfg,conf,properties,hjson,json,tml,toml}"
: "${REPLACE_ENV_VARIABLE_PREFIX:=${ENV_VARIABLE_PREFIX:-CFG_}}"
: "${REPLACE_ENV_VARIABLE_PREFIX=${ENV_VARIABLE_PREFIX:-CFG_}}"
: "${REPLACE_ENV_VARIABLES_EXCLUDES:=}"
: "${REPLACE_ENV_VARIABLES_EXCLUDE_PATHS:=}"
: "${DEBUG:=false}"

View File

@@ -1,98 +1,87 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
: "${EXISTING_OPS_FILE:=SKIP}"
: "${EXISTING_WHITELIST_FILE:=SKIP}"
if [[ -v APPEND_OPS ]] && isTrue "${APPEND_OPS}"; then
EXISTING_OPS_FILE=MERGE
elif [[ -v OVERRIDE_OPS ]] && isTrue "${OVERRIDE_OPS}"; then
EXISTING_OPS_FILE=SYNCHRONIZE
fi
if [[ -v APPEND_WHITELIST ]] && isTrue "${APPEND_WHITELIST}"; then
EXISTING_WHITELIST_FILE=MERGE
elif [[ -v OVERRIDE_WHITELIST ]] && isTrue "${OVERRIDE_WHITELIST}"; then
EXISTING_WHITELIST_FILE=SYNCHRONIZE
fi
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
isDebugging && set -x
if versionLessThan 1.7.6; then
opsFile=ops.txt
whitelistFile=white-list.txt
else
opsFile=ops.json
whitelistFile=whitelist.json
sharedArgs=(--version="$VERSION")
if isFalse "${ONLINE_MODE:-true}"; then
sharedArgs+=( --offline )
fi
function process_user_file() {
local output=$1
local source=$2
if isURL "$source"; then
log "Downloading $output from $source"
if ! get -o "/data/$output" "$source"; then
log "ERROR: failed to download from $source"
exit 2
fi
else
log "Copying $output from $source"
if ! cp "$source" "/data/$output"; then
log "ERROR: failed to copy from $source"
exit 1
fi
if [[ -v OPS_FILE ]]; then
existing="$EXISTING_OPS_FILE"
if [[ "$EXISTING_OPS_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=SYNCHRONIZE
fi
}
function process_user_csv() {
local output=$1
local list=$2
local playerDataList
if [[ "$output" == *"ops"* ]]; then
# Extra data for ops.json
userData='{"uuid": .id, "name": .username, "level": 4}'
else
userData='{"uuid": .id, "name": .username}'
mc-image-helper manage-users \
"${sharedArgs[@]}" \
--type=JAVA_OPS \
--input-is-file \
--existing="${existing}" \
"$OPS_FILE"
fi
if [[ -v OPS ]]; then
args=()
if isTrue "${APPEND_OPS:-false}" || isFalse "${OVERRIDE_OPS:-true}"; then
args+=(--append-only)
fi
log "Updating ${output%.*}"
for i in ${list//,/ }
do
if [ -e "$output" ] && grep -q "$i" "$output"; then
log "$i already present in $output, skipping"
continue
fi
if ! playerData=$(get "https://playerdb.co/api/player/minecraft/$i" | jq -re ".data.player"); then
log "WARNING: Could not lookup user $i for ${output} addition"
else
playerDataList=$playerDataList$(echo "$playerData" | jq -r "$userData")
fi
done
local newUsers=$(echo "$playerDataList" | jq -s .)
if [[ $output =~ .*\.txt ]]; then
# username list for txt config (Minecraft <= 1.7.5)
echo $newUsers | jq -r '.[].name' >> "/data/${output}"
sort -u /data/${output} -o /data/${output}
elif [ -e /data/${output} ]; then
# Merge with existing json file
local currentUsers=$(cat "/data/${output}")
jq --argjson current "$currentUsers" --argjson new "$newUsers" -n '$new + $current | unique_by(.uuid)' > "/data/${output}"
else
# New json file
echo $newUsers > "/data/${output}"
existing="$EXISTING_OPS_FILE"
if [[ "$EXISTING_OPS_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=MERGE
fi
}
if isTrue "${OVERRIDE_OPS}"; then
log "Recreating ${opsFile} file at server startup"
rm -f /data/${opsFile}
fi
if [ -n "${OPS_FILE}" ] && [ ! -e "/data/${opsFile}" ]; then
process_user_file ${opsFile} "$OPS_FILE"
fi
if [ -n "${OPS}" ]; then
process_user_csv ${opsFile} "$OPS"
# shellcheck disable=SC2086
mc-image-helper manage-users \
"${sharedArgs[@]}" "${args[@]}" \
--type=JAVA_OPS \
--existing="${existing}" \
$OPS
fi
if isTrue "${OVERRIDE_WHITELIST}"; then
log "Recreating ${whitelistFile} file at server startup"
rm -f /data/${whitelistFile}
if [[ -v WHITELIST_FILE ]]; then
existing="$EXISTING_WHITELIST_FILE"
if [[ "$EXISTING_WHITELIST_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=SYNCHRONIZE
fi
mc-image-helper manage-users \
"${sharedArgs[@]}" \
--type=JAVA_WHITELIST \
--input-is-file \
--existing="${existing}" \
"$WHITELIST_FILE"
fi
if [ -n "${WHITELIST_FILE}" ] && [ ! -e "/data/${whitelistFile}" ]; then
process_user_file ${whitelistFile} "$WHITELIST_FILE"
if [[ -v WHITELIST ]]; then
args=()
if isTrue "${APPEND_WHITELIST:-false}" || isFalse "${OVERRIDE_WHITELIST:-true}"; then
args+=(--append-only)
fi
existing="$EXISTING_WHITELIST_FILE"
if [[ "$EXISTING_WHITELIST_FILE" = SYNC_FILE_MERGE_LIST ]]; then
existing=MERGE
fi
# shellcheck disable=SC2086
mc-image-helper manage-users \
"${sharedArgs[@]}" "${args[@]}" \
--type=JAVA_WHITELIST \
--existing="${existing}" \
$WHITELIST
fi
if [ -n "${WHITELIST}" ]; then
process_user_csv ${whitelistFile} "$WHITELIST"
fi
exec "${SCRIPTS:-/}start-finalExec" "$@"

View File

@@ -1,19 +0,0 @@
#!/bin/bash
set -e -o pipefail
: "${VANILLATWEAKS_FILE:=}"
: "${VANILLATWEAKS_SHARECODE:=}"
# shellcheck source=start-utils
. "${SCRIPTS:-/}start-utils"
if [[ ${VANILLATWEAKS_FILE} || ${VANILLATWEAKS_SHARECODE} ]]; then
mc-image-helper vanillatweaks \
--output-directory="/data" \
--world-subdir="${LEVEL:-world}" \
--share-codes="$VANILLATWEAKS_SHARECODE" \
--pack-files="$VANILLATWEAKS_FILE"
fi
exec "${SCRIPTS:-/}start-setupDatapack" "$@"

View File

@@ -48,7 +48,7 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
count=$(echo "$baseDirs" | wc -l)
if [[ $count -gt 1 ]]; then
baseDirsNoSpigotSuffix=$(echo "$baseDirs" | sed -re 's:(_nether|_the_end)/?$::' | sort -u)
if [ $(echo "$baseDirsNoSpigotSuffix" | wc -l) -eq 1 ]; then
if [ "$(echo "$baseDirsNoSpigotSuffix" | wc -l)" -eq 1 ]; then
baseDir="$baseDirsNoSpigotSuffix"
baseName=$(basename "$baseDir")
log "Found Spigot naming conventions, taking $baseName as main dimension"
@@ -123,4 +123,4 @@ if [[ "$WORLD" ]] && ( isTrue "${FORCE_WORLD_COPY}" || [ ! -d "$worldDest" ] );
fi
fi
exec "${SCRIPTS:-/}start-setupVanillaTweaks" "$@"
exec "${SCRIPTS:-/}start-setupDatapack" "$@"

View File

@@ -163,7 +163,7 @@ function normalizeMemSize() {
function versionLessThan() {
# Use if-else since strict mode might be enabled
if mc-image-helper compare-versions "${VANILLA_VERSION}" lt "${1?}"; then
if mc-image-helper compare-versions "${VERSION}" lt "${1?}"; then
return 0
else
return 1
@@ -208,14 +208,17 @@ eula=${EULA,,}
function removeOldMods {
if [ -d "$1" ]; then
log "Removing old mods including:${REMOVE_OLD_MODS_INCLUDE} excluding:${REMOVE_OLD_MODS_EXCLUDE}"
mc-image-helper find \
--delete \
--type file,directory \
--min-depth=1 --max-depth "${REMOVE_OLD_MODS_DEPTH:-16}" \
--name "${REMOVE_OLD_MODS_INCLUDE:-*}" \
--exclude-name "${REMOVE_OLD_MODS_EXCLUDE:-}" \
--quiet \
"$1"
args=(
--delete
--type file
--min-depth=1 --max-depth "${REMOVE_OLD_MODS_DEPTH:-16}"
--name "${REMOVE_OLD_MODS_INCLUDE:-*}"
--exclude-name "${REMOVE_OLD_MODS_EXCLUDE:-}"
)
if ! isDebugging; then
args+=(--quiet)
fi
mc-image-helper find "${args[@]}" "$1"
fi
}
@@ -320,4 +323,28 @@ function usesPlugins() {
return 0
esac
return 1
}
function resolveVersion() {
givenVersion="$VERSION"
# shellcheck disable=SC2153
if ! VERSION=$(mc-image-helper resolve-minecraft-version "$VERSION"); then
exit 2
fi
log "Resolved version given ${givenVersion} into ${VERSION}"
}
function resolveFamily() {
case "$TYPE" in
PAPER|SPIGOT|BUKKIT|CANYON|PUFFERFISH|PURPUR)
FAMILY=SIGOT
;;
FORGE)
FAMILY=FORGE
;;
FABRIC|QUILT)
FAMILY=FABRIC
;;
esac
export FAMILY
}

View File

@@ -6,7 +6,7 @@ services:
environment:
EULA: "true"
SETUP_ONLY: "TRUE"
TYPE: AUTO_CURSEFORGE
MOD_PLATFORM: AUTO_CURSEFORGE
CF_API_KEY: ${CF_API_KEY}
CF_SLUG: the-pixelmon-modpack
CF_FILENAME_MATCHER: "9.1.2"

View File

@@ -0,0 +1,22 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
TYPE: FABRIC
VERSION: 1.18.2
# Contains mix of Forge and Fabric mods
CURSEFORGE_FILES: |
https://www.curseforge.com/minecraft/mc-mods/clumps/files/4153343
jei
306612
@/extras/listing.txt
CF_API_KEY: ${CF_API_KEY}
volumes:
- ./data:/data
- ./fake.jar:/servers/fake.jar:ro
- ./listing.txt:/extras/listing.txt:ro

View File

@@ -0,0 +1 @@
architectury-api@4.11.93

View File

@@ -0,0 +1 @@
[[ $CF_API_KEY ]] || exit 1

View File

@@ -0,0 +1,5 @@
mc-image-helper assert fileExists "/data/mods/architectury-*-fabric.jar"
mc-image-helper assert fileExists "/data/mods/Clumps-fabric-*.jar"
mc-image-helper assert fileExists "/data/mods/fabric-api-*.jar"
mc-image-helper assert fileExists "/data/mods/jei-*-fabric-*.jar"

View File

@@ -0,0 +1 @@
[[ $EXTENDED_TESTS ]] || exit 1

View File

@@ -0,0 +1 @@
[[ $EXTENDED_TESTS ]] || exit 1

View File

@@ -1,27 +0,0 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
DEBUG: "FALSE"
# Using custom to bypass Fabric setup
TYPE: CUSTOM
# Using family to test FORGEAPI Family filter.
FAMILY: FABRIC
CUSTOM_SERVER: /servers/fake.jar
VERSION: 1.18.2
MODS_FORGEAPI_FILE: /config/forgeapi_mods.json
# Key is passed by Github Workflow
# This should be coming from github secrets.
MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_KEY}
REMOVE_OLD_FORGEAPI_MODS: "TRUE"
# Validates that Fabric API gets download as a dependency.
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "TRUE"
volumes:
- ./forgeapi_mods.json:/config/forgeapi_mods.json:ro
- ./data:/data
- ./fake.jar:/servers/fake.jar

View File

@@ -1,11 +0,0 @@
[
{
"name": "Flan (Land Claim Tool)",
"projectId": "404578"
},
{
"name": "Fabric Voice Mod",
"projectId": "416089",
"releaseType": "beta"
}
]

View File

@@ -1,2 +0,0 @@
[[ $MINECRAFT_VERSION == LATEST ]] || exit 1
[[ $MODS_FORGEAPI_KEY ]] || exit 1

View File

@@ -1,5 +0,0 @@
# Validates specific beta call out for specific mod:
mc-image-helper assert fileExists "/data/mods/voicechat-fabric*"
mc-image-helper assert fileExists "/data/mods/flan*"
# Dependent of flan:
mc-image-helper assert fileExists "/data/mods/fabric-api*"

View File

@@ -1,30 +0,0 @@
version: "3"
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
DEBUG: "FALSE"
# Using custom to bypass Fabric setup
TYPE: CUSTOM
# Using family to test FORGEAPI Family filter.
FAMILY: FABRIC
CUSTOM_SERVER: /servers/fake.jar
VERSION: 1.18.2
# Validate Skip Gametype Filter:
MODS_FORGEAPI_IGNORE_GAMETYPE: "TRUE"
# Validates that Biomes does not download terrablender
# Using default false for testing:
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "FALSE"
# Contains mix of Forge and Fabric mods
MODS_FORGEAPI_PROJECTIDS: 416089,493246
# Allows for Beta releases of 416089 the Fabric Voice Mod
MODS_FORGEAPI_RELEASES: BETA
MODS_FORGEAPI_KEY: ${MODS_FORGEAPI_KEY}
REMOVE_OLD_FORGEAPI_MODS: "TRUE"
volumes:
- ./data:/data
- ./fake.jar:/servers/fake.jar

View File

@@ -1,2 +0,0 @@
[[ $MINECRAFT_VERSION == LATEST ]] || exit 1
[[ $MODS_FORGEAPI_KEY ]] || exit 1

Some files were not shown because too many files have changed in this diff Show More