Squashed '.gitlab/' changes from 16ee2f3..fe577bf
fe577bfremove old forge versions before unzipping6c4354dAutomated release for version 1.0.16fd156egenericize the container run commands by normalizing file namesb776273add update-version, remove get-server4488fbfmove values to helm/values.yamldad1e4csync versions to chart.yamla171258remove truenas chart stuff84abbd4Merge update from Commona13cfe6Squashed '.gitlab/' changes from 6430416..16ee2f38b0a8fasetenv is deprecated6213e7fpin FROM to use 8-jdk-bullseye9dc2f0eswitch to correct image in docker-composeb0991eaignore versions folder where we keep pack zip filesf8fc83bremove default valuese2c677badd unzip and copy properties init container, don't mount propertiesd118b2dadd the-1122-pack valuesa280110Squashed '.gitlab/' changes from cf41f2e..64304166d11fdeMerge update from Common4497566Squashed '.gitlab/' changes from 731ada6..cf41f2e0520668Merge update from Common2de53deRemove .commona85a7aaMerge branch 'common-subtree'a074005Add '.gitlab/' from commit '731ada6a3d65b2347ccf204cfe09ee278a4f0594'422f4d4remove .gitlab subtreea5aa0caAutomated release for version 1.0.265b3a84make subtree "split" overhauld181d45Overhaul for get-server v. 2.0.00d2235bMerge branch 'common-makefile' into 'master'dbe0d47Merge branch 'master' into 'common-makefile'c7c547cSwitch to common Makefilea403f6fMerge commit '32cd04c7ec7aacf8e3a402e3aed310a6ea94b586' as '.common'32cd04cSquashed '.common/' content from commitf1875228d190e4Add minecraft logoba5ab53Allow custom server versionsa820e9aAllow custom server versions9e788eeAdd IMAGE and VERSION filesd3b0f86Switch to openjdk-latest and don't copy server.jar2f7d4c7Add Makefileaa253e6Remove server.jar and docker-compose.yaml773c1d6Move install-specific values to a values folderdae5a09Fix RAM issue with deploy44053abtruenas compatibility update807b186set memory requirements to avoid sudden container death99666baadd setenv1b6b8bbupdate RAM for new cluster95c7fa7merge templates7e0ff9eupgrade to 1.6.412fa8ecremove extra opts and remove threading7d34b3aadd charts for each server95b0bd6switch to configmap modelff2c9afservers to nvme1dfb1f6nvme for minecraft3faf5c9don't auto deploy072bee6update to 1.16.1e6a0429fix port issue7df518dset imageca4d1eeuse tag in deploy1ccc5cdfix tags3ce71a6add gitlab ci151867fswitch back to minecraft 1.15.2abc90beadd imagesb727538upgrade to 20w12a17b0594upgrade to 20w12a9929e5dupgrade to 20w12a00386c7just copy files to mc_data0c75d91switch to ducoterra namespace8bdae44add README for backups6264d75set namespace to minecraftf59775duse a loadbalancere54fdbeupdate IP22987e0comment horrible CMD38b9dffadd server.properties and update k8s with ram envda7cb2cadd ram env53e37baswitch to java 8 and only copy files that exist0253598add build script095bbaainit REVERT: 16ee2f3 Merge branch 'various-docker-fixes' into 'main' REVERT: 5b3e196 fix docker build and remove release REVERT: 4bf9d45 Merge branch 'prefix-docker-commands' into 'main' REVERT: 91b77b3 don't reset head after subtree pull, it breaks things REVERT: 66b4362 prefix all docker commands with docker- REVERT: ba2827a Merge branch 'allow-specify-branch' into 'main' REVERT: 4de5558 ignore .gitlab REVERT: 71ff227 Allow pulling specific branch with BRANCH_NAME REVERT: 6430416 Merge branch 'add-helm-and-kube' into 'main' REVERT: bce675f Add install, upgrade, and uninstall for helm REVERT: 1532f30 Add kubectl.makefile REVERT: cf41f2e Merge branch 'remove-push' into 'main' REVERT: ef81c95 Remove unused commands REVERT: 81c19cc Don't use remote common REVERT: ea1e248 Update subtree add README REVERT: 756cc8c Remove make-push REVERT: a4b7e34 Squash subtree on pull REVERT: 524c5be Fix PROJECT_NAME variable REVERT: 47dea48 Add automated commit to chart-release git-subtree-dir: .gitlab git-subtree-split:fe577bfc4c
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
.gitlab
|
||||
data/
|
||||
world/
|
||||
versions/
|
||||
|
||||
21
.gitlab-ci.yml
Normal file
21
.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
|
||||
1
.gitlab/.gitignore
vendored
Normal file
1
.gitlab/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.gitlab
|
||||
21
.gitlab/Makefile
Normal file
21
.gitlab/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
PROJECT_NAME ?= $(shell git config --local remote.origin.url | sed -n 's\#.*/\([^.]*\)\.git\#\1\#p')
|
||||
VERSION ?= $(shell cat VERSION)
|
||||
IMAGE ?= $(shell cat IMAGE):$(VERSION)
|
||||
IMAGE_LATEST ?= $(shell cat IMAGE):latest
|
||||
PWD ?= $(shell pwd)
|
||||
STASH ?= "common-update-stash"
|
||||
MAKE_BRANCH ?= main
|
||||
|
||||
include .gitlab/make/docker.makefile
|
||||
include .gitlab/make/helm.makefile
|
||||
include .gitlab/make/kaniko.makefile
|
||||
include .gitlab/make/truenas.makefile
|
||||
include .gitlab/make/git.makefile
|
||||
include .gitlab/make/kubectl.makefile
|
||||
|
||||
# git subtree add --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
|
||||
.PHONY: make-update
|
||||
make-update:
|
||||
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git $(MAKE_BRANCH)
|
||||
9
.gitlab/README.md
Normal file
9
.gitlab/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Adding the "common" subtree as your .gitlab folder
|
||||
|
||||
```bash
|
||||
# Add the subtree as a remote
|
||||
git subtree add --prefix .gitlab git@gitlab.ducoterra.net:services/common.git main --squash --message "Add Common .gitlab Subtree"
|
||||
|
||||
# Now you can run the following to update
|
||||
make make-update
|
||||
```
|
||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
||||
FROM openjdk:8-jdk-bullseye
|
||||
|
||||
RUN apt update && apt install -y unzip
|
||||
|
||||
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 .
|
||||
|
||||
# Copy the modpack
|
||||
COPY versions/the-1122-pack_1.3.7.1.zip /the-1122-pack/the-1122-pack.zip
|
||||
RUN chown -R minecraft:minecraft /the-1122-pack
|
||||
|
||||
USER minecraft
|
||||
32
Makefile
32
Makefile
@@ -1,21 +1,19 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
PROJECT_NAME ?= $(shell git config --local remote.origin.url | sed -n 's\#.*/\([^.]*\)\.git\#\1\#p')
|
||||
VERSION ?= $(shell cat VERSION)
|
||||
IMAGE ?= $(shell cat IMAGE):$(VERSION)
|
||||
IMAGE_LATEST ?= $(shell cat IMAGE):latest
|
||||
PWD ?= $(shell pwd)
|
||||
STASH ?= "common-update-stash"
|
||||
MAKE_BRANCH ?= main
|
||||
include .gitlab/Makefile
|
||||
|
||||
include .gitlab/make/docker.makefile
|
||||
include .gitlab/make/helm.makefile
|
||||
include .gitlab/make/kaniko.makefile
|
||||
include .gitlab/make/truenas.makefile
|
||||
include .gitlab/make/git.makefile
|
||||
include .gitlab/make/kubectl.makefile
|
||||
.PHONY: run
|
||||
run:
|
||||
docker-compose run --service-ports minecraft
|
||||
|
||||
# git subtree add --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
|
||||
.PHONY: make-update
|
||||
make-update:
|
||||
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git $(MAKE_BRANCH)
|
||||
.PHONY: update-version
|
||||
update-version:
|
||||
ifdef VERSION
|
||||
@echo $(VERSION) > VERSION
|
||||
@yq e ".version = \"$(VERSION)\"" -i helm/Chart.yaml
|
||||
@yq e ".appVersion = \"$(VERSION)\"" -i helm/Chart.yaml
|
||||
@yq e ".services.*.image = \"$(IMAGE)\"" -i docker-compose.yaml
|
||||
@yq e ".image = \"$(IMAGE)\"" -i helm/values.yaml
|
||||
else
|
||||
@echo 'VERSION not defined or VERSION file not found/empty'
|
||||
endif
|
||||
|
||||
54
README.md
54
README.md
@@ -1,9 +1,53 @@
|
||||
# Adding the "common" subtree as your .gitlab folder
|
||||
# Minecraft
|
||||
|
||||
## Running Locally
|
||||
|
||||
```bash
|
||||
# Add the subtree as a remote
|
||||
git subtree add --prefix .gitlab git@gitlab.ducoterra.net:services/common.git main --squash --message "Add Common .gitlab Subtree"
|
||||
# download the most recent version of minecraft
|
||||
make get-server
|
||||
|
||||
# Now you can run the following to update
|
||||
make make-update
|
||||
# Run the server
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
## Uploading to Docker Hub
|
||||
|
||||
1. Update the version in the VERSION file.
|
||||
2. Build and push the new version
|
||||
|
||||
```bash
|
||||
make build
|
||||
make push
|
||||
```
|
||||
|
||||
## Running in kubernetes
|
||||
|
||||
Requires helm v3. Edit values.yaml and run the following:
|
||||
|
||||
```bash
|
||||
helm upgrade --install minecraft
|
||||
```
|
||||
|
||||
Your minecraft server will be available on port 25565 by default.
|
||||
|
||||
## 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
|
||||
|
||||
13
docker-compose.yaml
Normal file
13
docker-compose.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: '3'
|
||||
services:
|
||||
minecraft:
|
||||
image: ducoterra/the-1122-pack:1.0.1
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ./world:/mc_data
|
||||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
- MAX_RAM=1
|
||||
- MIN_RAM=1
|
||||
23
helm/.helmignore
Normal file
23
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/
|
||||
20
helm/Chart.yaml
Normal file
20
helm/Chart.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
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.0.1
|
||||
# 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.1
|
||||
8
helm/templates/configmap.yaml
Normal file
8
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 }}
|
||||
80
helm/templates/deploy.yaml
Normal file
80
helm/templates/deploy.yaml
Normal file
@@ -0,0 +1,80 @@
|
||||
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: unzip
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: Always
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", "rm -f forge*.jar && unzip -o -d . /the-1122-pack/the-1122-pack.zip"]
|
||||
volumeMounts:
|
||||
- mountPath: /mc_data
|
||||
name: data
|
||||
- name: rename
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: Always
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", "mv $(find . -maxdepth 1 -name 'forge*.jar') forge.jar"]
|
||||
volumeMounts:
|
||||
- mountPath: /mc_data
|
||||
name: data
|
||||
- name: copy-properties
|
||||
image: debian:latest
|
||||
imagePullPolicy: Always
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", "cp -f /server.properties /mc_data/server.properties"]
|
||||
volumeMounts:
|
||||
- mountPath: /mc_data
|
||||
name: data
|
||||
- name: properties
|
||||
mountPath: /server.properties
|
||||
subPath: server.properties
|
||||
containers:
|
||||
- name: server
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: Always
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", 'java -server -Xmx"$MAX_RAM"G -Dfml.queryResult=confirm -jar forge.jar nogui']
|
||||
ports:
|
||||
- containerPort: 25565
|
||||
volumeMounts:
|
||||
- mountPath: /mc_data
|
||||
name: data
|
||||
- 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
helm/templates/pvc.yaml
Normal file
12
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
helm/templates/service.yaml
Normal file
12
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
|
||||
42
helm/values.yaml
Normal file
42
helm/values.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
image: ducoterra/the-1122-pack:1.0.1
|
||||
port: 20102
|
||||
max_cpu: 4
|
||||
max_ram: 6
|
||||
server_props: |
|
||||
max-tick-time=-1
|
||||
query.port=25565
|
||||
generator-settings=
|
||||
force-gamemode=false
|
||||
allow-nether=true
|
||||
gamemode=0
|
||||
enable-query=true
|
||||
player-idle-timeout=0
|
||||
difficulty=1
|
||||
spawn-monsters=true
|
||||
op-permission-level=4
|
||||
pvp=true
|
||||
snooper-enabled=true
|
||||
level-type=BIOMESOP
|
||||
hardcore=false
|
||||
enable-command-block=false
|
||||
max-players=10
|
||||
network-compression-threshold=256
|
||||
resource-pack-sha1=
|
||||
max-world-size=29999984
|
||||
server-port=25565
|
||||
server-ip=0.0.0.0
|
||||
spawn-npcs=true
|
||||
allow-flight=true
|
||||
level-name=world
|
||||
view-distance=24
|
||||
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
|
||||
enable-rcon=false
|
||||
motd=\u00A7lThe 1.12.2 Pack Server v1.3.7
|
||||
19
servers.md
Normal file
19
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
|
||||
```
|
||||
Reference in New Issue
Block a user