mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
Enabled iterative development with SCRIPTS var
This commit is contained in:
parent
2b7f923865
commit
f5dde77efe
28
DEVELOPMENT.md
Normal file
28
DEVELOPMENT.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Individual scripts can be iteratively developed and tested using the following procedure.
|
||||||
|
|
||||||
|
First, build a baseline of the image to include the packages needed by existing or new scripts:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
docker build -t mc-dev .
|
||||||
|
```
|
||||||
|
|
||||||
|
Using the baseline image, an interactive container can be started to iteratively run the scripts to be developed. By attaching the current workspace directory, you can use the local editor of your choice to iteratively modify scripts while using the container to run them.
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
docker run -it --rm -v ${PWD}:/scripts -e SCRIPTS=/scripts/ --entrypoint bash mc-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
/scripts/start-magma
|
||||||
|
```
|
||||||
|
|
||||||
|
...or pre-pending script execution:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
VANILLA_VERSION=1.12.2 /scripts/start-magma
|
||||||
|
```
|
||||||
|
|
||||||
|
> NOTE: You may want to temporarily add an `exit` statement near the end of your script to isolate execution to just the script you're developing.
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
if isTrue "${ENABLE_AUTOPAUSE}" && [[ "$( ps -a -o stat,comm | grep 'java' | awk '{ print $1 }')" =~ ^T.*$ ]]; then
|
||||||
echo "Java process suspended by Autopause function"
|
echo "Java process suspended by Autopause function"
|
||||||
|
6
start
6
start
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
umask 0002
|
umask 0002
|
||||||
chmod g+w /data
|
chmod g+w /data
|
||||||
@ -45,7 +45,7 @@ if [ $(id -u) = 0 ]; then
|
|||||||
echo 'hosts: files dns' > /etc/nsswitch.conf
|
echo 'hosts: files dns' > /etc/nsswitch.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec ${runAsUser}:${runAsGroup} /start-configuration $@
|
exec su-exec ${runAsUser}:${runAsGroup} ${SCRIPTS:-/}start-configuration $@
|
||||||
else
|
else
|
||||||
exec /start-configuration $@
|
exec ${SCRIPTS:-/}start-configuration $@
|
||||||
fi
|
fi
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
log "Autopause functionality enabled"
|
log "Autopause functionality enabled"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
@ -69,53 +69,53 @@ cd /data || exit 1
|
|||||||
export ORIGINAL_TYPE=${TYPE^^}
|
export ORIGINAL_TYPE=${TYPE^^}
|
||||||
|
|
||||||
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
if isTrue "${ENABLE_AUTOPAUSE}"; then
|
||||||
/start-autopause
|
${SCRIPTS:-/}start-autopause
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Resolving type given ${TYPE}"
|
log "Resolving type given ${TYPE}"
|
||||||
case "${TYPE^^}" in
|
case "${TYPE^^}" in
|
||||||
*BUKKIT|SPIGOT)
|
*BUKKIT|SPIGOT)
|
||||||
exec /start-deployBukkitSpigot "$@"
|
exec ${SCRIPTS:-/}start-deployBukkitSpigot "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
PAPER)
|
PAPER)
|
||||||
exec /start-deployPaper "$@"
|
exec ${SCRIPTS:-/}start-deployPaper "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
TUINITY)
|
TUINITY)
|
||||||
exec /start-deployTuinity "$@"
|
exec ${SCRIPTS:-/}start-deployTuinity "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FORGE)
|
FORGE)
|
||||||
exec /start-deployForge "$@"
|
exec ${SCRIPTS:-/}start-deployForge "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FABRIC)
|
FABRIC)
|
||||||
exec /start-deployFabric "$@"
|
exec ${SCRIPTS:-/}start-deployFabric "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
FTB|CURSEFORGE)
|
FTB|CURSEFORGE)
|
||||||
exec /start-deployFTB "$@"
|
exec ${SCRIPTS:-/}start-deployFTB "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
VANILLA)
|
VANILLA)
|
||||||
exec /start-deployVanilla "$@"
|
exec ${SCRIPTS:-/}start-deployVanilla "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
SPONGEVANILLA)
|
SPONGEVANILLA)
|
||||||
exec /start-deploySpongeVanilla "$@"
|
exec ${SCRIPTS:-/}start-deploySpongeVanilla "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CUSTOM)
|
CUSTOM)
|
||||||
exec /start-deployCustom "$@"
|
exec ${SCRIPTS:-/}start-deployCustom "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
CURSE_INSTANCE)
|
CURSE_INSTANCE)
|
||||||
exec /start-validateCurseInstance "$@"
|
exec ${SCRIPTS:-/}start-validateCurseInstance "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
MAGMA)
|
MAGMA)
|
||||||
exec /start-magma "$@"
|
exec ${SCRIPTS:-/}start-magma "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@ -102,4 +102,4 @@ export TYPE=SPIGOT
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if isURL ${CUSTOM_SERVER}; then
|
if isURL ${CUSTOM_SERVER}; then
|
||||||
filename=$(basename ${CUSTOM_SERVER})
|
filename=$(basename ${CUSTOM_SERVER})
|
||||||
@ -28,4 +28,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export FTB_BASE_DIR=/data/FeedTheBeast
|
export FTB_BASE_DIR=/data/FeedTheBeast
|
||||||
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
legacyJavaFixerUrl=http://ftb.cursecdn.com/FTB2/maven/net/minecraftforge/lex/legacyjavafixer/1.0/legacyjavafixer-1.0.jar
|
||||||
@ -135,4 +135,4 @@ elif [ -e "${FTB_DIR}/Install.sh" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=FABRIC
|
export TYPE=FABRIC
|
||||||
|
|
||||||
@ -75,4 +75,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Contineut to Final Setup
|
# Contineut to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=FORGE
|
export TYPE=FORGE
|
||||||
|
|
||||||
@ -113,4 +113,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
: ${PAPERBUILD:=latest}
|
: ${PAPERBUILD:=latest}
|
||||||
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
export SERVER=paper_server-${VANILLA_VERSION}-${PAPERBUILD}.jar
|
||||||
@ -20,4 +20,4 @@ export TYPE=SPIGOT
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=spongevanilla
|
export TYPE=spongevanilla
|
||||||
|
|
||||||
@ -36,4 +36,4 @@ if [ ! -e $SERVER ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if [ "${VERSION}" != "LATEST" ]; then
|
if [ "${VERSION}" != "LATEST" ]; then
|
||||||
log "ERROR: Tunity server type only supports VERSION=LATEST"
|
log "ERROR: Tunity server type only supports VERSION=LATEST"
|
||||||
@ -24,4 +24,4 @@ fi
|
|||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
@ -43,4 +43,4 @@ fi
|
|||||||
isDebugging && ls -l
|
isDebugging && ls -l
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
set -e
|
set -e
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
@ -51,4 +51,4 @@ if [[ "$WORLD" ]] && [ ! -d "$worldDest" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /start-finalSetup02Modpack $@
|
exec ${SCRIPTS:-/}start-finalSetup02Modpack $@
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
# CURSE_URL_BASE used in manifest downloads below
|
# CURSE_URL_BASE used in manifest downloads below
|
||||||
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects}
|
||||||
@ -154,4 +154,4 @@ if [[ "${GENERIC_PACK}" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /start-finalSetup03Modconfig $@
|
exec ${SCRIPTS:-/}start-finalSetup03Modconfig $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
|
# If supplied with a URL for a config (simple zip of configurations), download it and unpack
|
||||||
if [[ "$MODCONFIG" ]]; then
|
if [[ "$MODCONFIG" ]]; then
|
||||||
@ -24,4 +24,4 @@ case "X$MODCONFIG" in
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /start-finalSetup04ServerProperties $@
|
exec ${SCRIPTS:-/}start-finalSetup04ServerProperties $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
function setServerProp {
|
function setServerProp {
|
||||||
@ -194,4 +194,4 @@ if isDebugging; then
|
|||||||
cat /data/server.properties
|
cat /data/server.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /start-finalSetup05EnvVariables $@
|
exec ${SCRIPTS:-/}start-finalSetup05EnvVariables $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
||||||
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
||||||
@ -25,4 +25,4 @@ if [ "${REPLACE_ENV_VARIABLES^^}" = "TRUE" ]; then
|
|||||||
done < <(env)
|
done < <(env)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec /start-minecraftFinalSetup $@
|
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
export SERVER="/data/magma-server-${VANILLA_VERSION}.jar"
|
||||||
|
|
||||||
@ -15,4 +15,4 @@ fi
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World $@
|
exec ${SCRIPTS:-/}start-finalSetup01World $@
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Setting/adding ops"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. /start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if ! [[ -v CURSE_INSTANCE_JSON ]]; then
|
if ! [[ -v CURSE_INSTANCE_JSON ]]; then
|
||||||
log "ERROR: CURSE_INSTANCE_JSON needs to be set"
|
log "ERROR: CURSE_INSTANCE_JSON needs to be set"
|
||||||
@ -15,4 +15,4 @@ fi
|
|||||||
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
|
log "Resolved CURSE_INSTANCE_JSON as ${CURSE_INSTANCE_JSON}"
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec /start-finalSetup01World "$@"
|
exec ${SCRIPTS:-/}start-finalSetup01World "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user