Merge commit '10fe997cbae7b18fa306fbfb6bb0543b91a3c340' as '.gitlab'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +0,0 @@
|
||||
data/
|
||||
@@ -1,21 +0,0 @@
|
||||
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
Dockerfile
10
Dockerfile
@@ -1,10 +0,0 @@
|
||||
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
|
||||
11
Makefile
11
Makefile
@@ -1 +1,10 @@
|
||||
include .gitlab/Makefile
|
||||
SHELL := /bin/bash
|
||||
|
||||
IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION)
|
||||
IMAGE_LATEST ?= $(shell cat IMAGE):latest
|
||||
PWD ?= $(shell pwd)
|
||||
|
||||
include .gitlab/make/docker.makefile
|
||||
include .gitlab/make/helm.makefile
|
||||
include .gitlab/make/kaniko.makefile
|
||||
include .gitlab/make/truenas.makefile
|
||||
|
||||
84
README.md
84
README.md
@@ -1,80 +1,10 @@
|
||||
# Minecraft
|
||||
|
||||
## Getting server.jar
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Running Locally
|
||||
# Adding the "common" subtree as your .gitlab folder
|
||||
|
||||
```bash
|
||||
docker-compose build minecraft
|
||||
docker-compose up minecraft
|
||||
# Add the subtree as a remote
|
||||
git remote add common git@gitlab.ducoterra.net:services/common.git
|
||||
git subtree add --prefix .gitlab common main
|
||||
|
||||
# Now you can run the following to update
|
||||
git subtree pull --prefix .gitlab common main
|
||||
```
|
||||
|
||||
## 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,23 +0,0 @@
|
||||
# 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/
|
||||
@@ -1,23 +0,0 @@
|
||||
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
|
||||
@@ -1,3 +0,0 @@
|
||||
# Minecraft Server
|
||||
|
||||
Creates a vanilla Minecraft server.
|
||||
@@ -1,3 +0,0 @@
|
||||
# Minecraft Server
|
||||
|
||||
Creates a vanilla Minecraft server.
|
||||
@@ -1,2 +0,0 @@
|
||||
image: ducoterra/minecraft:latest
|
||||
server_version: "1.17.1"
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 268 KiB |
@@ -1,38 +0,0 @@
|
||||
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
|
||||
@@ -1,8 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
data:
|
||||
eula.txt: |
|
||||
eula=true
|
||||
server.properties: {{ toYaml .Values.server_props | indent 2 }}
|
||||
@@ -1,70 +0,0 @@
|
||||
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
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
annotations:
|
||||
"helm.sh/resource-policy": keep
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 32Gi
|
||||
@@ -1,12 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
spec:
|
||||
selector:
|
||||
app: {{ .Release.Name }}
|
||||
ports:
|
||||
- port: {{ .Values.port }}
|
||||
targetPort: 25565
|
||||
name: {{ .Release.Name }}
|
||||
type: LoadBalancer
|
||||
@@ -1,45 +0,0 @@
|
||||
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
|
||||
22
make/docker.makefile
Normal file
22
make/docker.makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
.PHONY: docker-init
|
||||
docker-init:
|
||||
@touch VERSION
|
||||
@touch IMAGE
|
||||
|
||||
.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)
|
||||
4
make/helm.makefile
Normal file
4
make/helm.makefile
Normal file
@@ -0,0 +1,4 @@
|
||||
.PHONY: helm-release
|
||||
helm-release:
|
||||
@yq e ".version = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
|
||||
@yq e ".appVersion = \"$(shell cat VERSION)\"" -i helm/Chart.yaml
|
||||
0
make/kaniko.makefile
Normal file
0
make/kaniko.makefile
Normal file
3
make/truenas.makefile
Normal file
3
make/truenas.makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
.PHONY: chart-release
|
||||
chart-release:
|
||||
@rsync -av $(CHART)/helm/ charts/$(CHART)/$(shell cat $(CHART)/VERSION)/
|
||||
19
servers.md
19
servers.md
@@ -1,19 +0,0 @@
|
||||
# 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 +0,0 @@
|
||||
kubectl config set current-context k3os-alpha.dnet-ducoterra-minecraft
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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