Stirling PDF Tools


Sirling PDF Stirling PDF Tools is a web-based PDF manipulation platform. It offers an extensive range of functionalities, from simple operations like merging and splitting PDFs, to advanced features such as compressing, OCR and Conversions. Below is how I've implemented Stirling PDF Tools into my Kubernetes cluster.

Product: Stirling PDF Tools
Install Type: Manifest Files
Container Image: Docker

Installation Details

I have not as of yet created a Helm chart for this, so I have configured traditional manifest files for this deployment.

The following assume you have an existing namespace named utility, an Nginx ingress, and Cert Manager configured to use the ACME provider Let's Encrypt. Please adjust for your particular needs.

00-utility-namespace.yaml

apiVersion: v1
kind: Namespace
metadata:
  name: utility
  labels:
    name: utility

01-pdf-config.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: pdf-configs
  namespace: utility
data:
  APP_LOCALE: en_GB
  APP_HOME_NAME: Stirling PDF
  APP_HOME_DESCRIPTION: Your locally hosted one-stop-shop for all your PDF needs.
  APP_NAVBAR_NAME: Stirling PDF
  APP_ROOT_PATH: /
  ALLOW_GOOGLE_VISABILITY: "true"

03-pdf-deploy.yaml

I've chosen to use emptyDir instead of persistent storage for this as there is no real need to persist anything for my needs. You may wish to define Persistent Volume Claims with something like Longhorn.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: pdf
  namespace: utility
  labels:
    app: pdf
    app.kubernetes.io/name: pdf
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pdf
  template:
    metadata:
      labels:
        app: pdf
        app.kubernetes.io/name: pdf
    spec:
      volumes:
        - name: pdf-config
          emptyDir:
            sizeLimit: 4Gi
        - name: pdf-ocr
          emptyDir:
            sizeLimit: 4Gi
       containers:
        - name: pdf
          image: frooodle/s-pdf:latest
          imagePullPolicy: Always
          volumeMounts:
          - name: pdf-config
            mountPath: /config
          - name: pdf-ocr
            mountPath: /usr/share/tesseract-ocr/4.00/tessdata
          envFrom:
            - configMapRef:
                name: pdf-configs

04-pdf-service.yaml

kind: Service
apiVersion: v1
metadata:
  name: pdf-service
  namespace: utility
spec:
  selector:
    app: pdf
  ports:
  - protocol: TCP
    port: 8080
    targetPort: 8080
  type: ClusterIP

05-pdf-ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: pdftoolbox
  namespace: utility
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
  ingressClassName: nginx
  rules:
    - host: your.host.name
      http:
        paths:
        - path: /
          pathType: Prefix
          backend:
            service:
              name: pdf-service
              port:
                number: 8080
  tls:
    - hosts:
      - your.host.name
      secretName: pdftoolbox-tls

You may need to add the line below to the annotations {} of the ingress to allow for larger file uploads.

nginx.ingress.kubernetes.io/proxy-body-size: "0"

Now, we can deploy this all together with:

kubectl apply -f 00-utility-namespace.yaml \
              -f ./pdf/01-pdf-config.yaml  \
              -f ./pdf/03-pdf-deploy.yaml  \
              -f ./pdf/04-pdf-service.yaml \
              -f ./pdf/05-pdf-ingress.yaml