Skip to content

Deploying a Shopware App

Introduction

Shopware is an open-source eCommerce platform built on PHP and Symfony. Deploying Shopware with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage—all configured from klutch.sh/app. This guide covers installation, Dockerfile setup, environment variables, storage, Nixpacks overrides, and sample checks.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your Shopware Dockerfile (GitHub is the only supported git source)
  • External MySQL-compatible database
  • Domain and TLS for your storefront

For onboarding, see the Quick Start.


Architecture and ports

  • Shopware serves HTTP on internal port 8000 when run via Symfony’s server or PHP-FPM/Nginx binding. Choose HTTP traffic and set the internal port to 8000.
  • Persistent storage is required for media and cache; primary data lives in MySQL.

Repository layout

shopware/
├── 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 (ensure MySQL is reachable):

Terminal window
docker build -t shopware-local .
docker run -p 8000:8000 \
-e DATABASE_URL=mysql://user:pass@localhost:3306/shopware \
-e APP_URL=http://localhost:8000 \
shopware-local

Dockerfile for Shopware (production-ready)

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

FROM ghcr.io/shopware/production:latest
ENV APP_URL=http://localhost:8000
ENV DATABASE_URL=mysql://user:pass@mysql:3306/shopware
ENV SHOPWARE_HTTP_CACHE_ENABLED=1
EXPOSE 8000
CMD ["./bin/console", "shopware:http:cache:warmup", "&&", "php-fpm"]

Notes:

  • Pin to a specific tag (e.g., ghcr.io/shopware/production:6.5.x) for stability.
  • Adjust the start command if your image expects a different entrypoint (e.g., php-fpm via an init script). If you prefer Symfony server, use APP_URL and bind to port 8000 accordingly.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=8000
  • DATABASE_URL=mysql://<user>:<password>@<host>:3306/<db>
  • APP_URL=https://example-app.klutch.sh
  • SHOPWARE_HTTP_CACHE_ENABLED=1
  • Optional email settings: MAILER_URL=smtp://user:pass@smtp-host:587
  • Optional Redis cache/session: REDIS_URL=redis://<host>:6379

If deploying without the Dockerfile and relying on Nixpacks:

  • NIXPACKS_START_CMD=php-fpm

Attach persistent volumes

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

  • /var/www/html/public/media — media uploads.
  • /var/www/html/var/cache — cache (optional if using Redis).

Ensure paths are writable inside the container.


Deploy Shopware 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 8000.
  4. Add the environment variables above (database, app URL, cache, optional mail/Redis).
  5. Attach volumes at /var/www/html/public/media (and /var/www/html/var/cache if desired) sized for your catalog and cache.
  6. Deploy. Access your storefront at https://example-app.klutch.sh and complete any setup steps.

Sample checks

Landing page:

Terminal window
curl -I https://example-app.klutch.sh

If you expose a health endpoint (replace if different):

Terminal window
curl -I https://example-app.klutch.sh/health

Health checks and production tips

  • Add an HTTP readiness probe to / or your health endpoint.
  • Keep DB and mail credentials in Klutch.sh secrets; rotate regularly.
  • Use Redis for cache/sessions if available; otherwise monitor cache volume usage.
  • Pin image versions and test upgrades in staging before production.
  • Back up MySQL and media storage regularly.

Shopware on Klutch.sh delivers reproducible Docker builds, managed secrets, and persistent media/cache—without extra YAML or CI steps. Configure ports, env vars, and storage, then launch your storefront.