demoshop

by Makaira GmbH

Helm chartv2.4.0App 1.0

A Helm chart for deploying a demo shop with PHP-FPM, Nginx, and a database

About this chart

Demoshop

This chart can be used to set up a PHP via FastCGI, Nginx and Database (MySQL or MariaDB) stack. You need to create an application images based on a PHP-FPM image (e.g. php:8.4-fpm).

Prerequisites

  • A Docker image containing a FastCGI service on port 9000 (e.g. PHP-FPM).
  • rysnc for shared assets (see below)

Values

ParameterTypeDefaultDescription
domainstringshop.k8s.makaira.ioDomain under which the store is accessible.
imagePullSecretslist[]Image pull secrets to use.
imagePullPolicystringAlwaysPull policy for all images.
shopdictShop settings
nginxdictNginx settings
databasedictDatabase settings

Image Pull Secrets (imagePullSecrets)

ParameterTypeDefaultDescription
namestring""Name of the image pull secret.
repostring""Repository to use the secret with.
authstring""Base64 encoded auth token.

Shop settings (shop)

ParameterTypeDefaultDescription
image.namestring"php"Image repository and name
image.tagstring"8.4-fpm"Image tag
sharedAssetsdictShared assets settings (see below)
envVarsdict{}Environment variables for the shop (as key-value pairs)
initCommandsdict[]Commands to run on startup (see below)
persistencelist[]Persistent volume settings (as list of dict, see below)

Shared assets settings (shop.sharedAssets)

ParameterTypeDefaultDescription
enabledboolfalseEnable the feature
storageClassstring""Storage class for persistent volume
storageSizestring5GiSite for persistent volume

Init commands (shop.initCommands)

ParameterTypeDefaultDescription
namestringName of the command
userstringUser to run the command as
commandstringCommand to run on startup

Example

If you need to run several commands in sequence, just use the default command splitter ;:

shop:
  initCommands:
    - name: "init-composer"
      command: "composer install --no-dev --prefer-dist --no-scripts --no-progress --no-interaction; php bin/console cache:clear"

Init commands are run as the default user (usually "root") of the container.

shop:
  initCommands:
    - name: "migrate-db"
      command: "php bin/console doctrine migration migrate --no-interaction"

You can specify a different user for the command by setting the user field:

shop:
  initCommands:
    - name: "init-composer"
      user: "www-data"
      command: "composer install --no-dev --prefer-dist --no-scripts --no-progress --no-interaction"

Persistent volume settings (shop.persistence)

ParameterTypeDefaultDescription
namestringName of the volume
pathstringPath to mount the volume to
storageClassstringStorage class for the volume
storageSizestringSize of the volume

Nginx settings (nginx)

ParameterTypeDefaultDescription
image.namestring"nginx"Image repository and name
image.tagstring"stable"Image tag
locationsstringLocations for FastCGICustom locations to finetune Nginx, see Nginx documentation.

Database settings (database)

ParameterTypeDefaultDescription
image.namestring"mysql"Image repository and name
image.tagstring"8.0"Image tag
namestringdatabaseName of the database to create.
userstringusernameDatabase user to create. CHANGE THIS!
passwordstringpasswordPassword for the database user. CHANGE THIS!
rootPasswordstringSetYourOwnRootPassword!Password for the database root user. CHANGE THIS!
storageSizestring5GiSize of the database persistent volume.
initialsDumpslist[]List of initial dumps to import.

Initial dumps (database.initialDumps)

ParameterTypeDefaultDescription
urlstringURL to the dump file.
authstringHTTP basic auth credentils (format: <username>:<password>).
userAgentstringUser agent to use for the download.

Shared Assets

You can serve assets such as Stylesheets, JavaScript files, images or even generated files via Nginx directly. To use this feature you need to install rsync. Copy all assets to /assets and create symbolic links to the copies at the source positions. The assets will be copied to a persistent volume and are served by Nginx directly.

Nginx hints

There will be an empty volume mounted to /sockets in the shop container. This can be used to use Unix domain sockets, instead of TCP sockets. There are two upstreams defined in the Nginx configuration:

  • app-socket is a Unix domain socket at /sockets/app.sock
  • app-tcp is a TCP socket at localhost:9000

Deploy demoshop with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has demoshop on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartdemoshop is pinned at v2.4.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply