Deploying a Stirling-PDF App
Introduction
Stirling-PDF is an open-source suite for manipulating PDF files—merging, splitting, converting, and more. Deploying Stirling-PDF with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for uploads—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample requests.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Stirling-PDF Dockerfile (GitHub is the only supported git source)
- Optional: external storage if you prefer object storage for processed files
For onboarding, see the Quick Start.
Architecture and ports
- Stirling-PDF serves HTTP on internal port
8080. Choose HTTP traffic and set the internal port to8080. - Persistent storage is recommended for uploads and processed documents.
Repository layout
stirling-pdf/├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Build and run locally:
docker build -t stirling-pdf-local .docker run -p 8080:8080 \ -e PORT=8080 \ stirling-pdf-localDockerfile for Stirling-PDF (production-ready)
Place this at the repo root; Klutch.sh auto-detects Dockerfiles.
FROM frooodle/s-pdf:latest
ENV PORT=8080
EXPOSE 8080CMD ["java", "-jar", "/app.jar"]Notes:
- Pin to a specific tag (e.g.,
frooodle/s-pdf:0.41.2) for stability. app.jarstarts the web server on the configured port.
Environment variables (Klutch.sh)
Set these before deploying:
PORT=8080- Optional security:
SPRING_SECURITY_USER_NAME/SPRING_SECURITY_USER_PASSWORDfor basic auth - Optional file paths: adjust if you relocate storage paths in your image
If deploying without the Dockerfile and relying on Nixpacks:
NIXPACKS_START_CMD=java -jar /app.jar
Attach persistent volumes
Add storage in Klutch.sh (path and size only):
/data— uploads and processed PDFs (adjust if your image uses a different path).
Ensure the path is writable inside the container.
Deploy Stirling-PDF on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select HTTP traffic and set the internal port to
8080. - Add environment variables (port, optional basic auth credentials).
- Attach a volume at
/datasized for your uploads and generated PDFs. - Deploy. Your app will be reachable at
https://example-app.klutch.sh.
Sample requests
Health check:
curl -I https://example-app.klutch.shExample PDF merge (replace endpoint/params with the app’s API routes if exposed):
curl -X POST https://example-app.klutch.sh/api/merge \ -F "files=@/path/to/file1.pdf" \ -F "files=@/path/to/file2.pdf" \ -o merged.pdfHealth checks and production tips
- Add an HTTP readiness probe to
/or your health endpoint. - Keep any auth credentials in Klutch.sh secrets; rotate regularly.
- Pin image versions and test upgrades in staging before production rollout.
- Monitor
/datavolume usage; resize proactively as files accumulate.
Stirling-PDF on Klutch.sh delivers reproducible Docker builds, managed secrets, and persistent storage—without extra YAML or CI steps. Configure ports, env vars, and storage, then start processing PDFs.