Your Name commited on
Commit
c08e495
1 Parent(s): 855847e
Dockerfile ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM debian
2
+
3
+ # hook into docker BuildKit --platform support
4
+ # see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
5
+ ARG TARGETOS
6
+ ARG TARGETARCH
7
+ ARG TARGETVARIANT
8
+
9
+ RUN --mount=target=/build,source=build /build/install-packages
10
+
11
+ ARG BOX64_PACKAGE=box64
12
+ RUN --mount=target=/build,source=build BOX64_PACKAGE=$BOX64_PACKAGE /build/setup-arm64
13
+
14
+ EXPOSE 19132/udp
15
+
16
+ VOLUME ["/data"]
17
+
18
+ WORKDIR /data
19
+
20
+ ENTRYPOINT ["/usr/local/bin/entrypoint-demoter", "--match", "/data", "--debug", "--stdin-on-term", "stop", "/opt/bedrock-entry.sh"]
21
+
22
+ ARG APPS_REV=1
23
+ ARG GITHUB_BASEURL=https://github.com
24
+
25
+ ARG EASY_ADD_VERSION=0.8.2
26
+ ADD ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
27
+ RUN chmod +x /usr/bin/easy-add
28
+
29
+ ARG ENTRYPOINT_DEMOTER_VERSION=0.4.2
30
+ RUN easy-add --var version=${ENTRYPOINT_DEMOTER_VERSION} --var app=entrypoint-demoter --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/v{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
31
+
32
+ ARG SET_PROPERTY_VERSION=0.1.1
33
+ RUN easy-add --var version=${SET_PROPERTY_VERSION} --var app=set-property --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
34
+
35
+ ARG RESTIFY_VERSION=1.7.2
36
+ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
37
+ --var version=${RESTIFY_VERSION} --var app=restify --file {{.app}} \
38
+ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
39
+
40
+ ARG MC_MONITOR_VERSION=0.12.6
41
+ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
42
+ --var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \
43
+ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
44
+
45
+ ARG MC_SERVER_RUNNER_VERSION=1.12.1
46
+ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
47
+ --var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
48
+ --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
49
+
50
+ COPY *.sh /opt/
51
+
52
+ COPY property-definitions.json /etc/bds-property-definitions.json
53
+ COPY bin/* /usr/local/bin/
54
+
55
+ # Available versions listed at
56
+ # https://minecraft.wiki/w/Bedrock_Edition_1.11.0
57
+ # https://minecraft.wiki/w/Bedrock_Edition_1.12.0
58
+ # https://minecraft.wiki/w/Bedrock_Edition_1.13.0
59
+ # https://minecraft.wiki/w/Bedrock_Edition_1.14.0
60
+ ENV VERSION=LATEST \
61
+ SERVER_PORT=19132
62
+
63
+ HEALTHCHECK --start-period=1m CMD /usr/local/bin/mc-monitor status-bedrock --host 127.0.0.1 --port $SERVER_PORT
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Geoff Bourne
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
bedrock-entry.sh ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ set -eo pipefail
4
+
5
+ : "${TMP_DIR:=/tmp}"
6
+ : "${PREVIEW:=false}"
7
+
8
+ function isTrue() {
9
+ [[ "${1,,}" =~ ^(true|on|1)$ ]] && return 0
10
+ return 1
11
+ }
12
+
13
+ function lookupVersion() {
14
+ platform=${1:?Missing required platform indicator}
15
+
16
+ # shellcheck disable=SC2034
17
+ for i in {1..3}; do
18
+ DOWNLOAD_URL=$(restify --user-agent=itzg/minecraft-bedrock-server --headers "accept-language:*" --attribute=data-platform="${platform}" "${downloadPage}" 2> restify.err | jq -r '.[0].href' || echo '')
19
+ [[ -n "${DOWNLOAD_URL}" ]] && break
20
+ sleep 1
21
+ done
22
+ if [[ -z ${DOWNLOAD_URL} ]]; then
23
+ DOWNLOAD_URL=$(curl -s https://mc-bds-helper.vercel.app/api/latest)
24
+ fi
25
+
26
+ # shellcheck disable=SC2012
27
+ if [[ ${DOWNLOAD_URL} =~ http.*/.*-(.*)\.zip ]]; then
28
+ VERSION=${BASH_REMATCH[1]}
29
+ elif [[ $(ls -rv bedrock_server-* 2> /dev/null|head -1) =~ bedrock_server-(.*) ]]; then
30
+ VERSION=${BASH_REMATCH[1]}
31
+ echo "WARN Minecraft download page failed, so using existing download of $VERSION"
32
+ cat restify.err
33
+ else
34
+ if [[ -f restify.err ]]; then
35
+ echo "Failed to extract download URL '${DOWNLOAD_URL}' from ${downloadPage}"
36
+ cat restify.err
37
+ rm restify.err
38
+ else
39
+ echo "Failed to lookup download URL: ${DOWNLOAD_URL}"
40
+ fi
41
+ exit 2
42
+ fi
43
+ rm -f restify.err
44
+ }
45
+
46
+ if [[ ${DEBUG^^} == TRUE ]]; then
47
+ set -x
48
+ curlArgs=(-v)
49
+ echo "DEBUG: running as $(id -a) with $(ls -ld /data)"
50
+ echo " current directory is $(pwd)"
51
+ fi
52
+
53
+ export HOME=/data
54
+
55
+ downloadPage=https://www.minecraft.net/en-us/download/server/bedrock
56
+
57
+ if [[ ${EULA^^} != TRUE ]]; then
58
+ echo
59
+ echo "EULA must be set to TRUE to indicate agreement with the Minecraft End User License"
60
+ echo "See https://minecraft.net/terms"
61
+ echo
62
+ echo "Current value is '${EULA}'"
63
+ echo
64
+ exit 1
65
+ fi
66
+
67
+ case ${VERSION^^} in
68
+ 1.12)
69
+ VERSION=1.12.0.28
70
+ ;;
71
+ 1.13)
72
+ VERSION=1.13.0.34
73
+ ;;
74
+ 1.14)
75
+ VERSION=1.14.60.5
76
+ ;;
77
+ 1.16)
78
+ VERSION=1.16.20.03
79
+ ;;
80
+ 1.17)
81
+ VERSION=1.17.41.01
82
+ ;;
83
+ 1.17.41)
84
+ VERSION=1.17.41.01
85
+ ;;
86
+ 1.18|PREVIOUS)
87
+ VERSION=1.18.33.02
88
+ ;;
89
+ PREVIEW)
90
+ echo "Looking up latest preview version..."
91
+ lookupVersion serverBedrockPreviewLinux
92
+ ;;
93
+ LATEST)
94
+ echo "Looking up latest version..."
95
+ lookupVersion serverBedrockLinux
96
+ ;;
97
+ *)
98
+ # use the given version exactly
99
+ ;;
100
+ esac
101
+
102
+ if [[ ! -f "bedrock_server-${VERSION}" ]]; then
103
+
104
+ if [[ -z "${DOWNLOAD_URL}" ]]; then
105
+ binPath=bin-linux
106
+ isTrue "${PREVIEW}" && binPath+="-preview"
107
+ DOWNLOAD_URL="https://minecraft.azureedge.net/${binPath}/bedrock-server-${VERSION}.zip"
108
+ fi
109
+
110
+ [[ $TMP_DIR != /tmp ]] && mkdir -p "$TMP_DIR"
111
+ TMP_ZIP="$TMP_DIR/$(basename "${DOWNLOAD_URL}")"
112
+
113
+ echo "Downloading Bedrock server version ${VERSION} ..."
114
+ if ! curl "${curlArgs[@]}" -o "${TMP_ZIP}" -fsSL "${DOWNLOAD_URL}"; then
115
+ echo "ERROR failed to download from ${DOWNLOAD_URL}"
116
+ echo " Double check that the given VERSION is valid"
117
+ exit 2
118
+ fi
119
+
120
+ # remove only binaries and some docs, to allow for an upgrade of those
121
+ rm -rf -- bedrock_server bedrock_server-* *.so release-notes.txt bedrock_server_how_to.html valid_known_packs.json premium_cache 2> /dev/null
122
+
123
+ bkupDir=backup-pre-${VERSION}
124
+ # fixup any previous interrupted upgrades
125
+ rm -rf "${bkupDir}"
126
+ for d in behavior_packs definitions minecraftpe resource_packs structures treatments world_templates; do
127
+ if [[ -d $d && -n "$(ls $d)" ]]; then
128
+ mkdir -p "${bkupDir}/$d"
129
+ echo "Backing up $d into $bkupDir"
130
+ if [[ "$d" == "resource_packs" ]]; then
131
+ mv $d/{chemistry,vanilla} "${bkupDir}/"
132
+ [[ -n "$(ls $d)" ]] && cp -a $d/* "${bkupDir}/"
133
+ else
134
+ mv $d/* "${bkupDir}/"
135
+ fi
136
+ fi
137
+ done
138
+
139
+ # remove old package backups, but keep PACKAGE_BACKUP_KEEP
140
+ if (( ${PACKAGE_BACKUP_KEEP:=2} >= 0 )); then
141
+ shopt -s nullglob
142
+ # shellcheck disable=SC2012
143
+ for d in $( ls -td1 backup-pre-* | tail +$(( PACKAGE_BACKUP_KEEP + 1 )) ); do
144
+ echo "Pruning backup directory: $d"
145
+ rm -rf "$d"
146
+ done
147
+ fi
148
+
149
+ # Do not overwrite existing files, which means the cleanup above needs to account for things
150
+ # that MUST be replaced on upgrade
151
+ unzip -q -n "${TMP_ZIP}"
152
+ [[ $TMP_DIR != /tmp ]] && rm -rf "$TMP_DIR"
153
+
154
+ chmod +x bedrock_server
155
+ mv bedrock_server "bedrock_server-${VERSION}"
156
+ fi
157
+
158
+ if [[ -n "$OPS" || -n "$MEMBERS" || -n "$VISITORS" ]]; then
159
+ echo "Updating permissions"
160
+ jq -n --arg ops "$OPS" --arg members "$MEMBERS" --arg visitors "$VISITORS" '[
161
+ [$ops | split(",") | map({permission: "operator", xuid:.})],
162
+ [$members | split(",") | map({permission: "member", xuid:.})],
163
+ [$visitors | split(",") | map({permission: "visitor", xuid:.})]
164
+ ]| flatten' > permissions.json
165
+ fi
166
+
167
+ if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
168
+ allowListUsers=${ALLOW_LIST_USERS:-$WHITE_LIST_USERS}
169
+
170
+ if [[ "$allowListUsers" ]]; then
171
+ echo "Setting allow list"
172
+ if [[ "$allowListUsers" != *":"* ]]; then
173
+ jq -c -n --arg users "$allowListUsers" '$users | split(",") | map({"ignoresPlayerLimit":false,"name": .})' > "allowlist.json"
174
+ else
175
+ jq -c -n --arg users "$allowListUsers" '$users | split(",") | map(split(":") | {"ignoresPlayerLimit":false,"name": .[0], "xuid": .[1]})' > "allowlist.json"
176
+ fi
177
+ # activate server property to enable list usage
178
+ ALLOW_LIST=true
179
+ else
180
+ ALLOW_LIST=false
181
+ rm -f allowlist.json
182
+ fi
183
+ fi
184
+
185
+ # prevent issue with bind mounted server.properties which can not be moved (sed tries to move the file when '-i' is used)
186
+ _SERVER_PROPERTIES=$(sed '/^white-list=.*/d' server.properties) #Removes white-list= line from server.properties
187
+ echo "${_SERVER_PROPERTIES}" > server.properties
188
+ export ALLOW_LIST
189
+
190
+ # update server.properties with environment settings
191
+ set-property --file server.properties --bulk /etc/bds-property-definitions.json
192
+
193
+ export LD_LIBRARY_PATH=.
194
+
195
+ mcServerRunnerArgs=()
196
+ if isTrue "${ENABLE_SSH}"; then
197
+ mcServerRunnerArgs+=(--remote-console)
198
+ if ! [[ -v RCON_PASSWORD ]]; then
199
+ RCON_PASSWORD=$(openssl rand -hex 12)
200
+ export RCON_PASSWORD
201
+ fi
202
+
203
+ # For ssh access by tools, export the current password.
204
+ # Use rcon's format to align with Java, as Java uses the rcon password for SSH as well.
205
+ echo "password=${RCON_PASSWORD}" > "$HOME/.remote-console.env"
206
+ echo "password: \"${RCON_PASSWORD}\"" > "$HOME/.remote-console.yaml"
207
+ fi
208
+
209
+ echo "Starting Bedrock server..."
210
+ if [[ -f /usr/local/bin/box64 ]] ; then
211
+ exec mc-server-runner "${mcServerRunnerArgs[@]}" box64 ./"bedrock_server-${VERSION}"
212
+ else
213
+ exec mc-server-runner "${mcServerRunnerArgs[@]}" ./"bedrock_server-${VERSION}"
214
+ fi
bin/send-command ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ if [[ $* ]]; then
4
+ # On arm64, the process exe is actually box64 since it in turn wraps the bedrock_server executable
5
+ if proc=$(find /proc -mindepth 2 -maxdepth 2 -name exe \( -lname '/data/bedrock_server-*' -o -lname /usr/local/bin/box64 \) -printf '%h' -quit); then
6
+ if [[ $proc ]]; then
7
+ echo "$@" > "$proc/fd/0"
8
+ else
9
+ echo "ERROR: unable to find bedrock server process"
10
+ exit 2
11
+ fi
12
+ else
13
+ echo "ERROR: failed to search for bedrock server process"
14
+ exit 2
15
+ fi
16
+ fi
17
+
build/install-packages ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ set -eu
4
+
5
+ apt-get update
6
+
7
+ DEBIAN_FRONTEND=noninteractive apt-get install -y \
8
+ curl \
9
+ openssl \
10
+ unzip \
11
+ jq
12
+
13
+ apt-get clean
14
+
15
+ rm -rf /var/lib/apt/lists/*
build/setup-arm64 ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ set -eu
4
+
5
+ if [ "$TARGETARCH" = "arm64" ] ; then
6
+ apt-get update
7
+ DEBIAN_FRONTEND=noninteractive apt-get install -y debian-keyring
8
+
9
+ curl -L https://ryanfortner.github.io/box64-debs/box64.list -o /etc/apt/sources.list.d/box64.list
10
+ curl -L https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor | tee /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
11
+
12
+ apt-get update
13
+ DEBIAN_FRONTEND=noninteractive apt-get install -y "$BOX64_PACKAGE"
14
+
15
+ apt-get clean
16
+ rm -rf /var/lib/apt/lists/*
17
+ fi
docs/example-client.jpg ADDED
examples/AzureBedrockServer.ps1 ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #you need the Azure cli https://docs.microsoft.com/es-es/cli/azure/
2
+
3
+ #Login to Azure portal
4
+ az login
5
+
6
+ #defaults to southcentralus but you can change it to one of the following list locations
7
+ #az account list-locations --query "[].{Region:name}" --out table
8
+
9
+ #create a new resource group "mineResGroup"
10
+ az group create --name mineResGroup --location southcentralus
11
+
12
+ #put the storage account "acismineacc" into that group
13
+ az storage account create --resource-group mineResGroup --name acismineacc --location southcentralus --sku Standard_LRS --kind StorageV2
14
+
15
+ #create the volume share "acismineshare" into the storage account
16
+ az storage share create --name acismineshare --account-name acismineacc
17
+
18
+ #obtain the key from the account "acismineacc" in the resource group "mineResGroup"
19
+ $STORAGE_KEY=$(az storage account keys list --resource-group mineResGroup --account-name acismineacc --query "[0].value" --output tsv)
20
+ echo $STORAGE_KEY
21
+
22
+ #to actually create the minecraft server int the dns name "minesvrbedrock"
23
+ #the server will be running into server "minesvrbedrock.southcentralus.azurecontainer.io" port "19132", this take some time be patient.
24
+ az container create --resource-group mineResGroup --name minecotainer --image itzg/minecraft-bedrock-server --dns-name-label minesvrbedrock --ports 19132 19133 --protocol udp --restart-policy OnFailure --environment-variables EULA=TRUE --azure-file-volume-account-name acismineacc --azure-file-volume-account-key $STORAGE_KEY --azure-file-volume-share-name acismineshare --azure-file-volume-mount-path /data
25
+
26
+ #connect to fileshare drive "M" to edit server.properties and everything else
27
+ #you need to restart the container after each change.
28
+ cmd.exe /C "cmdkey /add:`"acismineacc.file.core.windows.net`" /user:`"Azure\acismineacc`" /pass:`"$STORAGE_KEY`""
29
+ New-PSDrive -Name M -PSProvider FileSystem -Root "\\acismineacc.file.core.windows.net\acismineshare" -Persist
examples/docker-compose.host-mount.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This example uses a host mounted directory that is created/used relative to this
2
+ # location of this compose file.
3
+
4
+ version: '3.4'
5
+
6
+ services:
7
+ bds:
8
+ image: itzg/minecraft-bedrock-server
9
+ environment:
10
+ EULA: "TRUE"
11
+ GAMEMODE: survival
12
+ DIFFICULTY: normal
13
+ ports:
14
+ - 19132:19132/udp
15
+ volumes:
16
+ - ./data:/data
17
+ stdin_open: true
18
+ tty: true
examples/docker-compose.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.4'
2
+
3
+ services:
4
+ bds:
5
+ image: itzg/minecraft-bedrock-server
6
+ environment:
7
+ EULA: "TRUE"
8
+ GAMEMODE: survival
9
+ DIFFICULTY: normal
10
+ ports:
11
+ - "19132:19132/udp"
12
+ volumes:
13
+ - bds:/data
14
+ stdin_open: true
15
+ tty: true
16
+
17
+ volumes:
18
+ bds: {}
examples/kubernetes-backup-to-s3.yaml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WARNING: This does not currently account for the potential of the world being saved in
2
+ # the middle of a change to the files on disk. The only protection is choosing a time
3
+ # for backups that is unlikely to be in use.
4
+ #
5
+ # NOTE: The save command may be a way around this and is under investigation:
6
+ # https://minecraft.wiki/w/Commands/save
7
+
8
+ ---
9
+ apiVersion: v1
10
+ kind: ConfigMap
11
+ metadata:
12
+ name: backup-to-s3-bedrock
13
+ labels:
14
+ role: backup
15
+ data:
16
+ # https://github.com/flickerfly/docker-backup-to-s3/blob/master/README.md
17
+ CRON_SCHEDULE: '0 12 * * *'
18
+ S3_PATH: s3://mybucket/bedrock/
19
+ AWS_DEFAULT_REGION: us-east-1
20
+ # Pass this to the S3 command
21
+ PARAMS: ""
22
+ PREFIX: bedrock
23
+ DATA_PATH: /data/
24
+
25
+ ---
26
+ apiVersion: v1
27
+ kind: Secret
28
+ metadata:
29
+ name: backup-to-s3-bedrock
30
+ labels:
31
+ role: backup
32
+ data:
33
+ # https://github.com/flickerfly/docker-backup-to-s3/blob/master/README.md
34
+ AES_PASSPHRASE: BASE64-ENCODED STRING
35
+ AWS_ACCESS_KEY_ID: BASE64-ENCODED STRING
36
+ AWS_SECRET_ACCESS_KEY: BASE64-ENCODED STRING
37
+
38
+ ---
39
+ # Setup the Deployment of a pod that will do the work.
40
+ apiVersion: apps/v1
41
+ kind: Deployment
42
+ metadata:
43
+ name: bds-backup
44
+ labels:
45
+ role: backup
46
+ app: bedrock
47
+ spec:
48
+ replicas: 1
49
+ revisionHistoryLimit: 2
50
+ selector:
51
+ matchLabels:
52
+ role: backup
53
+ app: bedrock
54
+ template:
55
+ metadata:
56
+ labels:
57
+ app: bedrock
58
+ role: backup
59
+ spec:
60
+ containers:
61
+ - name: backup-to-s3
62
+ image: jritchie/backup-to-s3
63
+ args:
64
+ - schedule
65
+ volumeMounts:
66
+ - name: bds
67
+ mountPath: /data
68
+ envFrom:
69
+ - configMapRef:
70
+ name: backup-to-s3-bedrock
71
+ - secretRef:
72
+ name: backup-to-s3-bedrock
73
+ volumes:
74
+ - name: bds
75
+ persistentVolumeClaim:
76
+ claimName: bds
77
+ readOnly: true
examples/kubernetes-restore-to-s3.yaml ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPORTANT: Be sure to set the VERSION variable in the Job definition
2
+ # with the name of the backup file to be restored in S3
3
+ #
4
+ # WARNING: It is best practice to scale down your minecraft deployment
5
+ # to assure you have no server pods running before a restore. This is
6
+ # currenly a manual task.
7
+
8
+ ---
9
+ apiVersion: v1
10
+ kind: Namespace
11
+ metadata:
12
+ name: minecraft
13
+ ---
14
+ kind: PersistentVolumeClaim
15
+ apiVersion: v1
16
+ metadata:
17
+ name: bds
18
+ namespace: minecraft
19
+ spec:
20
+ accessModes:
21
+ - ReadWriteOnce
22
+ resources:
23
+ requests:
24
+ storage: 1Gi
25
+ ---
26
+ apiVersion: v1
27
+ kind: ConfigMap
28
+ metadata:
29
+ name: backup-to-s3-bedrock
30
+ namespace: minecraft
31
+ labels:
32
+ role: backup
33
+ data:
34
+ # https://github.com/flickerfly/docker-backup-to-s3/blob/master/README.md
35
+ CRON_SCHEDULE: '0 12 * * *'
36
+ S3_PATH: s3://mybucket/bedrock
37
+ AWS_DEFAULT_REGION: us-east-1
38
+ # Pass this to the S3 command
39
+ PARAMS: ""
40
+ PREFIX: bedrock
41
+ DATA_PATH: /data/
42
+
43
+ ---
44
+ apiVersion: v1
45
+ kind: Secret
46
+ metadata:
47
+ name: backup-to-s3-bedrock
48
+ namespace: minecraft
49
+ labels:
50
+ role: backup
51
+ data:
52
+ # https://github.com/flickerfly/docker-backup-to-s3/blob/master/README.md
53
+ AES_PASSPHRASE: BASE64-ENCODED STRING
54
+ AWS_ACCESS_KEY_ID: BASE64-ENCODED STRING
55
+ AWS_SECRET_ACCESS_KEY: BASE64-ENCODED STRING
56
+
57
+ ---
58
+ # Setup the jod to create a pod that will do the work.
59
+ apiVersion: batch/v1
60
+ kind: Job
61
+ metadata:
62
+ name: bds-restore
63
+ namespace: minecraft
64
+ labels:
65
+ role: restore
66
+ app: bedrock
67
+ spec:
68
+ template:
69
+ spec:
70
+ containers:
71
+ - name: restore-from-s3
72
+ image: jritchie/backup-to-s3
73
+ args:
74
+ - restore
75
+ volumeMounts:
76
+ - name: bds
77
+ mountPath: /data
78
+ envFrom:
79
+ - configMapRef:
80
+ name: backup-to-s3-bedrock
81
+ - secretRef:
82
+ name: backup-to-s3-bedrock
83
+ env:
84
+ - name: VERSION
85
+ value: bedrck-3020-05-28T15:33:49Z-example
86
+ restartPolicy: Never
87
+ volumes:
88
+ - name: bds
89
+ persistentVolumeClaim:
90
+ claimName: bds
examples/kubernetes.yml ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: minecraft-bedrock
6
+ labels:
7
+ role: service-config
8
+ app: bds
9
+ data:
10
+ # Find more options at https://github.com/itzg/docker-minecraft-bedrock-server#server-properties
11
+ # Remove # from in front of line if changing from default values.
12
+ EULA: "TRUE" # Must accept EULA to use this minecraft server
13
+ #GAMEMODE: "survival" # Options: survival, creative, adventure
14
+ #DIFFICULTY: "easy" # Options: peaceful, easy, normal, hard
15
+ #DEFAULT_PLAYER_PERMISSION_LEVEL: "member" # Options: visitor, member, operator
16
+ #LEVEL_NAME: "my_minecraft_world"
17
+ #LEVEL_SEED: "33480944"
18
+ #SERVER_NAME: "my_minecraft_server"
19
+ #SERVER_PORT: "19132"
20
+ #LEVEL_TYPE: "DEFAULT" # Options: FLAT, LEGACY, DEFAULT
21
+ #ALLOW_CHEATS: "false" # Options: true, false
22
+ #MAX_PLAYERS: "10"
23
+ #PLAYER_IDLE_TIMEOUT: "30"
24
+ #TEXTUREPACK_REQUIRED: "false" # Options: true, false
25
+ #
26
+ ## Changing these will have a security impact
27
+ #ONLINE_MODE: "true" # Options: true, false (removes Xbox Live account requirements)
28
+ #WHITE_LIST: "false" # If enabled, need to provide a whitelist.json by your own means.
29
+ #
30
+ ## Changing these will have a performance impact
31
+ #VIEW_DISTANCE: "10"
32
+ #TICK_DISTANCE: "4"
33
+ #MAX_THREADS: "8"
34
+ ---
35
+ kind: PersistentVolumeClaim
36
+ apiVersion: v1
37
+ metadata:
38
+ name: bds
39
+ spec:
40
+ accessModes:
41
+ - ReadWriteOnce
42
+ resources:
43
+ requests:
44
+ storage: 1Gi
45
+ ---
46
+ apiVersion: apps/v1
47
+ kind: StatefulSet
48
+ metadata:
49
+ labels:
50
+ app: bds
51
+ name: bds
52
+ spec:
53
+ # never more than 1 since BDS is not horizontally scalable
54
+ replicas: 1
55
+ serviceName: bds
56
+ selector:
57
+ matchLabels:
58
+ app: bds
59
+ template:
60
+ metadata:
61
+ labels:
62
+ app: bds
63
+ spec:
64
+ containers:
65
+ - name: main
66
+ image: itzg/minecraft-bedrock-server
67
+ imagePullPolicy: Always
68
+ envFrom:
69
+ - configMapRef:
70
+ name: minecraft-bedrock
71
+ volumeMounts:
72
+ - mountPath: /data
73
+ name: data
74
+ ports:
75
+ - containerPort: 19132
76
+ protocol: UDP
77
+ readinessProbe: &probe
78
+ exec:
79
+ command:
80
+ - mc-monitor
81
+ - status-bedrock
82
+ - --host
83
+ # force health check against IPv4 port
84
+ - 127.0.0.1
85
+ initialDelaySeconds: 30
86
+ livenessProbe: *probe
87
+ tty: true
88
+ stdin: true
89
+ volumeClaimTemplates:
90
+ - metadata:
91
+ name: data
92
+ spec:
93
+ accessModes:
94
+ - ReadWriteOnce
95
+ resources:
96
+ requests:
97
+ storage: 1Gi
98
+ ---
99
+ apiVersion: v1
100
+ kind: Service
101
+ metadata:
102
+ name: bds
103
+ spec:
104
+ selector:
105
+ app: bds
106
+ ports:
107
+ - port: 19132
108
+ protocol: UDP
109
+ ipFamily: IPv4
110
+ # Use LoadBalancer if running on a provider that supports that
111
+ # type: LoadBalancer
112
+ # or use NodePort on a non-managed system;
113
+ # however, you'll need to lookup port assigned to the service
114
+ type: NodePort
property-definitions.json ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "server-name": {
3
+ "env": "SERVER_NAME"
4
+ },
5
+ "server-port": {
6
+ "env": "SERVER_PORT"
7
+ },
8
+ "server-portv6": {
9
+ "env": "SERVER_PORT_V6"
10
+ },
11
+ "gamemode": {
12
+ "env": "GAMEMODE",
13
+ "allowed": ["survival","creative","adventure"],
14
+ "mappings": {
15
+ "0": "survival",
16
+ "1": "creative",
17
+ "2": "adventure"
18
+ }
19
+ },
20
+ "force-gamemode": {
21
+ "env": "FORCE_GAMEMODE",
22
+ "allowed": ["true","false"]
23
+ },
24
+ "difficulty": {
25
+ "env": "DIFFICULTY",
26
+ "allowed": ["easy","peaceful","normal","hard"],
27
+ "mappings": {
28
+ "0": "peaceful",
29
+ "1": "easy",
30
+ "2": "normal",
31
+ "3": "hard"
32
+ }
33
+ },
34
+ "level-type": {
35
+ "env": "LEVEL_TYPE",
36
+ "allowed": ["DEFAULT","FLAT","LEGACY"],
37
+ "mappings": {
38
+ "flat": "FLAT",
39
+ "legacy": "LEGACY",
40
+ "default": "DEFAULT"
41
+ }
42
+ },
43
+ "allow-cheats": {
44
+ "env": "ALLOW_CHEATS",
45
+ "allowed": ["true","false"]
46
+ },
47
+ "max-players": {
48
+ "env": "MAX_PLAYERS"
49
+ },
50
+ "online-mode": {
51
+ "env": "ONLINE_MODE",
52
+ "allowed": ["true","false"]
53
+ },
54
+ "white-list": {
55
+ "env": "WHITE_LIST",
56
+ "allowed": ["true","false"]
57
+ },
58
+ "allow-list": {
59
+ "env": "ALLOW_LIST",
60
+ "allowed": ["true","false"]
61
+ },
62
+ "view-distance": {
63
+ "env": "VIEW_DISTANCE"
64
+ },
65
+ "tick-distance": {
66
+ "env": "TICK_DISTANCE"
67
+ },
68
+ "player-idle-timeout": {
69
+ "env": "PLAYER_IDLE_TIMEOUT"
70
+ },
71
+ "max-threads": {
72
+ "env": "MAX_THREADS"
73
+ },
74
+ "compression-threshold": {
75
+ "env": "COMPRESSION_THRESHOLD"
76
+ },
77
+ "level-name": {
78
+ "env": "LEVEL_NAME"
79
+ },
80
+ "level-seed": {
81
+ "env": "LEVEL_SEED"
82
+ },
83
+ "default-player-permission-level": {
84
+ "env": "DEFAULT_PLAYER_PERMISSION_LEVEL",
85
+ "allowed": ["visitor","member","operator"]
86
+ },
87
+ "texturepack-required": {
88
+ "env": "TEXTUREPACK_REQUIRED",
89
+ "allowed": ["true","false"]
90
+ },
91
+ "server-authoritative-movement": {
92
+ "env": "SERVER_AUTHORITATIVE_MOVEMENT",
93
+ "allowed": ["server-auth","client-auth","server-auth-with-rewind"],
94
+ "mappings": {
95
+ "true": "server-auth",
96
+ "false": "client-auth"
97
+ }
98
+ },
99
+ "server-authoritative-block-breaking": {
100
+ "env": "SERVER_AUTHORITATIVE_BLOCK_BREAKING",
101
+ "allowed": ["true", "false"]
102
+ },
103
+ "player-movement-score-threshold": {
104
+ "env": "PLAYER_MOVEMENT_SCORE_THRESHOLD"
105
+ },
106
+ "player-movement-distance-threshold": {
107
+ "env": "PLAYER_MOVEMENT_DISTANCE_THRESHOLD"
108
+ },
109
+ "player-movement-duration-threshold-in-ms": {
110
+ "env": "PLAYER_MOVEMENT_DURATION_THRESHOLD_IN_MS"
111
+ },
112
+ "correct-player-movement": {
113
+ "env": "CORRECT_PLAYER_MOVEMENT",
114
+ "allowed": ["true","false"]
115
+ },
116
+ "emit-server-telemetry": {
117
+ "env": "EMIT_SERVER_TELEMETRY",
118
+ "allowed": ["true","false"]
119
+ },
120
+ "enable-lan-visibility": {
121
+ "env": "ENABLE_LAN_VISIBILITY",
122
+ "allowed": ["true","false"]
123
+ }
124
+ }