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
8000when run via Symfony’s server or PHP-FPM/Nginx binding. Choose HTTP traffic and set the internal port to8000. - 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.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Build and run locally (ensure MySQL is reachable):
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-localDockerfile 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:8000ENV DATABASE_URL=mysql://user:pass@mysql:3306/shopwareENV SHOPWARE_HTTP_CACHE_ENABLED=1
EXPOSE 8000CMD ["./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-fpmvia an init script). If you prefer Symfony server, useAPP_URLand bind to port 8000 accordingly.
Environment variables (Klutch.sh)
Set these before deploying:
PORT=8000DATABASE_URL=mysql://<user>:<password>@<host>:3306/<db>APP_URL=https://example-app.klutch.shSHOPWARE_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)
- 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
8000. - Add the environment variables above (database, app URL, cache, optional mail/Redis).
- Attach volumes at
/var/www/html/public/media(and/var/www/html/var/cacheif desired) sized for your catalog and cache. - Deploy. Access your storefront at
https://example-app.klutch.shand complete any setup steps.
Sample checks
Landing page:
curl -I https://example-app.klutch.shIf you expose a health endpoint (replace if different):
curl -I https://example-app.klutch.sh/healthHealth 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.