Skip to content

Deploy custom PrestaShop Helm chart (internal repos)

Original Author: Provodin Grigory
Lastmod: 12.02.2025
Status: In progress

Notes#

Note: This guide assumes you are working within a cPouta VM. For instructions on deploying a VM, see Instructions for installing virtual machine(s) in cPouta.

  • This guide was partially based on the following tutorial: Securing NGINX-ingress
  • This guide requires you to familiarize yourself with Kubernetes Ingress concepts to expose your PrestaShop store. Learn more here: Ingress
  • This guide uses environment variables in the PrestaShop Docker image: prestashop/prestashop
  • This guide uses Helm. To learn more, refer to the Helm documentation
  • This guide uses microk8s commands. Read more here: Command reference
  • This guide uses microk8s addon commands. Read more here: MicroK8s Addons
  • This guide requires you to familiarize yourself with the concept of persistence. Learn more here: Persistent Volumes

Requirements#

  • Image: Ubuntu-24.04
  • Flavor: standard.medium (3.91 GB RAM, 3 vCPUs) or standard.large (7.81 GB RAM, 4 vCPUs)
  • Ports: 22(SSH), 80(HTTP), 443(HTTPS)
  • Storage: At least 16 GB for Persistent Volumes if persistence is enabled

Prerequisites#

  1. Install microk8s:
sudo snap install microk8s --classic
  1. Setup a Kubernetes user:
sudo usermod -a -G microk8s $USER
mkdir -p ~/.kube
chmod 0700 ~/.kube
sudo su - $USER
  1. Enable ingress addon:
microk8s enable ingress 
  1. Enable dns addon (if you’ve performed a cleanup and want to install any chart again):
microk8s enable dns
  1. Obtain floating ip and domain:

    The cPouta documentation states: "All our floating IPs are by default mapped to a hostname". For more information, see DNS services in cPouta.

    1. Look up floating ip: (used both in http and https guides)

      FLOATING_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
      
    2. Look up domain: (used in https guide)

      domain=$(dig +short -x "$FLOATING_IP" | sed 's/\.$//')
      
  2. Enable metallb. Note: Since the IP range is not provided, use the same floating IP address for both start and end. This may trigger warnings but will typically work as expected.

microk8s enable metallb "${FLOATING_IP}-${FLOATING_IP}"
  1. Get the PrestaShop helm chart:

    git clone https://gitlab.labranet.jamk.fi/presta-shop-development-release-x/presta-shop-deployment/presta-shop-helm-x.git
    
    cd presta-shop-helm-x/
    

Commands#

This guide uses microk8s, which integrates kubectl and helm as part of its toolset. You’ve already seen some microk8s commands, and more will follow. Below is a summary of key microk8s commands used in this guide and their explanations:

Enable a specific addon in your microk8s environment:

microk8s enable <name-of-the-addon>

Install the chart:

You can modify <release-name> and <chart-path> as needed. However, for consistency, this guide uses presta-helm as the <release-name> throughout. It also assumes that you’re in the root directory of the chart repository presta-shop-helm-x, so the chart path is prestashop:

microk8s helm install <release-name> <chart-path> --set <set-additional-variables>

Upgrade the chart:

microk8s helm upgrade <release-name> <chart-path> --set <set-additional-variables>

Look up the ingress:

The -w flag is used to continuously watch the status of a resource in real-time. If you only want to see its current state, omit this flag.

microk8s kubectl get ingress -w

Check the deployment logs:

The -f flag is used to display continuous logs in real-time. If you only want to view the logs up to the current moment, omit the flag.

microk8s kubectl logs -f deployment/<your-deployment>

Variables#

The PrestaShop Docker image used in the Helm chart has an auto-install feature, meaning there is no installation wizard. You will need to manually configure the parameters. The only required parameter is psDomain, which represents your shop’s domain (note that separate formats of the psDomain are needed for HTTP and HTTPS, as explained in respective installation instructions below). Other parameters can remain at their default values, but it’s recommended that you customize them.

