Squashed 'minecraft/' changes from 0d2235b..0520668
0520668 Merge update from Common 4497566 Squashed '.gitlab/' changes from 731ada6..cf41f2e2de53deRemove .commona85a7aaMerge branch 'common-subtree'a074005Add '.gitlab/' from commit '731ada6a3d65b2347ccf204cfe09ee278a4f0594'422f4d4remove .gitlab subtree731ada6Merge branch 'make-update-fixes' into 'main'c3e6d73Switch to "subtree split" push strategy3c91292Make user stash their own damn changesd86b505Add PROJECT_NAME and VERSION9d0c9c6Update README with "common" remote30fb8c2Merge branch 'docker-buidlx-overhaul' into 'main'fd96b3fMerge branch 'git-release' into 'main'a6053edAdd make git-release3563c5cAdd make docker-release40a217bUse buildx to create multi-arch images5e2bc5fSwitch to container-builder buildx platforma5aa0caAutomated release for version 1.0.265b3a84make subtree "split" overhauld181d45Overhaul for get-server v. 2.0.09eed509Don't squash on pullb07a2c0Run update after make-push22a952dRemove warning from make-update0f6eeb7Add make-stash-drop commandf81d846Only pop stash if changesafed93fAdd warning to make-update and make-push6239af7Ignore git stash pop failures2f76759Add make-push command66b4fdbIgnore subtree pull failuresda69418Switch to url-based subtree with `make-update`ba12c92Remove docker-run74a4a4eTransition to .gitlab prefix3e8ca71Add chart-release to truenas.makefile4146777Add helm.makefile8a52a21Switch to multi-makefile strategyf187522init git-subtree-dir: minecraft git-subtree-split: 05206686ad84ad388c98578becfc5cfe3a13fdb4
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
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
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
data/
|
data/
|
||||||
|
world/
|
||||||
|
|||||||
18
.gitlab/Makefile
Normal file
18
.gitlab/Makefile
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
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: make-update
|
||||||
|
make-update:
|
||||||
|
@git subtree pull --prefix .gitlab --squash --message "Merge update from Common" -q git@gitlab.ducoterra.net:services/common.git main
|
||||||
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
|
||||||
|
```
|
||||||
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
5
.gitlab/make/truenas.makefile
Normal file
5
.gitlab/make/truenas.makefile
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.PHONY: chart-release
|
||||||
|
chart-release:
|
||||||
|
@rsync -av $(CHART)/helm/ charts/$(CHART)/$(shell cat $(CHART)/VERSION)/
|
||||||
|
@git add charts/$(CHART)
|
||||||
|
@git commit -m "Automated release for chart $(CHART) version $(shell cat $(CHART)/VERSION)" -e
|
||||||
14
Makefile
14
Makefile
@@ -1 +1,13 @@
|
|||||||
include .common/Makefile
|
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
|
# Minecraft
|
||||||
|
|
||||||
## Getting server.jar
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
## Running Locally
|
## Running Locally
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose build minecraft
|
# download the most recent version of minecraft
|
||||||
docker-compose up minecraft
|
make get-server
|
||||||
|
|
||||||
|
# Run the server
|
||||||
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
## Uploading to Docker Hub
|
## 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
|
```bash
|
||||||
...
|
make build
|
||||||
services:
|
make push
|
||||||
minecraft:
|
```
|
||||||
build: .
|
|
||||||
image: <your_username>/minecraft:<version>-1
|
|
||||||
ports:
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
then run
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker-compose push
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running in kubernetes
|
## Running in kubernetes
|
||||||
|
|
||||||
In k8s/deploy.yaml, edit the deploy
|
Requires helm v3. Edit values.yaml and run the following:
|
||||||
|
|
||||||
```yaml
|
|
||||||
...
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: minecraft
|
|
||||||
image: <your image from above>
|
|
||||||
ports:
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run the following
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl apply -f k8s/pvc
|
helm upgrade --install minecraft
|
||||||
kubectl apply -f k8s
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Your minecraft server will be available on port 25565
|
Your minecraft server will be available on port 25565 by default.
|
||||||
|
|
||||||
## Create a Backup
|
## Create a Backup
|
||||||
|
|
||||||
|
|||||||
13
docker-compose.yaml
Normal file
13
docker-compose.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
minecraft:
|
||||||
|
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
|
apiVersion: v2
|
||||||
name: minecraft
|
name: minecraft
|
||||||
description: A Minecraft server for kubernetes
|
description: A Minecraft server for kubernetes
|
||||||
|
|
||||||
# A chart can be either an 'application' or a 'library' chart.
|
# 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
|
# 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
|
# 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.
|
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||||
type: application
|
type: application
|
||||||
|
|
||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# 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.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 1.1.0
|
version: 1.0.2
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# 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
|
# 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.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
appVersion: 1.0.0
|
appVersion: 1.0.2
|
||||||
|
|||||||
@@ -23,13 +23,6 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /downloads
|
- mountPath: /downloads
|
||||||
name: data
|
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:
|
containers:
|
||||||
- name: {{ .Release.Name }}
|
- name: {{ .Release.Name }}
|
||||||
image: {{ .Values.image }}
|
image: {{ .Values.image }}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
image: ducoterra/minecraft:latest
|
image: ducoterra/minecraft:latest
|
||||||
get_server:
|
get_server:
|
||||||
image: ducoterra/get-minecraft:latest
|
image: ducoterra/get-minecraft:2.0.0
|
||||||
server_version: "1.17.1"
|
server_version: "1.17.1"
|
||||||
port: 20101
|
port: 20101
|
||||||
max_cpu: 4
|
max_cpu: 4
|
||||||
|
|||||||
Reference in New Issue
Block a user