Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The Go build needs only the Go sources and the module files.
java/
.git
.claude
deploy/
bin/
46 changes: 46 additions & 0 deletions .github/workflows/chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: chart

# Helm chart checks: lint, render and validate the rendered manifests against the Kubernetes schemas.
# None of them needs a cluster.

on:
pull_request:
paths:
- "deploy/helm/**"
- ".github/workflows/chart.yml"
push:
branches: [main]
paths:
- "deploy/helm/**"
- ".github/workflows/chart.yml"

permissions:
contents: read

env:
KUBECONFORM_VERSION: "0.6.7"

jobs:
helm:
name: Helm chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up Helm
uses: azure/setup-helm@v5

- name: Lint the chart
run: helm lint deploy/helm/grus -f deploy/helm/grus/ci/lint-values.yaml

- name: Install kubeconform
run: |
curl -fsSL "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" \
| tar -xz -C "$RUNNER_TEMP" kubeconform
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"

- name: Validate the rendered manifests
run: helm template grus deploy/helm/grus -f deploy/helm/grus/ci/lint-values.yaml | kubeconform -strict -ignore-missing-schemas -summary
47 changes: 47 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: go

# Controller and agent checks: formatting, vet, tests and builds of the Go module. The guard at the end
# keeps the agent free of the Kubernetes client, which only the controller may depend on.

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

jobs:
go:
name: Go
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true

- name: Check formatting
run: test -z "$(gofmt -l .)"

- name: Vet
run: go vet ./...

- name: Test
run: go test ./...

- name: Build the commands
run: go build ./cmd/...

- name: Keep the Kubernetes client out of the agent
run: |
if go list -deps ./cmd/grus-agent | grep -q '^k8s.io/'; then
echo "::error::cmd/grus-agent must not depend on k8s.io/*"
exit 1
fi
42 changes: 42 additions & 0 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: java

# Gradle build of the Java modules (SDK, Velocity plugin, Minestom demo) under java/.

on:
pull_request:
paths:
- "java/**"
- ".github/workflows/java.yml"
push:
branches: [main]
paths:
- "java/**"
- ".github/workflows/java.yml"

permissions:
contents: read

jobs:
gradle:
name: Gradle
runs-on: ubuntu-latest
defaults:
run:
working-directory: java
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up JDK 25
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25.0.3"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Build
run: ./gradlew build --max-workers=2
17 changes: 17 additions & 0 deletions .github/workflows/pr-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pr-lint

# Conventional Commits on the pull request title, which is the squash commit that lands on main, and
# on every commit of the branch. release-please reads the commit types for the version and the
# changelog. The commit rules are in commitlint.config.mjs, which the reusable workflow reads.

on:
pull_request:
types: [opened, edited, synchronize, reopened]

permissions:
contents: read
pull-requests: read

jobs:
pr-lint:
uses: OneLiteFeatherNET/workflows/.github/workflows/pr-lint.yml@v2.9.1
106 changes: 106 additions & 0 deletions .github/workflows/prototype-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: prototype-images

# Manual prototype images for the feather-core deployment. Tags are prototype-<short sha>; releases are
# not involved, so this does not wait for release-please. The controller image is built from the root
# Dockerfile, the Velocity and Minestom images from the Docker contexts that Gradle writes.

on:
workflow_dispatch:

permissions:
contents: read

jobs:
meta:
name: Tag
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Derive the prototype tag
id: tag
run: echo "tag=prototype-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"

grus:
name: Controller image
needs: meta
permissions:
contents: read
id-token: write # keyless cosign signing
uses: OneLiteFeatherNET/workflows/.github/workflows/docker-publish.yml@v2.9.1
with:
image-name: "onelitefeather/grus"
version: ${{ needs.meta.outputs.tag }}
context: "."
dockerfile: "Dockerfile"
secrets: inherit

java-context:
name: Java Docker contexts
runs-on: ubuntu-latest
defaults:
run:
working-directory: java
steps:
- name: Checkout
uses: actions/checkout@v7
with:
persist-credentials: false

- name: Set up JDK 25
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25.0.3"

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6

- name: Write the Docker contexts
run: ./gradlew :grus-velocity:dockerContext :grus-demo-minestom:dockerContext --max-workers=2