A semi-required parameter is adminMail, as it is used to set up a Let’s Encrypt issuer. If you wish to be notified when your SSL certificate needs to be renewed, provide your private or student email address.

Variable Default value Description
dbName prestashop The name of the database: Used in the mysql container to define the database name and in the prestashop container to connect to the database created by mysql.
dbPasswd adminPrEsTa123 The password of the database: Used in the mysql container to define the database password and in the prestashop container to connect to the database created by mysql.
psDomain wimma-capstone.jamk.fi The domain of the website: Used in the prestashop container for SEO, redirection, and other configurations. Additionally, it is utilized in the HTTP and HTTPS setups by the ingress controller for routing configuration and to obtain SSL certificates from Let’s Encrypt in the HTTPS setup.
psCountry FI The country of the website: Used in the prestashop container to set up the country.
psLanguage en The language of the website: Used in the prestashop container to set up the language.
adminMail testuser@mail.com The admin mail: Used in the prestashop container to configure the admin email, which is used for logging into the admin account and is displayed as a contact email on the main page. It is also used to configure Let’s Encrypt issuers for staging and production environments.
adminPasswd ReAlPaSsWoRd759*** The admin password: Used in the prestashop container to configure the admin password, which is used for logging into the admin account.
psFolderAdmin admin228 The admin folder: Used in the prestashop container to configure the name of the admin folder, which also serves as the path to the admin dashboard on the website.

How to set variables#

To set a variable, use the --set flag followed by the variable name and its new value. If you want to split the command across multiple lines for better readability when providing multiple variables, you need to use the backslash \ at the end of each line, except for the last one.

Example 1 - set variables without backslash \:

microk8s helm install presta-helm prestashop --set prestashop.env.psDomain="$FLOATING_IP" --set prestashop.env.dbPasswd="mypass***"  

Example 2 - set floating ip as a domain for HTTP ingress:

microk8s helm install presta-helm prestashop \
  --set prestashop.env.psDomain="$FLOATING_IP" 

Example 3 - set multiple variables:

microk8s helm install presta-helm prestashop \
  --set prestashop.env.psDomain="$FLOATING_IP" \
  --set prestashop.env.dbPasswd="superstrongpassword***" \
  --set prestashop.env.adminMail="student@jamk.fi" \
  --set prestashop.env.adminPasswd="superstrongpassword***" \
  --set prestashop.env.psFolderAdmin="adminfolder" \
  --set prestashop.env.psLanguage="fi" \
  --set prestashop.env.psCountry="US" \
  --set prestashop.env.dbName="prestadb"

Example 4 - export and set multiple variables:

For better flexibility and ease of use, you can first export the desired values as environment variables and then use them during the helm install command.

export FLOATING_IP="$FLOATING_IP"
export DB_PASSWD="superstrongpassword***"
export ADMIN_MAIL="student@jamk.fi"
export ADMIN_PASSWD="superstrongpassword***"
export PS_FOLDER_ADMIN="adminfolder"
export PS_LANGUAGE="fi"
export PS_COUNTRY="US"
export DB_NAME="prestadb"

microk8s helm install presta-helm prestashop \
  --set prestashop.env.psDomain="$FLOATING_IP" \
  --set prestashop.env.dbPasswd="$DB_PASSWD" \
  --set prestashop.env.adminMail="$ADMIN_MAIL" \
  --set prestashop.env.adminPasswd="$ADMIN_PASSWD" \
  --set prestashop.env.psFolderAdmin="$PS_FOLDER_ADMIN" \
  --set prestashop.env.psLanguage="$PS_LANGUAGE" \
  --set prestashop.env.psCountry="$PS_COUNTRY" \
  --set prestashop.env.dbName="$DB_NAME"

Ingress variables#

There are three ingresses in this Helm chart: HTTP, HTTPS (staging), and HTTPS (production). You can choose which type of ingress to use by modifying the appropriate variables.

By default, the ingress is set to HTTP. If you want to use it, no modification is necessary:

# Snippet from presta-shop-helm-x/prestashop/values.yaml
  ingress:
    # true: use https ingress 
    # false: use http ingress 
    enabled: false
    letsencrypt:
    # true: use production version of the letsencrypt issuer and ingress
    # false: use staging version of letsencrypt issuer and ingress
      isProd: false    

To use the HTTPS staging ingress, run the following command:

microk8s helm install presta-helm prestashop \
  --set prestashop.env.psDomain="$domain" \
  --set prestashop.ingress.enabled=true

To use the HTTPS production ingress, run this command:

microk8s helm install presta-helm prestashop \
  --set prestashop.env.psDomain="$domain" \
  --set prestashop.ingress.enabled=true \
  --set prestashop.ingress.letsencrypt.isProd=true

For more information on setting up ingresses, refer to the installation instructions.

Persistent storage#

This chart offers the option to use persistent storage. While optional, it is highly recommended as it ensures the safety of your data in the event of a pod failure. Additionally, it saves time during setup transitions with helm upgrade, as PrestaShop will not be reinstalled. Moreover, persistent storage allows you to delete and later restore your deployment without losing data.

The persistent storage components in this chart are as follows:

  • StorageClass: defines the rules for dynamically provisioning persistent volumes for PrestaShop and MySQL workloads. The StorageClass uses a reclaimPolicy: Retain, meaning that the persistent volumes will not be deleted when the deployment is removed. These volumes must be manually cleaned up from the previous PersistentVolumeClaim (claim reference) before they can be reused in a new deployment.

  • PersistentVolume (PV): represents the actual storage. In this chart, the PersistentVolume is dynamically provisioned by the StorageClass, but you manually create the storage directory (the data will be deleted during reset if stored in the dynamically managed directory).

  • PersistentVolumeClaim (PVC): is a request for storage resources, specifying the amount and type of storage needed. The claim ensures the resources are allocated according to the specified requirements.

Some things to consider when using persistent storage:

  1. This persistent setup is designed for the MicroK8s addon hostpath-storage and may not be compatible with other Kubernetes distributions.

  2. Keep in mind that the control plane verifies storage requests for both PersistentVolume (PV) and PersistentVolumeClaim (PVC). In this chart, storage is only requested in the PVC, and the PV is created with the same allocation. However, if you modify the storage request while an existing PV still holds the previous allocation (e.g., if your current PV is 8GB and you want to increase it to 10GB), simply updating the PVC won’t automatically resize the PV. While resizing is possible without recreating the PV and loosing your data, it requires manual intervention, which is outlined here: "Resizing" a PVC and its PV in Microk8s

Installation instructions#

As mentioned earlier, this Helm chart includes three types of ingresses, which you can think of as separate phases or projects. It is recommended to test them in the following order: HTTP, staging HTTPS, and production HTTPS.

When switching between these phases, you don’t need to delete and reinstall all resources. Instead, you can use the helm upgrade command, which applies only the changes based on the updated values.

The basic helm upgrade command is:

microk8s helm upgrade presta-helm prestashop --set <set-additional-variables>

If you’re installing the chart for the first time or want to skip directly to a specific ingress type, use the helm install command:

microk8s helm install presta-helm prestashop --set <set-additional-variables>

Detailed installation-specific helm install and helm upgrade commands can be found in the respective sections below.

There are also two deployment options available: persistent and non-persistent. If you’re patient, you can follow both versions, but if you’re looking for a quicker solution, choose the one that suits your case best. Keep in mind that while you can helm upgrade from a non-persistent to a persistent deployment, this process can be a bit cumbersome. Therefore, if you intend to test both deployment options, I recommend to perform a cleanup of your first deployment (whether persistent or not) and start fresh with the second option.

Additionally, the persistent deployment involves a custom script for switching between HTTP and HTTPS (or vice versa). While the script has been thoroughly tested, being custom, it may cause unforeseen issues. If you plan to host your website long-term with persistence, I suggest sticking with HTTPS staging or production, as these options don’t require domain and settings updates when doing helm upgrade back and forth.

Deployment without Persistence#

HTTP#

Note: you have to complete prerequisites before following these instructions

  1. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$FLOATING_IP"
    

    Upgrade#

    If you already installed a chart and have any active deployment (HTTP, HTTPS staging, HTTPS production), run the following command:

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$FLOATING_IP" \
      --set prestashop.ingress.enabled=false \
      --set prestashop.ingress.letsencrypt.isProd=false
    
  2. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                          CLASS   HOSTS   ADDRESS     PORTS   AGE
    presta-helm-prestashop-http   nginx   *       127.0.0.1   80      106m
    
  3. Wait for the resources to be deployed (it might take a few minutes), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  4. Visit your website at:

    http://<your-floating-ip>/
    

Staging HTTPS#

Note: you have to complete prerequisites before following these instructions

The HTTPS ingress uses Let’s Encrypt to obtain SSL certificates. While Let’s Encrypt is free, it has rate limits. If exceeded, you won’t be able to obtain new certificates for a certain period. To address this, there’s a staging version that doesn’t issue valid certificates but helps verify if your ingress is configured correctly. Once confirmed, you can proceed to request a production certificate.

  1. Enable cert-manager:

    microk8s enable cert-manager
    
  2. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true
    

    Upgrade#

    If you already installed a chart and have any active deployment (HTTP, HTTPS staging, HTTPS production), run the following command:

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=false
    
  3. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                             CLASS   HOSTS                     ADDRESS     PORTS     AGE
    presta-helm-prestashop-staging   nginx   <your-domain>             127.0.0.1   80, 443   14m
    
  4. Check issuer:

    microk8s kubectl get issuer
    

    Expected output:

    NAME                  READY   AGE
    letsencrypt-staging   True    16m
    
  5. Check certificate:

    microk8s kubectl get certificate
    

    Expected output:

    NAME              READY   SECRET            AGE
    presta-shop-tls   True    presta-shop-tls   3m20s
    
  6. Wait for the resources to be deployed (it might take a few minutes), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  7. Visit your website at:

    Note that the browser will infrom you that the site is not secure since it is a staging certificate.

    https://<your-domain>/
    

Production HTTPS#

Note: you have to complete prerequisites before following these instructions

  1. Enable cert-manager if not enabled:

    microk8s enable cert-manager
    
  2. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=true
    

    Upgrade#

    If you already installed a chart and have any active deployment (HTTP, HTTPS staging, HTTPS production), run the following command:

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=true
    
  3. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                          CLASS   HOSTS                     ADDRESS     PORTS     AGE
    presta-helm-prestashop-prod   nginx   <your-domain>             127.0.0.1   80, 443   5m5s
    
  4. Check issuer:

    microk8s kubectl get issuer
    

    Expected output:

    NAME               READY   AGE
    letsencrypt-prod   True    4m59s
    
  5. Check certificate:

    microk8s kubectl get certificate
    

    Expected output:

    NAME              READY   SECRET            AGE
    presta-shop-tls   True    presta-shop-tls   4m37s
    
  6. Wait for the resources to be deployed (it might take a few minutes), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  7. Visit your website at:

    https://<your-domain>/
    

Deployment with Persistence#

Note: If you’ve already read the installation instructions for deployment without persistence, you might notice some repetition. This is intentional, as it helps keep each set of instructions clear and self-contained while avoiding unnecessary complexity.

Prerequisites#

  1. Enable MicroK8s plugin hostpath-storage:

    microk8s enable hostpath-storage
    
    2. Create a directory for PVs to store the data:

    Note: You can change the storage directory by updating the common.persistence.storageDirectory value in the values.yaml file, which is located at the root of the chart. Alternatively, you can provide a custom directory path as a variable during the helm install command by using the --set flag (e.g., --set common.persistence.storageDirectory=/new/directory/path).

    sudo mkdir /mnt/prestashop-storage
    

