Compare commits

..

17 Commits

Author SHA1 Message Date
59bdb65dd5 remove securityContext to allow s6 init to run as root 2026-01-18 04:58:51 +00:00
6bd7d30074 - name: YES_I_WANT_S6_NOT_TO_SUCK
value: "please"
2026-01-12 18:35:17 +11:00
aec7d5b3bb Added emptyDir for /run. s6 is "fun" 2026-01-12 18:19:48 +11:00
6483481350 applied runAsUser, Group and fsGroup of 1000 for securitys6 role 2026-01-12 18:09:36 +11:00
b09719cfa8 I'm gonna wash that SCC right out of my hair 2026-01-12 17:33:58 +11:00
ac4402349d no need for load balancer. back to clusterip 2026-01-06 11:34:41 +11:00
19a9126fae reorganised 2025-12-30 19:58:08 +11:00
8aa0a67cd1 added argocd.argoproj.io/managed-by: openshift-gitops to namespace 2025-12-25 12:43:18 +11:00
1c982a8b3c added app.kubernetes.io/instance: calibre 2025-12-25 12:27:18 +11:00
2ef09ffd85 added app.kubernetes.io/instance: calibre 2025-12-25 12:24:44 +11:00
124097e937 added app.kubernetes.io/instance: calibre 2025-12-25 12:23:33 +11:00
7fd9dda0bb added app.kubernetes.io/instance: calibre 2025-12-25 12:21:29 +11:00
b1d9bb1cf5 Moved to nfs-csi for flexibility and snapshots 2025-12-24 18:08:46 +11:00
f9752ed1a0 Testing new metallb load balancer 2025-12-18 14:23:00 +11:00
81ba8a8a2f Fixed use of oc vs kubectl
Fixed short image names
2025-12-12 22:42:20 +11:00
Conan Scott
4997586765 updated Readme.MD 2025-11-25 19:31:20 +11:00
Conan Scott
5373d86539 Addded deloyment script and scc-updates 2025-11-25 19:29:05 +11:00
13 changed files with 63 additions and 102 deletions

View File

