-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #667 from GiganticMinecraft/add_debug_s1
Add manifests for debug-s1 server
- Loading branch information
Showing
10 changed files
with
452 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: CI | ||
on: | ||
push: | ||
|
||
env: | ||
IMAGE: ghcr.io/giganticminecraft/mod-downloader | ||
|
||
jobs: | ||
lint-and-test: | ||
name: Lint and test application | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.18 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
working-directory: util-scripts/mod-downloader | ||
|
||
build-image: | ||
name: Build docker image (and publish on master) | ||
needs: [lint-and-test] | ||
runs-on: ubuntu-20.04 | ||
defaults: | ||
run: | ||
working-directory: util-scripts/mod-downloader | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.IMAGE }} | ||
tags: | | ||
type=sha,prefix=sha-,suffix=,format=short | ||
type=schedule,pattern={{date 'YYYYMMDD'}} | ||
- name: Build (and push if on main) | ||
id: docker_build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./util-scripts/mod-downloader/ | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: ${{ github.ref == 'refs/heads/main' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
# すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max | ||
cache-to: type=gha,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...fests/seichi-kubernetes/apps/seichi-debug-minecraft/mcserver--debug-s1/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: seichi-minecraft | ||
|
||
resources: | ||
- "./service-monitor.yaml" | ||
- "./service.yaml" | ||
- "./stateful-set.yaml" |
17 changes: 17 additions & 0 deletions
17
...sts/seichi-kubernetes/apps/seichi-debug-minecraft/mcserver--debug-s1/service-monitor.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: ServiceMonitor | ||
metadata: | ||
labels: | ||
app: mcserver | ||
release: prometheus | ||
mcserver: debug-s1 | ||
name: mcserver-metrics--debug-s1 | ||
spec: | ||
endpoints: | ||
- interval: 30s | ||
port: jmx-metrics | ||
selector: | ||
matchLabels: | ||
app: mcserver | ||
role: metrics | ||
mcserver: debug-s1 |
21 changes: 21 additions & 0 deletions
21
...s/manifests/seichi-kubernetes/apps/seichi-debug-minecraft/mcserver--debug-s1/service.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: mcserver--debug-s1 | ||
labels: | ||
app: mcserver | ||
role: metrics | ||
mcserver: debug-s1 | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- name: minecraft | ||
port: 25565 | ||
protocol: TCP | ||
targetPort: minecraft | ||
- name: jmx-metrics | ||
port: 18321 | ||
protocol: TCP | ||
targetPort: jmx-metrics | ||
selector: | ||
mcserver: debug-s1 |
186 changes: 186 additions & 0 deletions
186
...ifests/seichi-kubernetes/apps/seichi-debug-minecraft/mcserver--debug-s1/stateful-set.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
annotations: | ||
reloader.stakater.com/auto: "true" | ||
labels: | ||
app: mcserver | ||
mcserver: debug-s1 | ||
name: mcserver--debug-s1 | ||
spec: | ||
replicas: 1 | ||
serviceName: "mcserver--debug-s1" | ||
selector: | ||
matchLabels: | ||
app: mcserver--debug-s1 | ||
mcserver: debug-s1 | ||
template: | ||
metadata: | ||
labels: | ||
app: mcserver--debug-s1 | ||
mcserver: debug-s1 | ||
spec: | ||
initContainers: | ||
- name: jmx-exporter-downloader | ||
image: busybox:1.35.0 | ||
env: | ||
- name: JMX_EXPORTER_URL | ||
value: "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.16.1/jmx_prometheus_javaagent-0.16.1.jar" | ||
volumeMounts: | ||
- name: jmx-exporter-download-volume | ||
mountPath: /root/jmx-exporter-download | ||
command: | ||
- "sh" | ||
- "-c" | ||
- 'wget -O /root/jmx-exporter-download/jmx-exporter-javaagent.jar "${JMX_EXPORTER_URL}"' | ||
|
||
containers: | ||
- resources: | ||
requests: | ||
memory: 2100Mi | ||
env: | ||
- name: MEMORY | ||
value: 2048m | ||
- name: TYPE | ||
value: PAPER | ||
- name: VERSION | ||
value: "1.12.2" | ||
- name: EULA | ||
value: "TRUE" | ||
|
||
- name: REMOVE_OLD_MODS | ||
value: "TRUE" | ||
|
||
- name: MODS | ||
# DiscordSRV: | ||
# https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.25.1/DiscordSRV-Build-1.25.1.jar | ||
# LunaChat: | ||
# https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar | ||
# MorningGlorySeeds: | ||
# https://github.com/SigureRuri/MorningGlorySeeds/releases/download/3.0/MorningGlorySeeds.jar | ||
# ViaBackwards: | ||
# https://github.com/ViaVersion/ViaBackwards/releases/download/4.4.2/ViaBackwards-4.4.2.jar | ||
# ViaVersion: | ||
# https://github.com/ViaVersion/ViaVersion/releases/download/4.4.2/ViaVersion-4.4.2.jar | ||
value: >- | ||
https://github.com/DiscordSRV/DiscordSRV/releases/download/v1.25.1/DiscordSRV-Build-1.25.1.jar, | ||
https://github.com/ucchyocean/LunaChat/releases/download/v3.0.16/LunaChat.jar, | ||
https://github.com/SigureRuri/MorningGlorySeeds/releases/download/3.0/MorningGlorySeeds.jar, | ||
https://github.com/ViaVersion/ViaBackwards/releases/download/4.4.2/ViaBackwards-4.4.2.jar, | ||
https://github.com/ViaVersion/ViaVersion/releases/download/4.4.2/ViaVersion-4.4.2.jar, | ||
- name: JVM_OPTS | ||
value: >- | ||
-javaagent:/jmx-exporter/jmx-exporter-javaagent.jar=18321:/jmx-exporter/jmx-exporter-config.yaml | ||
- name: COPY_CONFIG_DEST | ||
# /config をサーバーディレクトリにコピーするようにする | ||
# https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#optional-plugins-mods-and-config-attach-points | ||
value: /data | ||
|
||
# 設定ファイル内の ${CFG_*} の形をした部分を置き換える | ||
# https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs | ||
- name: REPLACE_ENV_VARIABLE_PREFIX | ||
value: CFG_ | ||
|
||
- name: CFG_DISCORDSRV_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: mcserver--common--config-secrets | ||
key: DISCORDSRV_TOKEN | ||
|
||
- name: CFG_MORNING_GLORY_SEEDS_WEBHOOK_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: mcserver--debug-s1--config-secrets | ||
key: MORNING_GLORY_SEEDS_WEBHOOK_URL | ||
|
||
- name: CFG_DISCORDSRV_GLOBAL_CHANNEL_ID | ||
value: "959300037844799560" | ||
|
||
- name: CFG_DISCORDSRV_CONSOLE_CHANNEL_ID | ||
value: "689841701333893163" | ||
|
||
image: itzg/minecraft-server:2022.11.0-java8-jdk | ||
name: minecraft | ||
ports: | ||
- containerPort: 25565 | ||
name: minecraft | ||
- containerPort: 18321 | ||
name: jmx-metrics | ||
|
||
startupProbe: | ||
tcpSocket: | ||
port: 25565 | ||
# 最大120秒待つ | ||
failureThreshold: 6 | ||
periodSeconds: 20 | ||
|
||
volumeMounts: | ||
# itzg/minecraft-server は /config に設定ファイルをマウントしておけばコピーをしてくれる。 | ||
# 環境変数の置き換えはPrefix等の設定が必要なので、必要になったら設定するように。 | ||
# https://github.com/itzg/docker-minecraft-server/tree/9458005b5bd78b8139e13e66c29a449a12dd6218#replacing-variables-inside-configs | ||
|
||
# 普通にマウントすると、auto-update (常に最新のvolume内容がコンテナ内から見える) の挙動を | ||
# 提供するために symlink による一時ディレクトリがマウントされることになるが、 | ||
# itzg/minecraft-server が利用するファイル同期の仕組み (itzg/mc-image-helper) は | ||
# symlink を展開してしまうため、設定ファイルのパスが壊れてしまう。 | ||
# | ||
# subPathを利用してマウントすればsymlinkが作られることを回避できるためそのようにしている。 | ||
# 参考: https://stackoverflow.com/a/63114800 | ||
# 参考: https://stackoverflow.com/a/50687707 | ||
|
||
# サーバーの設定ファイル | ||
- name: common-mcserver-configs | ||
mountPath: /config/bukkit.yml | ||
subPath: bukkit.yml | ||
- name: common-mcserver-configs | ||
mountPath: /config/paper.yml | ||
subPath: paper.yml | ||
- name: common-mcserver-configs | ||
mountPath: /config/server.properties | ||
subPath: server.properties | ||
- name: common-mcserver-configs | ||
mountPath: /config/spigot.yml | ||
subPath: spigot.yml | ||
|
||
# DiscordSRV プラグインの設定ファイル | ||
- name: common-mcserver-plugin-configs | ||
mountPath: /plugins/DiscordSRV/config.yml | ||
subPath: DiscordSRV-config.yml | ||
- name: common-mcserver-plugin-configs | ||
mountPath: /plugins/DiscordSRV/messages.yml | ||
subPath: DiscordSRV-messages.yml | ||
|
||
# MorningGlorySeeds プラグインの設定ファイル | ||
- name: common-mcserver-plugin-configs | ||
mountPath: /plugins/MorningGlorySeeds/config.yml | ||
subPath: MorningGlorySeeds-config.yml | ||
|
||
# LunaChat プラグインの設定ファイル | ||
- name: common-mcserver-plugin-configs | ||
mountPath: /plugins/LunaChat/config.yml | ||
subPath: LunaChat-config.yml | ||
|
||
# JMX exporter 周りのファイルが入ったボリューム達のマウント設定 | ||
- name: jmx-exporter-download-volume | ||
mountPath: /jmx-exporter/jmx-exporter-javaagent.jar | ||
subPath: jmx-exporter-javaagent.jar | ||
- name: common-jmx-exporter-config | ||
mountPath: /jmx-exporter/jmx-exporter-config.yaml | ||
subPath: jmx-exporter-config.yaml | ||
|
||
volumes: | ||
- name: common-mcserver-configs | ||
configMap: | ||
name: common-mcserver-configs | ||
- name: common-mcserver-plugin-configs | ||
configMap: | ||
name: common-mcserver-plugin-configs | ||
|
||
# JMX exporterをinitContainerでダウンロードしてBugneeCordに受け渡すためのvolume | ||
- name: jmx-exporter-download-volume | ||
emptyDir: {} | ||
- name: common-jmx-exporter-config | ||
configMap: | ||
name: common-jmx-exporter-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM golang:1.18-bullseye as builder | ||
WORKDIR /go/src | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
COPY . . | ||
RUN go build -o /mod-downloader | ||
|
||
FROM gcr.io/distroless/static:nonroot | ||
|
||
COPY --from=builder --chown=nonroot:nonroot /mod-downloader /bin/ | ||
ENV MINIO_ENDPOINT="" | ||
ENV MINIO_ACCESS_KEY="" | ||
ENV MINIO_ACCESS_SECRET="" | ||
ENV BUCKET_NAME="" | ||
ENV BUCKET_PREFIX_NAME="" | ||
ENV DOWNLOAD_TARGET_DIR_PATH="" | ||
CMD ["/bin/mod-downloader"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module github.com/GiganticMinecraft/mod-downloader | ||
|
||
go 1.18 | ||
|
||
require ( | ||
github.com/dustin/go-humanize v1.0.0 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/klauspost/compress v1.15.9 // indirect | ||
github.com/klauspost/cpuid/v2 v2.1.0 // indirect | ||
github.com/minio/md5-simd v1.1.2 // indirect | ||
github.com/minio/minio-go/v7 v7.0.37 // indirect | ||
github.com/minio/sha256-simd v1.0.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/rs/xid v1.4.0 // indirect | ||
github.com/sirupsen/logrus v1.9.0 // indirect | ||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect | ||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect | ||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
gopkg.in/ini.v1 v1.66.6 // indirect | ||
) |
Oops, something went wrong.