HTTP#

Note: you have to complete prerequisites before following these instructions

  1. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$FLOATING_IP" \
      --set common.persistence.enabled=true
    

    Upgrade#

    If you already installed a chart and have any active deployment with persistence enabled (HTTP, HTTPS staging, HTTPS production), perform an upgrade.

    You need to specify the name of PrestaShop’s Persistent Volume to ensure the new pod connects to it instead of creating a new one. MySQL is managed automatically during upgrades. Since persistent volumes are dynamically provisioned by the hostpath-storage addon, their names are randomly generated, so be sure to double-check the correct PV name before proceeding.

    You can retrieve the name of your Persistent Volume by executing the following command. Look at the NAME attribute to find the PV’s name, and use the CLAIM attribute to identify which PV corresponds to your PrestaShop workload:

    microk8s kubectl get pv
    

    Note: Make sure to replace <pv-name> with the actual name of your existing Persistent Volume (existingPVName).

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$FLOATING_IP" \
      --set prestashop.ingress.enabled=false \
      --set prestashop.ingress.letsencrypt.isProd=false \
      --set common.persistence.enabled=true \
      --set prestashop.persistence.existingPVName="<pv-name>" \
      --set common.persistence.switchDomain=true
    

    Example:

    ubuntu@vm-1:~$ microk8s kubectl get pv
    NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                    STORAGECLASS      VOLUMEATTRIBUTESCLASS   REASON   AGE
    pvc-1ca90b3f-f4ad-4525-ae33-53a9b52c4344   8Gi        RWO            Retain           Bound    default/mysql-data-presta-helm-mysql-0   hostpath-retain   <unset>                          2d23h
    pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e   8Gi        RWO            Retain           Bound    default/prestashop-pvc                   hostpath-retain   <unset>                          2d23h
    
    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$FLOATING_IP" \
      --set prestashop.ingress.enabled=false \
      --set prestashop.ingress.letsencrypt.isProd=false \
      --set common.persistence.enabled=true \
      --set prestashop.persistence.existingPVName="pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e" \
      --set common.persistence.switchDomain=true
    
  2. Check persistent volumes and persistent volume claims:

    microk8s kubectl get pv,pvc
    
  3. Check domain update logs (if doing helm upgrade)

    microk8s kubectl logs job.batch/mysql-domain-modification -c prestashop-domain-modification-status-check
    
    microk8s kubectl logs job.batch/mysql-domain-modification -c mysql-domain-modification
    
  4. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                          CLASS   HOSTS   ADDRESS     PORTS   AGE
    presta-helm-prestashop-http   nginx   *       127.0.0.1   80      106m
    
  5. Wait for the resources to be deployed (it might take a few minutes if doing helm install), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  6. Visit your website at:

    http://<your-floating-ip>/
    

Staging HTTPS#

Note: you have to complete prerequisites before following these instructions

