diff --git a/compose-dev.yml b/compose-dev.yml new file mode 100644 index 00000000..d60a2ab4 --- /dev/null +++ b/compose-dev.yml @@ -0,0 +1,15 @@ +services: + mc-dev: + build: + context: . + environment: + EULA: true + volumes: + - ./scripts:/image/scripts:ro + - data:/data + ports: + - "25565:25565" + stdin_open: true + tty: true +volumes: + data: \ No newline at end of file diff --git a/docs/misc/contributing/development.md b/docs/misc/contributing/development.md index fba2d468..906477a5 100644 --- a/docs/misc/contributing/development.md +++ b/docs/misc/contributing/development.md @@ -11,61 +11,15 @@ Adding a new server `TYPE` can vary due to the complexity of obtaining and confi ## Iterative script development -Individual scripts can be iteratively developed, debugged, and tested using the following procedure. - -First, build a baseline of the image to include the packages needed by existing or new scripts: - -PowerShell: (Example of building and testing ForgeAPI) -```powershell -$env:FOLDER_TO_TEST="forgeapimods_projectids" -$env:IMAGE_TO_TEST="mc-dev" -docker build -t $env:IMAGE_TO_TEST . -pushd "tests/setuponlytests/$env:FOLDER_TO_TEST/" -docker compose run mc -docker compose down -v --remove-orphans -popd -``` - -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 . -``` - -Bash: (Example of building and testing ForgeAPI) -```bash -export FOLDER_TO_TEST="forgeapimods_file" -export IMAGE_TO_TEST="mc-dev" -docker build -t $IMAGE_TO_TEST . -pushd tests/setuponlytests/$FOLDER_TO_TEST/ -docker compose run mc -docker compose down -v --remove-orphans -popd -``` - -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. +The included `compose-dev.yml` will mount the local `scripts` code into the container and allow for iterative development. Replace `[-e key=value]` with any environment variables you wish to set for testing the modified scripts. ```shell -docker run -it --rm -v ${PWD}:/image/scripts --entrypoint bash mc-dev +docker compose -f compose-dev.yml run --rm -it [-e key=value] mc-dev ``` -From within the container you can run individual scripts via the attached `/image/scripts/` path; however, be sure to set any environment variables expected by the scripts by either `export`ing them manually: +!!! tip -```shell -export VERSION=1.12.2 -/image/scripts/start-deployFabric -``` - -...or pre-pending script execution: - -```shell -VERSION=1.12.2 /image/scripts/start-deployFabric -``` - -!!! 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. + To speed up the development cycle, it is recommended to set `SETUP_ONLY` to `true` as part of the run command above. ## Using development copy of tools diff --git a/scripts/start-deployAutoCF b/scripts/start-deployAutoCF old mode 100644 new mode 100755 diff --git a/scripts/start-deployFolia b/scripts/start-deployFolia old mode 100644 new mode 100755 diff --git a/scripts/start-deployGTNH b/scripts/start-deployGTNH old mode 100644 new mode 100755 index c59c2f9a..6b4a0605 --- a/scripts/start-deployGTNH +++ b/scripts/start-deployGTNH @@ -8,7 +8,7 @@ function getGTNHdownloadPath(){ gtnh_download_path="" current_java_version=$(mc-image-helper java-release) - if ! packs_data="$(curl -sfL 'http://downloads.gtnewhorizons.com/ServerPacks/?raw')"; then + if ! packs_data="$(restify --tag=a https://www.gtnewhorizons.com/version-history/ | jq -r '.[].href | select(test("Server"))')"; then logError "Failed to retrieve data from http://downloads.gtnewhorizons.com/ServerPacks/?raw" exit 1 fi diff --git a/scripts/start-deployLeaf b/scripts/start-deployLeaf old mode 100644 new mode 100755 diff --git a/scripts/start-deployModrinth b/scripts/start-deployModrinth old mode 100644 new mode 100755 diff --git a/scripts/start-deployNeoForge b/scripts/start-deployNeoForge old mode 100644 new mode 100755 diff --git a/scripts/start-deployPoseidon b/scripts/start-deployPoseidon old mode 100644 new mode 100755 diff --git a/scripts/start-rconcmds b/scripts/start-rconcmds old mode 100644 new mode 100755 diff --git a/scripts/start-setupRbac b/scripts/start-setupRbac old mode 100644 new mode 100755