Files
2026-11-18 22:59:22 -03:00

106 lines
4.2 KiB
YAML

# Shared projects live in /data (`--data`) on the HDD: PV /srv/hdd/papercraft, class hdd-storage, Retain (same pattern as actual, kavita, ...).
# --library: every project in /data is listed at /library and synced to every device that opens the site, with no link
# needed. There are no accounts, so the Tailnet-only ingress is the whole access boundary; never expose this publicly.
# Tailnet access (DNS, TLS, ingress) is added with `expose papercraft/papercraft papercraft`; see deploy/README.md.
apiVersion: v1
kind: Namespace
metadata:
name: papercraft
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-hdd-papercraft
spec:
capacity: {storage: 5Gi}
accessModes: [ReadWriteOnce]
persistentVolumeReclaimPolicy: Retain
storageClassName: hdd-storage
volumeMode: Filesystem
local: {path: /srv/hdd/papercraft}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- {key: kubernetes.io/hostname, operator: In, values: [kubernets]}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: papercraft-data
namespace: papercraft
spec:
accessModes: [ReadWriteOnce]
storageClassName: hdd-storage
volumeName: pv-hdd-papercraft
resources:
requests: {storage: 5Gi}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: papercraft
namespace: papercraft
spec:
replicas: 1
selector:
matchLabels: {app: papercraft}
template:
metadata:
labels: {app: papercraft}
spec:
securityContext: {fsGroup: 10001}
volumes:
- name: data
persistentVolumeClaim: {claimName: papercraft-data}
- name: tmp
emptyDir: {sizeLimit: 256Mi}
containers:
- name: web
image: localhost:32000/papercraft-web:0.11.1-dc2bd5e
args: ["--library", "--agents", "opencode", "--allow-origin", "https://papercraft.marcospaulo.dev.br,https://papercraft-relay.marcospaulo.dev.br"]
# Claude Code is off until Secret papercraft-agents has CLAUDE_CODE_OAUTH_TOKEN; then add it back ("claude,opencode").
# Agent credentials come from Secret papercraft-agents (CLAUDE_CODE_OAUTH_TOKEN or ANTHROPIC_API_KEY, opencode's
# provider keys). Optional, so the pod starts without it; the agents then report that they are not signed in.
envFrom:
- secretRef: {name: papercraft-agents, optional: true}
env:
# The root filesystem is read-only: the CLIs keep config and sessions under HOME on the data volume.
- {name: HOME, value: /data/agent-home}
# The team invite page (/join/<token>): a Logto machine app allowed to create users, and the team
# organization, from Secret papercraft-join. Optional: without it the page is off.
- {name: PAPERCRAFT_JOIN_LOGTO_ENDPOINT, value: "https://auth.marcospaulo.dev.br"}
- {name: PAPERCRAFT_JOIN_CLIENT_ID, valueFrom: {secretKeyRef: {name: papercraft-join, key: client-id, optional: true}}}
- {name: PAPERCRAFT_JOIN_CLIENT_SECRET, valueFrom: {secretKeyRef: {name: papercraft-join, key: client-secret, optional: true}}}
- {name: PAPERCRAFT_JOIN_ORG, valueFrom: {secretKeyRef: {name: papercraft-join, key: org, optional: true}}}
volumeMounts:
- {name: data, mountPath: /data}
- {name: tmp, mountPath: /tmp}
ports:
- containerPort: 8787
readinessProbe:
httpGet: {path: /index.html, port: 8787}
livenessProbe:
httpGet: {path: /index.html, port: 8787}
initialDelaySeconds: 10
resources:
# Two agent processes at once (the relay's default cap), a Node CLI each.
# Ephemeral: container logs and the 256Mi /tmp emptyDir; the root filesystem is read-only.
requests: {cpu: 100m, memory: 512Mi, ephemeral-storage: 256Mi}
limits: {cpu: "2", memory: 2Gi, ephemeral-storage: 1Gi}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: {drop: [ALL]}
---
apiVersion: v1
kind: Service
metadata:
name: papercraft
namespace: papercraft
spec:
selector: {app: papercraft}
ports:
- port: 80
targetPort: 8787