The HTTPS ingress uses Let’s Encrypt to obtain SSL certificates. While Let’s Encrypt is free, it has rate limits. If exceeded, you won’t be able to obtain new certificates for a certain period. To address this, there’s a staging version that doesn’t issue valid certificates but helps verify if your ingress is configured correctly. Once confirmed, you can proceed to request a production certificate.

  1. Enable cert-manager:

    microk8s enable cert-manager
    
  2. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set common.persistence.enabled=true
    

    Upgrade#

    If you already installed a chart and have any active deployment with persistence enabled (HTTP, HTTPS staging, HTTPS production), perform an upgrade.

    You need to specify the name of PrestaShop’s Persistent Volume to ensure the new pod connects to it instead of creating a new one. MySQL is managed automatically during upgrades. Since persistent volumes are dynamically provisioned by the hostpath-storage addon, their names are randomly generated, so be sure to double-check the correct PV name before proceeding.

    You can retrieve the name of your Persistent Volume by executing the following command. Look at the NAME attribute to find the PV’s name, and use the CLAIM attribute to identify which PV corresponds to your PrestaShop workload:

    microk8s kubectl get pv
    

    Note: Make sure to replace <pv-name> with the actual name of your existing Persistent Volume (existingPVName).

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=false \
      --set common.persistence.enabled=true \
      --set prestashop.persistence.existingPVName="<pv-name>" \
      --set common.persistence.switchDomain=true
    

    Example:

    ubuntu@vm-1:~$ microk8s kubectl get pv
    NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                    STORAGECLASS      VOLUMEATTRIBUTESCLASS   REASON   AGE
    pvc-1ca90b3f-f4ad-4525-ae33-53a9b52c4344   8Gi        RWO            Retain           Bound    default/mysql-data-presta-helm-mysql-0   hostpath-retain   <unset>                          2d23h
    pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e   8Gi        RWO            Retain           Bound    default/prestashop-pvc                   hostpath-retain   <unset>                          2d23h
    
    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=false \
      --set common.persistence.enabled=true \
      --set prestashop.persistence.existingPVName="pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e" \
      --set common.persistence.switchDomain=true
    
  3. Check persistent volumes and persistent volume claims:

    microk8s kubectl get pv,pvc
    
  4. Check domain update logs (if doing helm upgrade)

    microk8s kubectl logs job.batch/mysql-domain-modification -c prestashop-domain-modification-status-check
    
    microk8s kubectl logs job.batch/mysql-domain-modification -c mysql-domain-modification
    
  5. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                             CLASS   HOSTS                     ADDRESS     PORTS     AGE
    presta-helm-prestashop-staging   nginx   <your-domain>             127.0.0.1   80, 443   14m
    
  6. Check issuer:

    microk8s kubectl get issuer
    

    Expected output:

    NAME                  READY   AGE
    letsencrypt-staging   True    16m
    
  7. Check certificate:

    microk8s kubectl get certificate
    

    Expected output:

    NAME              READY   SECRET            AGE
    presta-shop-tls   True    presta-shop-tls   3m20s
    
  8. Wait for the resources to be deployed (it might take a few minutes if doing helm install), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  9. Visit your website at:

    Note that the browser will infrom you that the site is not secure since it is a staging certificate.

    https://<your-domain>/
    

Production HTTPS#

