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
71 changes: 68 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,70 @@
# Cozystack external-apps demo
# external-apps-example

Read more about Cozystack at [cozystack.io](https://cozystack.io).
External applications catalog example for [Cozystack](https://cozystack.io). Works like a brew tap -- add this repo to your cluster and get extra apps in the Cozystack dashboard.

Reference documentation for Cozystack external-apps can be found at [cozystack.io/docs/applications/external](https://cozystack.io/docs/applications/external/).
Currently provides managed Minecraft server and plugin apps powered by [minecraft-operator](https://github.com/lexfrei/minecraft-operator).

## Installation

Apply `init.yaml` to bootstrap the catalog in your Cozystack cluster:

```bash
kubectl apply --filename https://raw.githubusercontent.com/cozystack/external-apps-example/main/init.yaml
```

This creates a FluxCD `GitRepository` source and a `HelmRelease` that deploys the platform chart. The platform chart registers all available apps via `ApplicationDefinition` CRDs, so they appear in the Cozystack dashboard automatically.

## Available Apps

| App | Kind | Description |
| --- | --- | --- |
| minecraft-server | `MinecraftServer` | Managed PaperMC server with automatic updates, backups, and resource limits |
| minecraft-plugin | `MinecraftPlugin` | Managed plugin installation from [Hangar](https://hangar.papermc.io/) or direct URL with auto-updates |

Both apps are powered by [minecraft-operator](https://github.com/lexfrei/minecraft-operator), which is deployed automatically by the platform chart from `oci://ghcr.io/lexfrei/charts/minecraft-operator`.

## Example

Create a Minecraft server with the BlueMap plugin (see `examples/minecraft.yaml`):

```yaml
apiVersion: apps.cozystack.io/v1alpha1
kind: MinecraftServer
metadata:
name: survival
namespace: tenant-root
spec:
updateStrategy: latest
memoryLimit: 2Gi
cpuLimit: 2000m
serviceType: NodePort
---
apiVersion: apps.cozystack.io/v1alpha1
kind: MinecraftPlugin
metadata:
name: bluemap
namespace: tenant-root
spec:
sourceType: hangar
project: BlueMap
updateStrategy: latest
instanceSelector:
matchLabels:
app.kubernetes.io/instance: minecraft-survival
endpoints:
- name: web
port: 8100
protocol: HTTP
```

## Repository Structure

```text
init.yaml # Bootstrap manifest (GitRepository + HelmRelease)
packages/
core/platform/ # Platform chart: namespaces, HelmCharts, HelmReleases, ApplicationDefinitions
apps/minecraft-server/ # Helm chart wrapping PaperMCServer CRD
apps/minecraft-plugin/ # Helm chart wrapping Plugin CRD
examples/
minecraft.yaml # Server + BlueMap plugin example
```
28 changes: 28 additions & 0 deletions examples/minecraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
apiVersion: apps.cozystack.io/v1alpha1
kind: MinecraftServer
metadata:
name: survival
namespace: tenant-root
spec:
updateStrategy: latest
memoryLimit: 2Gi
cpuLimit: 2000m
serviceType: NodePort
Comment thread
coderabbitai[bot] marked this conversation as resolved.
---
apiVersion: apps.cozystack.io/v1alpha1
kind: MinecraftPlugin
metadata:
name: bluemap
namespace: tenant-root
spec:
sourceType: hangar
project: BlueMap
updateStrategy: latest
instanceSelector:
matchLabels:
app.kubernetes.io/instance: minecraft-survival
endpoints:
- name: web
port: 8100
protocol: HTTP
139 changes: 0 additions & 139 deletions hack/update-crd.sh

This file was deleted.

2 changes: 1 addition & 1 deletion init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ spec:
kind: GitRepository
name: external-apps
namespace: cozy-public
version: '*'
reconcileStrategy: Revision
Empty file removed packages/apps/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions packages/apps/minecraft-plugin/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: minecraft-plugin
description: Managed Minecraft plugin with automatic version management
type: application
version: 0.0.0
appVersion: "1.0.0"
4 changes: 4 additions & 0 deletions packages/apps/minecraft-plugin/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export NAME=minecraft-plugin
export NAMESPACE=external-minecraft-operator

include ../../../scripts/package.mk
39 changes: 39 additions & 0 deletions packages/apps/minecraft-plugin/templates/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: mc.k8s.lex.la/v1beta1
kind: Plugin
metadata:
name: {{ .Release.Name }}
spec:
source:
type: {{ .Values.sourceType }}
{{- if eq .Values.sourceType "hangar" }}
project: {{ .Values.project | quote }}
{{- end }}
{{- if eq .Values.sourceType "url" }}
url: {{ .Values.url | quote }}
{{- if .Values.checksum }}
checksum: {{ .Values.checksum | quote }}
{{- end }}
{{- end }}
updateStrategy: {{ .Values.updateStrategy }}
{{- if .Values.version }}
version: {{ .Values.version | quote }}
{{- end }}
instanceSelector:
{{- if .Values.instanceSelector.matchLabels }}
matchLabels:
{{- range $key, $value := .Values.instanceSelector.matchLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- else }}
matchLabels: {}
{{- end }}
{{- if .Values.endpoints }}
endpoints:
{{- range .Values.endpoints }}
- name: {{ .name | quote }}
port: {{ .port }}
{{- if .protocol }}
protocol: {{ .protocol }}
{{- end }}
{{- end }}
{{- end }}
Loading