Install rgallery within a Kubernetes cluster

Helm chart coming soon.

Prerequisites

The following prerequisites are required to install rgallery within a Kubernetes cluster:

Install rgallery manifests

You can install rgallery in your Kubernetes cluster using the provided manifest files.

Download individual manifest files

If you prefer not to clone the entire repository, you can download and apply each manifest individually:

Create a directory for the manifests:

mkdir -p rgallery-manifests
cd rgallery-manifests

Download all manifest files:

curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.Namespace-rgallery.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/apps-v1.StatefulSet-rgallery.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.ConfigMap-rgallery-config.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.PersistentVolume-rgallery-cache.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.PersistentVolume-rgallery-media.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.PersistentVolumeClaim-rgallery-cache.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.PersistentVolumeClaim-rgallery-media.yaml
curl -O https://raw.githubusercontent.com/robbymilo/rgallery/main/production/manifests/v1.Service-rgallery.yaml

Apply all manifests:

Note: The manifests run rgallery as a user with UID 1000 and GID 1000. The data, media, and cache directories must have appropriate read/write permissions for this user.

kubectl apply -f .

Manifest Details

Below are the contents of each manifest file:

Namespace

apiVersion: v1
kind: Namespace
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery

StatefulSet

apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery
  namespace: rgallery
spec:
  replicas: 1
  selector:
    matchLabels:
      name: rgallery
  serviceName: rgallery
  template:
    metadata:
      annotations:
        configVersion: d41d8cd98f00b204e9800998ecf8427e
      labels:
        name: rgallery
    spec:
      containers:
      - command:
        - /usr/bin/rgallery
        - --include-originals=false
        env:
        - name: TZ
          value: Europe/Stockholm
        image: robbymilo/rgallery:latest
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 4
          httpGet:
            path: /healthz
            port: 3000
          initialDelaySeconds: 1
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 10
        name: rgallery
        ports:
        - containerPort: 3000
          name: rgallery
        - containerPort: 3001
          name: metrics
        readinessProbe:
          failureThreshold: 4
          httpGet:
            path: /healthz
            port: 3000
          initialDelaySeconds: 1
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 10
        volumeMounts:
        - mountPath: /cache
          name: rgallery-cache
        - mountPath: /media
          name: rgallery-media
        - mountPath: /data
          name: rgallery-data
        - mountPath: /config
          name: rgallery-config
      volumes:
      - name: rgallery-media
        persistentVolumeClaim:
          claimName: rgallery-media
      - name: rgallery-cache
        persistentVolumeClaim:
          claimName: rgallery-cache
      - name: rgallery-data
        persistentVolumeClaim:
          claimName: rgallery-data
      - configMap:
          name: rgallery-config
        name: rgallery-config
  updateStrategy:
    type: RollingUpdate

ConfigMap

For config information, see configuration file.

apiVersion: v1
data:
  config.yml: |-
    aliases:
      lenses: # exif:alias
        "70.0-200.0 mm f/f2.8": "AF-S Nikkor 70-200mm f/2.8G ED VR II"
        "VR 70-200mm f/2.8G": "AF-S Nikkor 70-200mm f/2.8G ED VR II"
        "AF-S Nikkor 70-200mm f/2.8G ED VR II": "AF-S Nikkor 70-200mm f/2.8G ED VR II"
kind: ConfigMap
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-config
  namespace: rgallery

PersistentVolume for data directory

Note: This volume should be on a high speed SSD for best performance.

apiVersion: v1
kind: PersistentVolume
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-data
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 20Gi
  hostPath:
    path: /mnt/rgallery/data
  storageClassName: ""

PersistentVolumeClaim for data directory

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-data
  namespace: rgallery
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: ""
  volumeName: rgallery-data

PersistentVolume for cached image thumbnails and video transcodes

apiVersion: v1
kind: PersistentVolume
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-cache
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 20Gi
  hostPath:
    path: /mnt/rgallery/cache
  storageClassName: ""

PersistentVolumeClaim for cached image thumbnails and video transcodes

Note: This volume should be on a high speed SSD for best performance.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-cache
  namespace: rgallery
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: ""
  volumeName: rgallery-cache

PersistentVolume for media directory

Note: This volume can be on slower storage, such as a hard drive.

apiVersion: v1
kind: PersistentVolume
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-media
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 20Gi
  hostPath:
    path: /mnt/rgallery/media
  storageClassName: ""

PersistentVolumeClaim for media directory

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery-media
  namespace: rgallery
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: ""
  volumeName: rgallery-media

Service

apiVersion: v1
kind: Service
metadata:
  labels:
    name: rgallery
    tanka.dev/environment: d27bf86124985ad6e55c06083006bc0c8c253f895c2fcb30
  name: rgallery
  namespace: rgallery
spec:
  ports:
  - name: rgallery-rgallery
    port: 3000
    targetPort: 3000
  - name: rgallery-metrics
    port: 3001
    targetPort: 3001
  selector:
    name: rgallery
  type: ClusterIP