Note: you have to complete prerequisites before following these instructions

  1. Enable cert-manager if not enabled:

    microk8s enable cert-manager
    
  2. Install or upgrade the chart:

    If you wish, you can set more variables

    Install#

    If you didn't do any installations yet and this is the first chart you installing, run the following command:

    microk8s helm install presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=true \
      --set common.persistence.enabled=true
    

    Upgrade#

    If you already installed a chart and have any active deployment with persistence enabled (HTTP, HTTPS staging, HTTPS production), perform an upgrade.

    You need to specify the name of PrestaShop’s Persistent Volume to ensure the new pod connects to it instead of creating a new one. MySQL is managed automatically during upgrades. Since persistent volumes are dynamically provisioned by the hostpath-storage addon, their names are randomly generated, so be sure to double-check the correct PV name before proceeding.

    You can retrieve the name of your Persistent Volume by executing the following command. Look at the NAME attribute to find the PV’s name, and use the CLAIM attribute to identify which PV corresponds to your PrestaShop workload:

    microk8s kubectl get pv
    

    Note: Make sure to replace <pv-name> with the actual name of your existing Persistent Volume (existingPVName).

    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=true \
      --set common.persistence.enabled=true \
      --set common.persistence.switchDomain=true \
      --set prestashop.persistence.existingPVName="<pv-name>"
    

    Example:

    ubuntu@vm-1:~$ microk8s kubectl get pv
    NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS   CLAIM                                    STORAGECLASS      VOLUMEATTRIBUTESCLASS   REASON   AGE
    pvc-1ca90b3f-f4ad-4525-ae33-53a9b52c4344   8Gi        RWO            Retain           Bound    default/mysql-data-presta-helm-mysql-0   hostpath-retain   <unset>                          2d23h
    pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e   8Gi        RWO            Retain           Bound    default/prestashop-pvc                   hostpath-retain   <unset>                          2d23h
    
    microk8s helm upgrade presta-helm prestashop \
      --set prestashop.env.psDomain="$domain" \
      --set prestashop.ingress.enabled=true \
      --set prestashop.ingress.letsencrypt.isProd=true \
      --set common.persistence.enabled=true \
      --set common.persistence.switchDomain=true \
      --set prestashop.persistence.existingPVName="pvc-7ddc2709-b613-4b6a-a16e-51405258bc3e"
    
  3. Check persistent volumes and persistent volume claims:

    microk8s kubectl get pv,pvc
    
  4. Check domain update logs (if doing helm upgrade)

    microk8s kubectl logs job.batch/mysql-domain-modification -c prestashop-domain-modification-status-check
    
    microk8s kubectl logs job.batch/mysql-domain-modification -c mysql-domain-modification
    
  5. Check ingress:

    microk8s kubectl get ingress -w
    

    Expected output:

    NAME                          CLASS   HOSTS                     ADDRESS     PORTS     AGE
    presta-helm-prestashop-prod   nginx   <your-domain>             127.0.0.1   80, 443   5m5s
    
  6. Check issuer:

    microk8s kubectl get issuer
    

    Expected output:

    NAME               READY   AGE
    letsencrypt-prod   True    4m59s
    
  7. Check certificate:

    microk8s kubectl get certificate
    

    Expected output:

    NAME              READY   SECRET            AGE
    presta-shop-tls   True    presta-shop-tls   4m37s
    
  8. Wait for the resources to be deployed (it might take a few minutes if doing helm install), you can check the logs of the prestashop deployment by running the following command:

    microk8s kubectl logs -f deployment/presta-helm-prestashop
    
  9. Visit your website at:

    https://<your-domain>/
    

Testing Persistent Storage#

To verify that your data will actually be preserved even if you reset your cluster, follow these steps:

  1. Deploy one of the variants of persistent deployment, if not deployed.

  2. Log in to the admin dashboard and modify any product:

    1. From the admin dashboard, navigate to Catalog --> Products:

    2. Choose any product you like and modify its name or price:

    3. Visit your store to verify that the change was successful:

  3. Reset the deployment:

    microk8s kubectl scale statefulset presta-helm-mysql --replicas=0
    
    sudo microk8s reset
    
  4. Follow steps 3-6 in prerequisites and step 1 in prerequisites for persistent deployment, also enable cert-manager if you had HTTPS deployment

  5. Reinstall the deployment, reconnecting to the existing PVs

    Note: It is recommended to reinstall (using helm install with instructions from Deployment with Persistence ) the exact same setup as before deletion. For example, if you previously had an HTTP setup, you should reinstall the HTTP setup. However, if you want to switch to a different setup (e.g., changing from HTTP to HTTPS after a reset) while reinstalling, you can do so by adding common.persistence.switchDomain=true.

    Note: Unlike the instructions in Deployment with Persistence upgrades, you will also need to provide the MySQL’s PV name at mysql.persistence.existingPVName during the installation:

    1. List existing PVs:

      microk8s kubectl get pv
      

      Example output:

        ubuntu@presta-helm-test:~$ microk8s kubectl get pv
        NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM                                    STORAGECLASS      VOLUMEATTRIBUTESCLASS   REASON   AGE
        pvc-782c6800-9bac-467f-bcc3-8287797e7aea   8Gi        RWO            Retain           Released   default/prestashop-pvc                   hostpath-retain   <unset>                          3d3h
        pvc-8488c67f-324f-4498-83c5-2b6371198f9f   8Gi        RWO            Retain           Released   default/mysql-data-presta-helm-mysql-0   hostpath-retain   <unset>                          3d3h
      

      Remember which PVCs these PVs were associated with, as we will remove this association in the next step. You can identify the association by checking the CLAIM column.

    2. Remove claims:

      You need to do this because the PVs are still associated with the PVCs from the previous deployment, even though the deployment was removed. This happens because the Retain policy requires manual reclamation.

      microk8s kubectl patch pv <pv-name> -p '{"spec":{"claimRef":null}}'
      

      Example output:

      ubuntu@presta-helm-test:~$ microk8s kubectl patch pv pvc-782c6800-9bac-467f-bcc3-8287797e7aea -p '{"spec":{"claimRef":null}}'
      persistentvolume/pvc-782c6800-9bac-467f-bcc3-8287797e7aea patched
      
      ubuntu@presta-helm-test:~$ microk8s kubectl patch pv pvc-8488c67f-324f-4498-83c5-2b6371198f9f -p '{"spec":{"claimRef":null}}'
      persistentvolume/pvc-8488c67f-324f-4498-83c5-2b6371198f9f patched
      
    3. Install the setup you had before or you want to upgrade to:

      Example 1: Reinstalling the same deployment as before (HTTP deployment in this case):

        microk8s helm install presta-helm prestashop \
          --set prestashop.env.psDomain="$FLOATING_IP" \
          --set common.persistence.enabled=true \
          --set mysql.persistence.existingPVName="<pv-name>" \
          --set prestashop.persistence.existingPVName="<pv-name>"
      

      Example 2: Installing a different deployment than before (switching to HTTP in this case):

        microk8s helm install presta-helm prestashop \
          --set prestashop.env.psDomain="$FLOATING_IP" \
          --set common.persistence.enabled=true \
          --set mysql.persistence.existingPVName="<pv-name>" \
          --set prestashop.persistence.existingPVName="<pv-name>" \
          --set common.persistence.switchDomain=true
      
  6. Verify that the product you modified stayed the same.

Cleanup#

Note: This process will delete all resources and reset the MicroK8s node to its initial state.

Deployments without persistence#

Reset MicroK8s:

sudo microk8s reset

Deployments with persistence#

Preserving data (e.g., persistent volumes)#

  1. Scale down the MySQL StatefulSet (otherwise, reset may get stuck):

    microk8s kubectl scale statefulset presta-helm-mysql --replicas=0
    

    If you named your release differently:

    microk8s kubectl scale statefulset <release-name>-mysql --replicas=0
    
  2. Reset MicroK8s:

    sudo microk8s reset
    

Removing data (e.g., persistent volumes)#

  1. Scale down the MySQL StatefulSet (otherwise, reset may get stuck):

    microk8s kubectl scale statefulset presta-helm-mysql --replicas=0
    

    If you named your release differently:

    microk8s kubectl scale statefulset <release-name>-mysql --replicas=0
    
  2. Reset MicroK8s:

    sudo microk8s reset
    
  3. Delete the Persistent Volumes:

    microk8s kubectl delete pv <pv-name>
    
  4. Remove the directories sssociated with the Persistent Volumes (modify the command if using another directory):

    sudo rm -r /mnt/prestashop-storage
    

Debug#

  1. Website is not displayed properly.

    If the website doesn’t display correctly after switching between deployments, clear your browser’s data (cookies and cache).

  2. I want to test my configuration before deployment.

    If you’re unsure whether you’ve provided the correct variables, enabled the required addons, or want to verify the behavior of your deployment, you can do a test run. This won’t deploy any resources, so no cleanup is needed afterward. Instead, it will show you details like the ingress type, provided and default values, and errors if the configuration is incorrect or required addons are not enabled. You can use the following commands with any helm install or helm upgrade commands in this tutorial:

    microk8s helm install --dry-run --debug <release-name> <chart-path>
    
    microk8s helm upgrade --dry-run --debug <release-name> <chart-path>