Compare commits
39 Commits
1.16.4_1
...
common-sub
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a07400506a | ||
|
|
422f4d49bd | ||
|
|
731ada6a3d | ||
|
|
c3e6d733c6 | ||
|
|
3c91292fea | ||
|
|
d86b5052a8 | ||
|
|
9d0c9c6388 | ||
|
|
30fb8c2171 | ||
|
|
fd96b3f3a3 | ||
|
|
a6053ed3f0 | ||
|
|
3563c5c2aa | ||
|
|
40a217b585 | ||
|
|
5e2bc5f872 | ||
|
|
a5aa0cacbe | ||
|
|
65b3a84e96 | ||
|
|
d181d452e8 | ||
|
|
9eed50962c | ||
|
|
b07a2c095b | ||
|
|
22a952dd53 | ||
|
|
0f6eeb776e | ||
|
|
f81d846f31 | ||
|
|
afed93f58a | ||
|
|
6239af7f74 | ||
|
|
2f767593ef | ||
|
|
66b4fdb902 | ||
|
|
da69418b0d | ||
|
|
ba12c923ba | ||
|
|
74a4a4e77f | ||
|
|
3e8ca71358 | ||
|
|
4146777f85 | ||
|
|
8a52a21a39 | ||
|
|
8d190e478f | ||
|
|
ba5ab53bdb | ||
|
|
f18752299d | ||
|
|
9e788ee711 | ||
|
|
d3b0f86f40 | ||
|
|
2f7d4c7f83 | ||
|
|
aa253e6688 | ||
|
|
773c1d6020 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
||||
data/
|
||||
world/
|
||||
|
||||
34
.gitlab/Makefile
Normal file
34
.gitlab/Makefile
Normal file
@@ -0,0 +1,34 @@
|
||||
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"
|
||||
|
||||
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
|
||||
|
||||
.PHONY: warning
|
||||
warning:
|
||||
@printf "Running a potentially destructive command. If a conflict occurs, fix the conflict and re-run the command.\n"
|
||||
@printf "Cancel with ctrl + c within 3 seconds."
|
||||
@sleep 3
|
||||
|
||||
.PHONY: make-stash-drop
|
||||
make-stash-drop:
|
||||
@if [ ! -z "$$(git stash list | grep -r 'stash@{0}.*common')" ]; then git stash drop; fi
|
||||
|
||||
.PHONY: make-update
|
||||
make-update:
|
||||
@git subtree pull --prefix .gitlab --message "Merge update from Common" -q common main
|
||||
|
||||
.PHONY: make-push
|
||||
make-push: warning
|
||||
@make make-update
|
||||
@git subtree split --branch common/$(PROJECT_NAME) --prefix .gitlab
|
||||
@git push common common/$(PROJECT_NAME):common/$(PROJECT_NAME)
|
||||
10
.gitlab/README.md
Normal file
10
.gitlab/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Adding the "common" subtree as your .gitlab folder
|
||||
|
||||
```bash
|
||||
# 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
|
||||
make make-update
|
||||
```
|
||||
29
.gitlab/make/docker.makefile
Normal file
29
.gitlab/make/docker.makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
.PHONY: docker-init
|
||||
docker-init:
|
||||
@touch VERSION
|
||||
@touch IMAGE
|
||||
|
||||
.PHONY: buildx-context
|
||||
buildx-context:
|
||||
docker buildx create --name container-builder --use --platform linux/amd64,linux/arm64
|
||||
|
||||
.PHONY: buildx-clear
|
||||
buildx-clear:
|
||||
docker buildx rm container-builder
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
docker buildx build --load . -t $(IMAGE)
|
||||
@docker buildx build --load . -t $(IMAGE_LATEST)
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
-make buildx-clear
|
||||
@make buildx-context
|
||||
docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE)
|
||||
@docker buildx build --platform linux/amd64,linux/arm64 --push . -t $(IMAGE_LATEST)
|
||||
|
||||
.PHONY: docker-release
|
||||
docker-release:
|
||||
@yq e ".services.minecraft.image = \"$(IMAGE)\"" -i docker-compose.yaml
|
||||
@make push
|
||||
5
.gitlab/make/git.makefile
Normal file
5
.gitlab/make/git.makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
.PHONY: git-release
|
||||
git-release:
|
||||
@git add .
|
||||
@git commit -m "Automated release for version $(VERSION)"
|
||||
@git tag $(VERSION)
|
||||
4
.gitlab/make/helm.makefile
Normal file
4
.gitlab/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
.gitlab/make/kaniko.makefile
Normal file
0
.gitlab/make/kaniko.makefile
Normal file
3
.gitlab/make/truenas.makefile
Normal file
3
.gitlab/make/truenas.makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
.PHONY: chart-release
|
||||
chart-release:
|
||||
@rsync -av $(CHART)/helm/ charts/$(CHART)/$(shell cat $(CHART)/VERSION)/
|
||||
@@ -1,6 +1,4 @@
|
||||
FROM openjdk:8-slim
|
||||
|
||||
COPY server.jar /server.jar
|
||||
FROM openjdk:latest
|
||||
|
||||
RUN groupadd -r minecraft -g 2000
|
||||
RUN useradd --no-log-init minecraft -u 2000 -g 2000 -m
|
||||
@@ -9,4 +7,4 @@ 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
|
||||
CMD java -Xmx"$MAX_RAM"G -Xms"$MIN_RAM"G -jar ./server.jar nogui
|
||||
|
||||
13
Makefile
Normal file
13
Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
include .gitlab/Makefile
|
||||
|
||||
.PHONY: get-server
|
||||
get-server:
|
||||
@mkdir -p world
|
||||
@echo 'eula=true' > world/eula.txt
|
||||
@docker run -it -e SERVER_VERSION=1.17.1 -v $(PWD)/world:/downloads ducoterra/get-minecraft:latest
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
docker-compose run --service-ports minecraft
|
||||
55
README.md
55
README.md
@@ -1,61 +1,34 @@
|
||||
# Minecraft
|
||||
|
||||
## Getting server.jar
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
## Running Locally
|
||||
|
||||
```bash
|
||||
docker-compose build minecraft
|
||||
docker-compose up minecraft
|
||||
# download the most recent version of minecraft
|
||||
make get-server
|
||||
|
||||
# Run the server
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
## Uploading to Docker Hub
|
||||
|
||||
In docker-compose.yaml, update the image tag to:
|
||||
1. Update the version in the VERSION file.
|
||||
2. Build and push the new version
|
||||
|
||||
```yaml
|
||||
...
|
||||
services:
|
||||
minecraft:
|
||||
build: .
|
||||
image: <your_username>/minecraft:<version>-1
|
||||
ports:
|
||||
...
|
||||
```
|
||||
|
||||
then run
|
||||
|
||||
```bash
|
||||
docker-compose push
|
||||
```
|
||||
```bash
|
||||
make build
|
||||
make 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
|
||||
Requires helm v3. Edit values.yaml and run the following:
|
||||
|
||||
```bash
|
||||
kubectl apply -f k8s/pvc
|
||||
kubectl apply -f k8s
|
||||
helm upgrade --install minecraft
|
||||
```
|
||||
|
||||
Your minecraft server will be available on port 25565
|
||||
Your minecraft server will be available on port 25565 by default.
|
||||
|
||||
## Create a Backup
|
||||
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
minecraft:
|
||||
build: .
|
||||
image: hub.ducoterra.net/ducoterra/minecraft:1.16.4
|
||||
image: ducoterra/minecraft:1.0.2
|
||||
stdin_open: true
|
||||
tty: true
|
||||
volumes:
|
||||
- ./world:/mc_data
|
||||
ports:
|
||||
- 25565:25565
|
||||
environment:
|
||||
- MAX_RAM=1
|
||||
- MIN_RAM=1
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
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
|
||||
@@ -11,13 +10,11 @@ description: A Minecraft server for kubernetes
|
||||
# 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.2
|
||||
|
||||
# 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.16.4
|
||||
appVersion: 1.0.2
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
image: ducoterra/minecraft:1.16.4
|
||||
image: ducoterra/minecraft:latest
|
||||
server_version: "1.17.1"
|
||||
|
||||
BIN
helm/minecraft-logo.png
Normal file
BIN
helm/minecraft-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 268 KiB |
@@ -4,6 +4,14 @@ groups:
|
||||
- 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"
|
||||
|
||||
@@ -13,9 +13,20 @@ spec:
|
||||
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
|
||||
containers:
|
||||
- name: {{ .Release.Name }}
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 25565
|
||||
volumeMounts:
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
image: ducoterra/minecraft:1.16.4
|
||||
image: ducoterra/minecraft:latest
|
||||
get_server:
|
||||
image: ducoterra/get-minecraft:2.0.0
|
||||
server_version: "1.17.1"
|
||||
port: 20101
|
||||
max_cpu: 4
|
||||
max_ram: 4
|
||||
|
||||
BIN
server.jar
BIN
server.jar
Binary file not shown.
Reference in New Issue
Block a user