Skip to content

Deploying a PrestaShop App

Introduction

PrestaShop is a popular open-source eCommerce platform built on PHP and MySQL. Deploying PrestaShop with a Dockerfile on Klutch.sh delivers 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 requests to verify your shop.


Prerequisites

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

For onboarding, see the Quick Start.


Architecture and ports

  • PrestaShop serves HTTP on internal port 8080 in the official image. Choose HTTP traffic and set the internal port to 8080.
  • Persistent storage is required for uploaded assets and configuration; database resides externally.

Repository layout

prestashop/
├── 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 prestashop-local .
docker run -p 8080:8080 \
-e PS_DEV_MODE=0 \
-e PS_INSTALL_AUTO=1 \
-e DB_SERVER=localhost \
-e DB_NAME=prestashop \
-e DB_USER=prestashop \
-e DB_PASSWD=changeme \
prestashop-local

Dockerfile for PrestaShop (production-ready)

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

FROM prestashop/prestashop:8-apache
ENV APACHE_DOCUMENT_ROOT=/var/www/html
ENV PS_INSTALL_AUTO=1
ENV PS_DEV_MODE=0
ENV PS_ENABLE_SSL=1
ENV PS_LANGUAGE=en
ENV PS_COUNTRY=US
ENV PS_TIMEZONE=UTC
EXPOSE 8080
CMD ["apache2-foreground"]

Notes:

  • Pin the image tag (e.g., prestashop/prestashop:8.1-apache) for stability.
  • apache2-foreground runs the web server on port 8080.

Environment variables (Klutch.sh)

Set these before deploying:

  • PORT=8080
  • DB_SERVER=<db-host>
  • DB_NAME=<db-name>
  • DB_USER=<db-user>
  • DB_PASSWD=<db-password>
  • PS_INSTALL_AUTO=1
  • PS_DEV_MODE=0
  • PS_ENABLE_SSL=1
  • Optional: PS_LANGUAGE=en, PS_COUNTRY=US, PS_TIMEZONE=UTC

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_START_CMD=apache2-foreground

Attach persistent volumes

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

  • /var/www/html/img — product and media uploads.
  • /var/www/html/var — cache and generated files.

Ensure paths are writable inside the container.


Deploy PrestaShop 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 8080.
  4. Add the environment variables above (database credentials, SSL flag, language settings).
  5. Attach volumes at /var/www/html/img and /var/www/html/var sized for your catalog and cache.
  6. Deploy. Access your shop at https://example-app.klutch.sh and complete any remaining setup screens.

Sample checks

Health/landing check:

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

Admin login (after setup, replace path if customized):

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

Health checks and production tips

  • Use an HTTP readiness probe on / to confirm the storefront responds.
  • Keep DB credentials in Klutch.sh secrets; rotate them regularly.
  • Enforce HTTPS at the edge; set PS_ENABLE_SSL=1.
  • Back up your external database; export media from /var/www/html/img as needed.
  • Pin image versions and test upgrades in staging before production.

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