- name: Upload the Velocity context
uses: actions/upload-artifact@v7
with:
name: velocity-context
path: java/grus-velocity/build/docker-context
include-hidden-files: false
if-no-files-found: error

- name: Upload the Minestom demo context
uses: actions/upload-artifact@v7
with:
name: demo-minestom-context
path: java/grus-demo-minestom/build/docker-context
include-hidden-files: false
if-no-files-found: error

velocity:
name: Velocity image
needs: [meta, java-context]
permissions:
contents: read
id-token: write # keyless cosign signing
uses: OneLiteFeatherNET/workflows/.github/workflows/docker-publish.yml@v2.9.1
with:
image-name: "onelitefeather/grus-velocity"
version: ${{ needs.meta.outputs.tag }}
context: "docker-context"
dockerfile: "docker-context/Dockerfile"
artifact-name: "velocity-context"
secrets: inherit

demo-minestom:
name: Minestom demo image
needs: [meta, java-context]
permissions:
contents: read
id-token: write # keyless cosign signing
uses: OneLiteFeatherNET/workflows/.github/workflows/docker-publish.yml@v2.9.1
with:
image-name: "onelitefeather/grus-demo-minestom"
version: ${{ needs.meta.outputs.tag }}
context: "docker-context"
dockerfile: "docker-context/Dockerfile"
artifact-name: "demo-minestom-context"
secrets: inherit
21 changes: 21 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: release-please

# One release for the whole repository. release-please keeps the release pull request up to date on
# main; when it is merged, the release is created and tagged. Tags created with GITHUB_TOKEN start no
# workflow, so nothing here listens for a tag push.
#
# Prototype: this workflow does not publish images or SBOMs yet. Docker publishing on release comes
# later, once the controller leaves the prototype stage; until then the prototype-images workflow
# builds the images on demand.

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
release-please:
uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2.9.1
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# syntax=docker/dockerfile:1

# Controller image: one static binary (cmd/grus) on distroless, running as the nonroot user.

FROM golang:1.26.11-alpine AS build
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o /out/grus ./cmd/grus

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/grus /grus
USER 65532:65532
ENTRYPOINT ["/grus"]
CMD ["controller"]
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Grus

Grus is OneLiteFeather's minimal control plane for Minecraft server pools. It starts, watches and stops
server instances on Kubernetes, hands out their templates and status over a small HTTP API and an event
stream, and is meant to replace CloudNet for the network.

## Status

Prototype. The controller, the Kubernetes driver, the Velocity plugin and a Minestom demo server are being
built toward one demo deployment. Nothing here is released or production ready, and the API may change.

## Layout

- `cmd/grus`: the controller binary (`grus controller`).
- `cmd/grus-agent`: the node-side agent. It must not depend on `k8s.io/*`.
- `internal/`: domain model, controller, drivers, store and templates.
- `api/`: the HTTP API contract (OpenAPI).
- `java/`: Gradle build of the Java modules (SDK, Velocity plugin, Minestom demo).
- `deploy/helm/grus`: the Helm chart.

## Development

Go tests and checks:

```sh
go test ./...
```

Java build (Java 25):

```sh
cd java && ./gradlew build
```

Prototype images are built by hand from the `prototype-images` workflow (`workflow_dispatch`). They are
tagged `prototype-<short sha>` and pushed to the OneLiteFeather registry. Release images are not published
yet.

## License

Apache License 2.0. See [LICENSE](LICENSE).
22 changes: 22 additions & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Conventional Commits enforcement (commits + PR title).
// https://www.conventionalcommits.org
// release-please (release-please-config.json) parses commit types to decide version bumps and
// changelog sections, so this isn't just style - a non-conventional commit silently fails to
// bump the version or gets dropped from the changelog.
// The pr-lint workflow reads this file for the commit-lint job.
export default {
extends: ['@commitlint/config-conventional'],
// Merge commits inside a pull request never reach main (squash merge), and their bodies list
// conflicts and long lines, so they are not linted. defaultIgnores stays on.
defaultIgnores: true,
ignores: [(message) => /^Merge /.test(message)],
rules: {
'header-max-length': [2, 'always', 100],
'scope-case': [2, 'always', 'lower-case'],
'type-enum': [
2,
'always',
['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test'],
],
},
};
Loading
Loading