2020-06-19 20:34:56 +00:00
## Adding a server type
Adding a new server `TYPE` can vary due to the complexity of obtaining and configuring each type; however, the addition of any server type includes at least the following steps:
2023-05-28 18:18:32 +00:00
1. Copy an existing "start-deploy*" script, such as [start-deployFabric ](https://github.com/itzg/docker-minecraft-server/blob/master/scripts/start-deployFabric ) and rename it accordingly making sure to retain the "start-deploy" prefix
2021-09-16 02:27:48 +00:00
2. Modify the type-specific behavior between the "start-utils" preamble and the hand-off to `start-setupWorld` at the end of the script
2020-06-19 20:34:56 +00:00
3. Develop and test the changes using the [iterative process described below ](#iterative-script-development )
2023-05-28 18:18:32 +00:00
4. Add a case-entry to the `case "${TYPE^^}"` in [start-configuration ](https://github.com/itzg/docker-minecraft-server/blob/master/scripts/start-configuration )
5. Add a section to the [docs ](https://github.com/itzg/docker-minecraft-server/tree/master/docs ). It is recommended to copy-modify an existing section to retain a similar wording and level of detail
2020-06-19 20:34:56 +00:00
6. [Submit a pull request ](https://github.com/itzg/docker-minecraft-server/pulls )
## Iterative script development
Individual scripts can be iteratively developed, debugged, and tested using the following procedure.
2020-06-19 16:05:32 +00:00
First, build a baseline of the image to include the packages needed by existing or new scripts:
2022-02-09 01:24:38 +00:00
PowerShell: (Example of building and testing ForgeAPI)
2022-02-06 18:45:25 +00:00
```powershell
2022-02-09 01:24:38 +00:00
$env:FOLDER_TO_TEST="forgeapimods_projectids"
2022-02-06 18:45:25 +00:00
$env:IMAGE_TO_TEST="mc-dev"
docker build -t $env:IMAGE_TO_TEST .
2022-02-09 01:24:38 +00:00
pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/"
2022-02-06 18:45:25 +00:00
docker-compose run mc
2022-02-24 18:18:49 +00:00
docker-compose down -v --remove-orphans
2022-02-06 18:45:25 +00:00
popd
```
2022-02-24 18:18:49 +00:00
PowerShell: Building different images of Java for testing
```powershell
$env:BASE_IMAGE='eclipse-temurin:8u312-b07-jre'
$env:IMAGE_TO_TEST="mc-dev"
docker build --build-arg BASE_IMAGE=$env:BASE_IMAGE -t $env:IMAGE_TO_TEST .
```
2022-02-09 01:24:38 +00:00
Bash: (Example of building and testing ForgeAPI)
2022-02-06 18:45:25 +00:00
```bash
2022-02-09 01:24:38 +00:00
export FOLDER_TO_TEST="forgeapimods_file"
export IMAGE_TO_TEST="mc-dev"
2022-02-06 18:45:25 +00:00
docker build -t $IMAGE_TO_TEST .
2022-02-09 01:24:38 +00:00
pushd tests/setuponlytests/$FOLDER_TO_TEST/
2022-02-06 18:45:25 +00:00
docker-compose run mc
2022-02-24 18:18:49 +00:00
docker-compose down -v --remove-orphans
2022-02-06 18:45:25 +00:00
popd
2020-06-19 16:05:32 +00:00
```
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
```shell script
2020-06-20 20:28:21 +00:00
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev
2020-06-19 16:05:32 +00:00
```
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
2023-06-17 18:00:22 +00:00
export VERSION=1.12.2
2020-06-19 16:05:32 +00:00
/scripts/start-magma
```
...or pre-pending script execution:
```shell script
2023-06-17 18:00:22 +00:00
VERSION=1.12.2 /scripts/start-magma
2020-06-19 16:05:32 +00:00
```
> 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.
2020-06-19 20:34:56 +00:00
2021-10-15 23:42:44 +00:00
## Using development copy of mc-image-helper
In the cloned copy of [`mc-image-helper` ](https://github.com/itzg/mc-image-helper ), create an up-to-date snapshot build of the tgz distribution using:
```shell
./gradlew distTar
```
2023-06-13 14:29:50 +00:00
!!! note
The distribution's version will be `0.0.0-<branch>-SNAPSHOT`
Assuming Java 18 or newer:
2021-10-15 23:42:44 +00:00
```shell
2023-06-13 14:29:50 +00:00
cd build/distributions
jwebserver -b 0.0.0.0 -p 8008
2021-10-15 23:42:44 +00:00
```
2023-09-09 13:37:46 +00:00
If `jwebserver` is not available, try `java -m jdk.httpserver`
2021-10-15 23:42:44 +00:00
```shell
--build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT \
2023-06-13 14:29:50 +00:00
--build-arg MC_HELPER_BASE_URL=http://host.docker.internal:8008
2021-10-15 23:42:44 +00:00
```
2022-06-30 03:17:23 +00:00
Now the image can be built like normal, and it will install mc-image-helper from the locally built copy.
2021-10-15 23:42:44 +00:00
2020-06-19 21:09:09 +00:00
## Generating release notes
The following git command can be used to provide the bulk of release notes content:
```shell script
2021-11-17 00:49:48 +00:00
git log --invert-grep --grep "^ci:" --grep "^misc:" --grep "^docs:" --pretty="* %s" 1.1.0..1.2.0
2020-06-19 21:09:09 +00:00
```