Add 'minecraft/' from commit '0d2235b6a37b227f0affbbf32a3644b087b31684'
git-subtree-dir: minecraft git-subtree-mainline:7b7ef78bfcgit-subtree-split:0d2235b6a3
This commit is contained in:
27
minecraft/.common/Makefile
Normal file
27
minecraft/.common/Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION)
|
||||
IMAGE_LATEST ?= $(shell cat IMAGE):latest
|
||||
PWD ?= $(shell pwd)
|
||||
|
||||
.PHONY: buildx-context
|
||||
buildx-context:
|
||||
docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64
|
||||
|
||||
.PHONY: buildx-clear
|
||||
buildx-clear:
|
||||
docker buildx rm arm64
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
docker buildx build --load . -t $(IMAGE)
|
||||
@docker buildx build --load . -t $(IMAGE_LATEST)
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
docker buildx build --platform linux/amd64 --push . -t $(IMAGE)
|
||||
@docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST)
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
docker run -it -v $(PWD):/mc_data $(IMAGE) bash
|
||||
1
minecraft/.gitignore
vendored
Normal file
1
minecraft/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
data/
|
||||
21
minecraft/.gitlab-ci.yml
Normal file
21
minecraft/.gitlab-ci.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
variables:
|
||||
CI_PROJECT_NAME: "minecraft"
|
||||
CI_PROJECT_DIR: "."
|
||||
CI_REGISTRY_IMAGE: hub.ducoterra.net/ducoterra/minecraft
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
||||
build:
|
||||
only:
|
||||
variables:
|
||||
- $CI_COMMIT_TAG
|
||||
stage: build
|
||||
image:
|
||||
name: gcr.io/kaniko-project/executor:debug
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- echo $DEPLOY
|
||||
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
|
||||
10
minecraft/Dockerfile
Normal file
10
minecraft/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM openjdk:latest
|
||||
|
||||
RUN groupadd -r minecraft -g 2000
|
||||
RUN useradd --no-log-init minecraft -u 2000 -g 2000 -m
|
||||
WORKDIR /mc_data
|
||||
RUN chown -R minecraft:minecraft .
|
||||
|
||||
USER minecraft
|
||||
# Copy files only if they don't yet exist (server.jar, server.properties, etc) and start the server
|
||||
CMD java -Xmx"$MAX_RAM"G -Xms"$MIN_RAM"G -jar ./server.jar nogui
|
||||
1
minecraft/IMAGE
Normal file
1
minecraft/IMAGE
Normal file
@@ -0,0 +1 @@
|
||||
ducoterra/minecraft
|
||||
1
minecraft/Makefile
Normal file
1
minecraft/Makefile
Normal file
@@ -0,0 +1 @@
|
||||
include .common/Makefile
|
||||
80
minecraft/README.md
Normal file
80
minecraft/README.md
Normal file
@@ -0,0 +1,80 @@
|
||||
# Minecraft
|
||||
|
||||
## Getting server.jar
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Running Locally
|
||||
|
||||
```bash
|
||||
docker-compose build minecraft
|
||||
docker-compose up minecraft
|
||||
```
|
||||
|
||||
## Uploading to Docker Hub
|
||||
|
||||
In docker-compose.yaml, update the image tag to:
|
||||
|
||||
```yaml
|
||||
...
|
||||
services:
|
||||
minecraft:
|
||||
build: .
|
||||
image: <your_username>/minecraft:<version>-1
|
||||
ports:
|
||||
...
|
||||
```
|
||||
|
||||
then run
|
||||
|
||||
```bash
|
||||
docker-compose push
|
||||
```
|
||||
|
||||
## Running in kubernetes
|
||||
|
||||
In k8s/deploy.yaml, edit the deploy
|
||||
|
||||
```yaml
|
||||
...
|
||||
spec:
|
||||
containers:
|
||||
- name: minecraft
|
||||
image: <your image from above>
|
||||
ports:
|
||||
...
|
||||
```
|
||||
|
||||
Then run the following
|
||||
|
||||
```bash
|
||||
kubectl apply -f k8s/pvc
|
||||
kubectl apply -f k8s
|
||||
```
|
||||
|
||||
Your minecraft server will be available on port 25565
|
||||
|
||||
## Create a Backup
|
||||
|
||||
```bash
|
||||
kubectl cp <pod_name>:/mc_data <backup>
|
||||
```
|
||||
|
||||
## Restore from Backup
|
||||
|
||||
```bash
|
||||
kubectl cp <backup> <pod_name>:/mc_data
|
||||
```
|
||||
|
||||
## Cool seeds
|
||||
|
||||
### 7485786574821478084
|
||||
|
||||
Spawns you next to a nether portal with golden axe and pickaxe. River and Village close by.
|
||||
|
||||
### -8018833100564192815
|
||||
|
||||
Use with an amplified world, massive island
|
||||
1
minecraft/VERSION
Normal file
1
minecraft/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
23
minecraft/helm/.helmignore
Normal file
23
minecraft/helm/.helmignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
23
minecraft/helm/Chart.yaml
Normal file
23
minecraft/helm/Chart.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
apiVersion: v2
|
||||
name: minecraft
|
||||
description: A Minecraft server for kubernetes
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: 1.1.0
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
appVersion: 1.0.0
|
||||
3
minecraft/helm/README.md
Normal file
3
minecraft/helm/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Minecraft Server
|
||||
|
||||
Creates a vanilla Minecraft server.
|
||||
3
minecraft/helm/app-readme.md
Normal file
3
minecraft/helm/app-readme.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Minecraft Server
|
||||
|
||||
Creates a vanilla Minecraft server.
|
||||
2
minecraft/helm/ix_values.yaml
Normal file
2
minecraft/helm/ix_values.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
image: ducoterra/minecraft:latest
|
||||
server_version: "1.17.1"
|
||||
BIN
minecraft/helm/minecraft-logo.png
Normal file
BIN
minecraft/helm/minecraft-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 KiB |
38
minecraft/helm/questions.yaml
Normal file
38
minecraft/helm/questions.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
groups:
|
||||
- name: "Server Config"
|
||||
description: "Minecraft Server Configuration"
|
||||
- name: "Storage"
|
||||
description: "Minecraft Server Storage"
|
||||
questions:
|
||||
- variable: server_version
|
||||
description: "Server Version"
|
||||
label: "Version"
|
||||
group: "Server Config"
|
||||
schema:
|
||||
type: string
|
||||
default: "1.17.1"
|
||||
required: false
|
||||
- variable: port
|
||||
description: "Listen Port"
|
||||
group: "Server Config"
|
||||
label: "Port"
|
||||
schema:
|
||||
type: int
|
||||
default: 25565
|
||||
required: true
|
||||
- variable: max_ram
|
||||
description: "Total RAM allocated to the server"
|
||||
group: "Server Config"
|
||||
label: "RAM Limit (GiB)"
|
||||
schema:
|
||||
type: int
|
||||
default: 4
|
||||
required: true
|
||||
- variable: max_cpu
|
||||
description: "# CPU Cores Allocated to the server"
|
||||
group: "Server Config"
|
||||
label: "CPU Limit (# Cores)"
|
||||
schema:
|
||||
type: int
|
||||
default: 4
|
||||
required: true
|
||||
8
minecraft/helm/templates/configmap.yaml
Normal file
8
minecraft/helm/templates/configmap.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
data:
|
||||
eula.txt: |
|
||||
eula=true
|
||||
server.properties: {{ toYaml .Values.server_props | indent 2 }}
|
||||
70
minecraft/helm/templates/deploy.yaml
Normal file
70
minecraft/helm/templates/deploy.yaml
Normal file
@@ -0,0 +1,70 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ .Release.Name }}
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ .Release.Name }}
|
||||
spec:
|
||||
initContainers:
|
||||
- name: get-version
|
||||
image: {{ .Values.get_server.image }}
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: SERVER_VERSION
|
||||
value: {{ .Values.server_version }}
|
||||
volumeMounts:
|
||||
- mountPath: /downloads
|
||||
name: data
|
||||
- name: download-server
|
||||
image: {{ .Values.get_server.image }}
|
||||
imagePullPolicy: Always
|
||||
command: ["bash", "-c", "curl -o server.jar $(cat SERVER_VERSION)"]
|
||||
volumeMounts:
|
||||
- mountPath: /downloads
|
||||
name: data
|
||||
containers:
|
||||
- name: {{ .Release.Name }}
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 25565
|
||||
volumeMounts:
|
||||
- mountPath: /mc_data
|
||||
name: data
|
||||
- name: properties
|
||||
mountPath: /mc_data/server.properties
|
||||
subPath: server.properties
|
||||
- name: properties
|
||||
mountPath: /mc_data/eula.txt
|
||||
subPath: eula.txt
|
||||
tty: true
|
||||
stdin: true
|
||||
env:
|
||||
- name: MAX_RAM
|
||||
value: {{ .Values.max_ram | quote }}
|
||||
- name: MIN_RAM
|
||||
value: "1"
|
||||
resources:
|
||||
requests:
|
||||
memory: {{ div .Values.max_ram 2 }}Gi
|
||||
cpu: 1m
|
||||
limits:
|
||||
memory: {{ add 1 .Values.max_ram }}Gi
|
||||
cpu: {{ .Values.max_cpu | quote }}
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ .Release.Name }}
|
||||
- name: properties
|
||||
configMap:
|
||||
name: {{ .Release.Name }}
|
||||
securityContext:
|
||||
fsGroup: 2000
|
||||
12
minecraft/helm/templates/pvc.yaml
Normal file
12
minecraft/helm/templates/pvc.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
12
minecraft/helm/templates/service.yaml
Normal file
12
minecraft/helm/templates/service.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
app: {{ .Release.Name }}
|
||||
ports:
|
||||
- port: {{ .Values.port }}
|
||||
targetPort: 25565
|
||||
name: {{ .Release.Name }}
|
||||
type: LoadBalancer
|
||||
45
minecraft/helm/values.yaml
Normal file
45
minecraft/helm/values.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
image: ducoterra/minecraft:latest
|
||||
get_server:
|
||||
image: ducoterra/get-minecraft:latest
|
||||
server_version: "1.17.1"
|
||||
port: 20101
|
||||
max_cpu: 4
|
||||
max_ram: 4
|
||||
server_props: |
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
broadcast-console-to-ops=true
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=3
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=default
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=32
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=true
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=256
|
||||
level-seed=
|
||||
prevent-proxy-connections=false
|
||||
use-native-transport=true
|
||||
motd=This is gonna be interesting
|
||||
enable-rcon=false
|
||||
19
minecraft/servers.md
Normal file
19
minecraft/servers.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Servers
|
||||
|
||||
## Minecraft
|
||||
|
||||
```bash
|
||||
helm upgrade --install minecraft ./helm --set tag=1.15.2_7 --set port=25565
|
||||
```
|
||||
|
||||
## Pubcraft
|
||||
|
||||
```bash
|
||||
helm upgrade --install pubcraft ./helm --set tag=1.15.2_7 --set port=20100
|
||||
```
|
||||
|
||||
## TestCraft
|
||||
|
||||
```bash
|
||||
helm upgrade --install testcraft ./helm --set tag=1.16.1_2 --set port=25566
|
||||
```
|
||||
1
minecraft/setenv.sh
Executable file
1
minecraft/setenv.sh
Executable file
@@ -0,0 +1 @@
|
||||
kubectl config set current-context k3os-alpha.dnet-ducoterra-minecraft
|
||||
42
minecraft/values/values-camcraft.yaml
Normal file
42
minecraft/values/values-camcraft.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
image: hub.ducoterra.net/ducoterra/minecraft:1.16.4
|
||||
port: 20101
|
||||
max_cpu: 8
|
||||
max_ram: 8
|
||||
server_props: |
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
broadcast-console-to-ops=true
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=3
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=default
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=32
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=true
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=256
|
||||
level-seed=
|
||||
prevent-proxy-connections=false
|
||||
use-native-transport=true
|
||||
motd=This is gonna be interesting
|
||||
enable-rcon=false
|
||||
42
minecraft/values/values-minecraft.yaml
Normal file
42
minecraft/values/values-minecraft.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
image: hub.ducoterra.net/ducoterra/minecraft:1.16.4
|
||||
port: 25565
|
||||
max_cpu: 8
|
||||
max_ram: 6
|
||||
server_props: |
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
broadcast-console-to-ops=true
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=3
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=default
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=32
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=true
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=256
|
||||
level-seed=
|
||||
prevent-proxy-connections=false
|
||||
use-native-transport=true
|
||||
motd=This is gonna be interesting
|
||||
enable-rcon=false
|
||||
42
minecraft/values/values-pubcraft.yaml
Normal file
42
minecraft/values/values-pubcraft.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
image: hub.ducoterra.net/ducoterra/minecraft:1.16.4
|
||||
port: 20100
|
||||
max_cpu: 8
|
||||
max_ram: 6
|
||||
server_props: |
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
broadcast-console-to-ops=true
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=3
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=default
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=32
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=true
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=256
|
||||
level-seed=
|
||||
prevent-proxy-connections=false
|
||||
use-native-transport=true
|
||||
motd=This is gonna be interesting
|
||||
enable-rcon=false
|
||||
42
minecraft/values/values-testcraft.yaml
Normal file
42
minecraft/values/values-testcraft.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
image: hub.ducoterra.net/ducoterra/minecraft:1.16.4
|
||||
port: 25566
|
||||
max_cpu: 8
|
||||
max_ram: 6
|
||||
server_props: |
|
||||
max-tick-time=60000
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
broadcast-console-to-ops=true
|
||||
enable-query=false
|
||||
player-idle-timeout=0
|
||||
difficulty=3
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=amplified
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=20
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=64
|
||||
resource-pack=
|
||||
spawn-animals=true
|
||||
white-list=true
|
||||
generate-structures=true
|
||||
online-mode=true
|
||||
max-build-height=512
|
||||
level-seed=
|
||||
prevent-proxy-connections=false
|
||||
use-native-transport=true
|
||||
motd=This is gonna be interesting
|
||||
enable-rcon=false
|
||||
Reference in New Issue
Block a user