@@ -1,43 +1 @@
# Kubernetes deployment of calibre-web Run deploy.sh to deploy **_calibre web_** to OCP
This is a **Kubernetes** deployment of [calibre-web](https://github.com/janeczku/calibre-web) application which uses [linuxserver/calibre-web](https://hub.docker.com/r/linuxserver/calibre-web) docker image.
## How to
**Note** This deployment assumes the Kubernetes cluster runs the [NGINX Ingress Controller](https://kubernetes.github.io/ingress-nginx) as ingress controller. If you use another ingress controller, you will have to adapt `ingress.yml` accordingly.
git clone https://github.com/devtud/calibre-kubernetes
Edit `ingress.yml` and replace your domain name on this line:
```yml
- host: <your-domain>
```
Open `deployment.yml` and adapt the two values on the following lines according to your needs (the user id and group id which own the files on the host machine - **do not set it as root!**).
```yml
- name: PUID
value: "1001"
- name: PGID
value: "1001"
```
Apply the Kubernetes resources:
kubectl apply -f ns.yml
kubectl apply -f pv_books.yml
kubectl apply -f pv_config.yml
kubectl apply -f pvc_books.yml
kubectl apply -f pvc_config.yml
kubectl apply -f deployment.yml
kubectl apply -f service.yml
kubectl apply -f ingress.yml
**Important** Even though you can access the deployed `calibre-web` app at your address, you won't be able to use it, because neither the calibre-web app nor the docker image provide a Calibre database. You have to get a Calibre database first and upload it to `/var/data/calibre/books/metadata.db` (note that this is the path on your host machine where the persistent volume [pv_books.yml](pv_books.yml) is pointing to). One way of doing this is to install a fresh Calibre on your computer and copy the `metadata.db` file from your computer to the mentioned path.
After you open the web interface, in the config screen put the following values:
- `/books` for the db path
- `/usr/bin/ebook-convert` for the converter path
- `/usr/bin/unrar` for the unrar path

View File

@@ -0,0 +1,24 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: calibre
namespace: openshift-gitops
annotations:
spec:
orphanedResources:
warn: false # Disable warning
project: default
destination:
server: https://kubernetes.default.svc
source:
repoURL: https://gitea.apilab.us/cscott/calibre.git
targetRevision: main
path: manifests
syncPolicy:
automated:
prune: true
selfHeal: false
syncOptions:
- CreateNamespace=true
- ApplyOutOfSyncOnly=true
- PruneLast=true

9
manifests/deploy.sh Executable file
View File

@@ -0,0 +1,9 @@
oc apply -f ns.yml
./scc-updates.sh
oc apply -f pv_books.yml
oc apply -f pv_config.yml
oc apply -f pvc_config.yml
oc apply -f pvc_books.yml
oc apply -f deployment.yml
oc apply -f service.yaml
oc apply -f route.yaml

View File

@@ -5,6 +5,7 @@ metadata:
namespace: calibre namespace: calibre
labels: labels:
app: calibre app: calibre
app.kubernetes.io/instance: calibre
version: latest version: latest
type: third-party type: third-party
facing: internal facing: internal
@@ -21,20 +22,15 @@ spec:
app: calibre app: calibre
spec: spec:
serviceAccountName: calibre-sa serviceAccountName: calibre-sa
securityContext: securityContext: {}
runAsUser: 0
runAsGroup: 0
fsGroup: 0
containers: containers:
- name: calibre - name: calibre
image: linuxserver/calibre-web:latest image: docker.io/linuxserver/calibre-web:latest
env: env:
- name: PUID - name: S6_YES_I_WANT_A_WORLD_WRITABLE_RUN_BECAUSE_KUBERNETES
value: "1001" value: "1"
- name: PGID
value: "1001"
- name: TZ - name: TZ
value: "Europe/Bucharest" value: "Australia/Sydney"
- name: DOCKER_MODS - name: DOCKER_MODS
value: "linuxserver/calibre-web:calibre" value: "linuxserver/calibre-web:calibre"
ports: ports:
@@ -46,6 +42,8 @@ spec:
mountPath: /config mountPath: /config
- name: calibre-books - name: calibre-books
mountPath: /books mountPath: /books
- name: run-dir
mountPath: /run
resources: resources:
requests: requests:
memory: "128Mi" memory: "128Mi"
@@ -56,7 +54,9 @@ spec:
volumes: volumes:
- name: calibre-config - name: calibre-config
persistentVolumeClaim: persistentVolumeClaim:
claimName: calibre-config claimName: calibre-config-csi
- name: calibre-books - name: calibre-books
persistentVolumeClaim: persistentVolumeClaim:
claimName: calibre-books claimName: calibre-books-csi
- name: run-dir
emptyDir: {}

9
manifests/ns.yml Normal file
View File

@@ -0,0 +1,9 @@
apiVersion: v1
kind: Namespace
metadata:
name: calibre
labels:
app: calibre
type: third-party
facing: internal
argocd.argoproj.io/managed-by: openshift-gitops

View File

@@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: calibre-books name: calibre-books-csi
namespace: calibre namespace: calibre
spec: spec:
accessModes: accessModes:
@@ -9,5 +9,4 @@ spec:
resources: resources:
requests: requests:
storage: 8Gi storage: 8Gi
storageClassName: nfs storageClassName: nfs-csi
volumeName: calibre-books

View File

@@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
metadata: metadata:
name: calibre-config name: calibre-config-csi
namespace: calibre namespace: calibre
spec: spec:
accessModes: accessModes:
@@ -9,5 +9,4 @@ spec:
resources: resources:
requests: requests:
storage: 500Mi storage: 500Mi
storageClassName: nfs storageClassName: nfs-csi
volumeName: calibre-config

View File

@@ -6,6 +6,8 @@ metadata:
annotations: annotations:
cert-manager.io/issuer-kind: ClusterIssuer cert-manager.io/issuer-kind: ClusterIssuer
cert-manager.io/issuer-name: letsencrypt-dns01-cloudflare cert-manager.io/issuer-name: letsencrypt-dns01-cloudflare
labels:
app.kubernetes.io/instance: calibre
spec: spec:
host: calibre.apilab.us host: calibre.apilab.us
path: / path: /

View File

@@ -5,6 +5,7 @@ metadata:
namespace: calibre namespace: calibre
labels: labels:
app: calibre app: calibre
app.kubernetes.io/instance: calibre
spec: spec:
selector: selector:
app: calibre app: calibre
@@ -13,4 +14,4 @@ spec:
protocol: TCP protocol: TCP
targetPort: 8083 targetPort: 8083
port: 80 port: 80
type: ClusterIP

8
ns.yml
View File

@@ -1,8 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: calibre
labels:
app: calibre
type: third-party
facing: internal

View File

@@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: calibre-books
namespace: calibre
spec:
capacity:
storage: 8Gi
nfs:
server: 192.168.0.105
path: /nfs/NFS/ocp/calibre/books
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs

View File

@@ -1,15 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: calibre-config
namespace: calibre
spec:
capacity:
storage: 500Mi
nfs:
server: 192.168.0.105
path: /nfs/NFS/ocp/calibre/config
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: nfs

View File

@@ -1,2 +0,0 @@
oc create sa calibre-sa -n calibre
oc adm policy add-scc-to-user anyuid -z calibre-sa -n calibre