mkaczanowski / pastebin

Simple, fast, standalone pastebin service
MIT License
155 stars 27 forks source link

Is there any way to specify the file path for the storage/database? #19

Closed andrewthetechie closed 3 years ago

andrewthetechie commented 3 years ago

I'd like to run pastebin in k8s on a PV, but to do so need to mount that volume to a path for pastebin to write to. I think from looking at the code, the app sets up a temp dir and database every time (my rust isn't super sharp, so I might be wrong)?

Is there any way to specify a file path for storage?

mkaczanowski commented 3 years ago

This is a snippet from my private helm chart:

    spec:
      containers:
      - image: {{ .Values.image }}
        imagePullPolicy: Always
        name: {{ .Chart.Name }}
        args: 
          - "--port=8080"
          - "--address=0.0.0.0"
          - "--uri-prefix=/pastebin"
          - "--uri=http://{{ .Values.domain }}/pastebin"
          - "--db=/var/lib/pastebin/pastebin.db"

.....

        volumeMounts:
        - mountPath: /var/lib/pastebin
          name: var-lib-pastebin

PVC:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  labels:
    app: {{ .Chart.Name }}
    project: {{ .Chart.Name }}
  name: {{ .Chart.Name }}
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi