63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: nix-cache
|
|
labels:
|
|
app: nix-cache
|
|
tier: proxy
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: nix-cache
|
|
tier: proxy
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: nix-cache
|
|
tier: proxy
|
|
spec:
|
|
initContainers:
|
|
- image: alpine:latest
|
|
name: create-directories
|
|
args:
|
|
- /bin/sh
|
|
- -c
|
|
- "mkdir -m 0755 -p /storage/var && mkdir -m 0700 -p /storage/var/ncps && mkdir -m 0700 -p /storage/var/ncps/db"
|
|
volumeMounts:
|
|
- name: nix-cache-persistent-storage
|
|
mountPath: /storage
|
|
- image: kalbasit/ncps:latest # NOTE: It's recommended to use a tag here, but we live dangerously
|
|
name: migrate-database
|
|
args:
|
|
- /bin/dbmate
|
|
- --url=sqlite:/storage/var/ncps/db/db.sqlite
|
|
- migrate
|
|
- up
|
|
volumeMounts:
|
|
- name: nix-cache-persistent-storage
|
|
mountPath: /storage
|
|
containers:
|
|
- image: kalbasit/ncps:latest # NOTE: It's recommended to use a tag here!
|
|
name: nix-cache
|
|
args:
|
|
- /bin/ncps
|
|
- serve
|
|
- --cache-hostname=cache.srv.oceanbox.io
|
|
- --cache-data-path=/storage
|
|
- --cache-database-url=sqlite:/storage/var/ncps/db/db.sqlite
|
|
- --upstream-cache=https://cache.nixos.org
|
|
- --upstream-cache=https://nix-community.cachix.org
|
|
- --upstream-public-key=cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
|
|
- --upstream-public-key=nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
|
|
ports:
|
|
- containerPort: 8501
|
|
name: http-web
|
|
volumeMounts:
|
|
- name: nix-cache-persistent-storage
|
|
mountPath: /storage
|
|
volumes:
|
|
- name: nix-cache-persistent-storage
|
|
persistentVolumeClaim:
|
|
claimName: nix-cache
|