Skip to content

Deploying a Solr App

Introduction

Apache Solr is a powerful open-source search platform built on Lucene. Deploying Solr with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide focuses on a single-node Solr server reachable over HTTP.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Solr Dockerfile (GitHub is the only supported git source)
  • Optional: initial configsets/cores you plan to load

For onboarding, see the Quick Start.


Architecture and ports

  • Solr serves HTTP on internal port 8983. Choose HTTP traffic and set the internal port to 8983.
  • Persistent storage is required for cores/collections and configs.

Repository layout

solr/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Build and run locally:

Terminal window
docker build -t solr-local .
docker run -p 8983:8983 \
-v $(pwd)/data:/var/solr \
solr-local

Dockerfile for Solr (production-ready)

Place this at the repo root; Klutch.sh auto-detects Dockerfiles.

FROM solr:latest
ENV SOLR_HOME=/var/solr/data
EXPOSE 8983
CMD ["solr-foreground"]

Notes:

  • Pin to a specific tag (e.g., solr:9.4) for stability.
  • Use SOLR_HOME to point to your data directory.

Environment variables (Klutch.sh)

Common settings:

  • PORT=8983
  • SOLR_HOME=/var/solr/data
  • Optional: JVM tuning via SOLR_JAVA_MEM (e.g., -Xms512m -Xmx1024m)

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_START_CMD=solr-foreground

Attach persistent volumes

Add storage in Klutch.sh (path and size only):

  • /var/solr — cores/collections and configs.

Ensure the path is writable inside the container.


Deploy Solr on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 8983.
  4. Add environment variables (port, SOLR_HOME, optional JVM memory).
  5. Attach a volume at /var/solr sized for your indexes and configs.
  6. Deploy. Access Solr at https://example-app.klutch.sh/solr.

Sample checks

Core listing:

Terminal window
curl "https://example-app.klutch.sh/solr/admin/cores?action=STATUS&wt=json"

Ping a core (replace gettingstarted with your core):

Terminal window
curl "https://example-app.klutch.sh/solr/gettingstarted/admin/ping"

Health checks and production tips

  • Add an HTTP readiness probe to /solr/admin/info/system.
  • Keep JVM memory sized for your workload; tune SOLR_JAVA_MEM.
  • Pin image versions and test upgrades in staging before production rollout.
  • Monitor volume usage on /var/solr; resize proactively.

Solr on Klutch.sh delivers reproducible Docker builds, managed secrets, and persistent search data—without extra YAML or CI steps. Configure ports, env vars, and storage, then start indexing and querying your content.