PrestaShop is a free online platform for e-commerce that provides tools for creating and managing online stores. With PrestaShop, you can create beautiful and functional online stores, choosing from a wide range of themes and add-ons that allow you to personalize the look and functionality of your store. The capabilities of PrestaShop include inventory management, payment processing, marketing campaigns, sales analysis, and much more. PrestaShop is open-source, which means you can modify and extend the platform to meet your specific needs.
PrestaShop (AlmaLinux 8)
- OS: almalinux 8
Description
Software included
Package | Version |
---|---|
PrestaShop | latest |
Docker | 3.20.10 |
Docker compose | 2.12.2 |
containerd.io | 1.6.10 |
Initial start of the service
This application uses Docker to provide faster startup of the companion software (PrestaShop) and direct use. This eliminates the need to familiarize yourself with its specifics in terms of configuration and installation. To start working directly with the application, all you have to do is visit the IP address assigned to your virtual machine in your browser to see your new PrestaShop installation.
Note: By default, PrestaShop can be accessed directly by IP address. To start using PrestaShop with your real domain, you must first point the domain in question to your IP address and change the settings for where PrestaShop opens from through its admin panel.
Quick settings and frequently asked questions
- Logging into the cloud service is done using an SSH key or password that you have specified.
- Docker is installed as recommended by the official docker documentation.
- The standard
docker
anddocker compose
commands are now available in this application. - When the virtual machine is first started, it takes a few minutes before a Docker container containing PrestaShop is started.
- PRESTASHOP data is set to be persistent and is located in
/opt/prestashop/data/
. MariaDB is also persistent and stores its databases in/opt/mariadb/data/
. - The user to access the PrestaShop admin panel is
admin
and the password isP@ssw0rd!
.
Note: By default, PRESTASHOP_HOST is set to be the first address of the virtual machine. The goal is to have access immediately after starting the machine. To start using PrestaShop with your real domain, you must first point the domain in question to your IP address and change the settings for where PrestaShop opens from through its admin panel.
Using your own SSL certificate
An Apache webserver is also included in this application, which provides all the necessary software stack needed to run PrestaShop. If you wish to use your own SSL certificate, please read how to make these settings in our documentation for Apache for AlmaLinux 8.
Additional Docker settings
Additional PrestaShop settings that you can change and that are controlled directly by Docker are set as variable values in the configuration file /opt/docker-prestashop/docker-compose.yml
:
Note: After changing any of the values, you must recreate the Docker containers on which the application is running. For more information, please read the Recreating Docker containers section.
PrestaShop configuration options
General options
APACHE_HTTP_PORT_NUMBER: Port used by Apache for HTTP. Default: 8080 APACHE_HTTPS_PORT_NUMBER: Port used by Apache for HTTPS. Default: 8443 PRESTASHOP_FIRST_NAME: PrestaShop application User's First Name. Default: Admin PRESTASHOP_LAST_NAME: PrestaShop application User's Last Name. Default: User PRESTASHOP_PASSWORD: PrestaShop application password. Default: P@ssw0rd! PRESTASHOP_EMAIL: PrestaShop application email. Default: user@example.com PRESTASHOP_HOST: PrestaShop server hostname/address. PRESTASHOP_ENABLE_HTTPS: Whether to use HTTPS by default. Default: no. PRESTASHOP_EXTERNAL_HTTP_PORT_NUMBER: Port to used by PrestaShop to generate URLs and links when accessing using HTTP. Default 80. PRESTASHOP_EXTERNAL_HTTPS_PORT_NUMBER: Port to used by PrestaShop to generate URLs and links when accessing using HTTPS. Default 443. PRESTASHOP_COOKIE_CHECK_IP: Whether to check the cookie's IP address or not. Default: yes. See the Troubleshooting section for more information. PRESTASHOP_COUNTRY: Default country of the store. Default: bg. PRESTASHOP_LANGUAGE: Default language of the store (iso code). Default: en. PRESTASHOP_SKIP_BOOTSTRAP: Whether to skip performing the initial bootstrapping for the application. Default: no
Use an existing database
- PRESTASHOP_DATABASE_HOST: Hostname for MariaDB server. Default: mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER: Port used by MariaDB server. Default: 3306
- PRESTASHOP_DATABASE_NAME: Database name that PrestaShop will use to connect with the database. Default: bitnami_prestashop
- PRESTASHOP_DATABASE_USER: Database user that PrestaShop will use to connect with the database. Default: bn_prestashop
- PRESTASHOP_DATABASE_PASSWORD: Database password that PrestaShop will use to connect with the database. No defaults.
- PRESTASHOP_DATABASE_PREFIX: Database table prefix that prestashop will use in the database. Default: ps_
- ALLOW_EMPTY_PASSWORD: It can be used to allow blank passwords. Default: no
SMTP Configuration
- PRESTASHOP_SMTP_HOST: SMTP host.
- PRESTASHOP_SMTP_PORT: SMTP port.
- PRESTASHOP_SMTP_USER: SMTP account user.
- PRESTASHOP_SMTP_PASSWORD: SMTP account password.
PHP configuration
- PHP_ENABLE_OPCACHE: Enable OPcache for PHP scripts. Default: yes
- PHP_EXPOSE_PHP: Enables HTTP header with PHP version. No default.
- PHP_MAX_EXECUTION_TIME: Maximum execution time for PHP scripts. No default.
- PHP_MAX_INPUT_TIME: Maximum input time for PHP scripts. No default.
- PHP_MAX_INPUT_VARS: Maximum amount of input variables for PHP scripts. No default.
- PHP_MEMORY_LIMIT: Memory limit for PHP scripts. Default: 512M
- PHP_POST_MAX_SIZE: Maximum size for PHP POST requests. No default.
- PHP_UPLOAD_MAX_FILESIZE: Maximum file size for PHP uploads. No default.
SSL certificates
Use of own (paid) SSL certificates
If you already have ready-made, valid certificates, you need to make a few configuration modifications before you can use them. To achieve this, please follow these steps:
Step 1 - placing the certificates
Create a directory where the certificates will be stored:
mkdir /opt/certs/
Copy the certificates into the directory you just created and modify their permissions:
chown 1001:1001 /opt/certs/ -R
Step 2 - modify the Docker configuration
Open the docker configuration file /opt/docker-prestashop/docker-compose.yml
with a text editor and find the following snippet:
prestashop:
image: docker.io/bitnami/prestashop:8
ports:
- '80:8080'
- '443:8443'
environment:
- PRESTASHOP_HOST=localhost
- PRESTASHOP_DATABASE_HOST=mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER=3306
- PRESTASHOP_DATABASE_USER=prestashop
- PRESTASHOP_DATABASE_NAME=prestashop
- ALLOW_EMPTY_PASSWORD=yes
- PRESTASHOP_PASSWORD=P@ssw0rd!
- PRESTASHOP_EMAIL=admin@example.com
- PRESTASHOP_FIRST_NAME=Admin
- PRESTASHOP_LAST_NAME=User
volumes:
- '/opt/prestashop/data/:/bitnami/prestashop'
Edit it so it looks like this:
prestashop:
image: docker.io/bitnami/prestashop:8
ports:
- '80:8080'
- '443:8443'
environment:
- PRESTASHOP_HOST=localhost
- PRESTASHOP_DATABASE_HOST=mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER=3306
- PRESTASHOP_DATABASE_USER=prestashop
- PRESTASHOP_DATABASE_NAME=prestashop
- ALLOW_EMPTY_PASSWORD=yes
- PRESTASHOP_PASSWORD=P@ssw0rd!
- PRESTASHOP_EMAIL=admin@example.com
- PRESTASHOP_FIRST_NAME=Admin
- PRESTASHOP_LAST_NAME=User
volumes:
- '/opt/prestashop/data/:/bitnami/prestashop'
- '/opt/certs/cert.pem:/opt/bitnami/apache/conf/bitnami/certs/server.crt'
- '/opt/certs/privkey.pem:/opt/bitnami/apache/conf/bitnami/certs/server.key'
Note that /opt/certs/cert.pem
is the path to the certificate and /opt/certs/privkey.pem
is the path to the private key. You can name the files and directories as you wish, but they must be specified correctly in the configuration
Step 3 - restart the Docker containers
cd /opt/docker-prestashop/
docker compose up -d
Issuing certificates with Letsencrypt
If you wish, you can always issue free certificates from Letsencrypt as well. To do this, please follow the steps below:
Step 1 - install the necessary packages
Login to your server as root and run the following commands:
dnf install -y epel-release
dnf install -y certbot
Step 2 - issuance of the certificate
Please note that in order for a free certificate to be issued, you must be able to verify your domain ownership in some way. Letsencrypt provides several options for verifying your domains, in this example we will use verification by running a temporary web server.
To do this, temporarily stop the container with the docker stop docker-prestashop-prestashop-1
command. Important: Performing this step will temporarily stop your site from working. Make sure you perform this action at a time when it will least affect your users.
Issue the certificate with the command certbot certonly --standalone --preferred-challenges http -d example.com
, replacing "example.com" with the domain you pointed to your Cloud server IP address.
Step 3 - put the new certificates in the configuration
Open the docker configuration file /opt/docker-prestashop/docker-compose.yml
with a text editor and find the following snippet:
prestashop:
image: docker.io/bitnami/prestashop:8
ports:
- '80:8080'
- '443:8443'
environment:
- PRESTASHOP_HOST=localhost
- PRESTASHOP_DATABASE_HOST=mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER=3306
- PRESTASHOP_DATABASE_USER=prestashop
- PRESTASHOP_DATABASE_NAME=prestashop
- ALLOW_EMPTY_PASSWORD=yes
- PRESTASHOP_PASSWORD=P@ssw0rd!
- PRESTASHOP_EMAIL=admin@example.com
- PRESTASHOP_FIRST_NAME=Admin
- PRESTASHOP_LAST_NAME=User
volumes:
- '/opt/prestashop/data/:/bitnami/prestashop'
Edit it so it looks like this:
prestashop:
image: docker.io/bitnami/prestashop:8
ports:
- '80:8080'
- '443:8443'
environment:
- PRESTASHOP_HOST=localhost
- PRESTASHOP_DATABASE_HOST=mariadb
- PRESTASHOP_DATABASE_PORT_NUMBER=3306
- PRESTASHOP_DATABASE_USER=prestashop
- PRESTASHOP_DATABASE_NAME=prestashop
- ALLOW_EMPTY_PASSWORD=yes
- PRESTASHOP_PASSWORD=P@ssw0rd!
- PRESTASHOP_EMAIL=admin@example.com
- PRESTASHOP_FIRST_NAME=Admin
- PRESTASHOP_LAST_NAME=User
volumes:
- '/opt/prestashop/data/:/bitnami/prestashop'
- '/etc/letsencrypt/live/example.com/cert.pem:/opt/bitnami/apache/conf/bitnami/certs/server.crt'
- '/etc/letsencrypt/live/example.com/privkey.pem:/opt/bitnami/apache/conf/bitnami/certs/server.key'
With this modification, you end up "binding" the external certificates issued by Letsencrypt to the configuration that resides inside the docker container. Replace "example.com" with your domain name. After you change the configuration, you need to fix the certificate permissions with the command chown 1001:1001 /etc/letsencrypt/archive/example.com/ -R
, again replacing "example.com" with your domain name.
Step 4 - start the services
Since the docker container is temporarily stopped, it needs to apply the new configuration and start it. Please run the following commands:
cd /opt/docker-prestashop/
docker compose up -d
Step 5 (optional) - automatic certificate renewal
Automatic renewal can be arranged via cron. You can set the following cron configuration to make auto-renewal happen:
# Automated Letsencrypt renewal
0 0 * * * /usr/bin/certbot renew --pre-hook 'docker stop docker-prestashop-prestashop-1' --post-hook 'chown 1001:1001 /etc/letsencrypt/archive/example.com/ -R; docker start docker-prestashop-prestashop-1'
Of course, you can change the runtime whenever you want. In the above example, this task will run every day at 00:00.
Working with Docker
The organization of this application is entirely done using Docker. In this way, we can provide you with ready-made applications faster. In addition, their configuration is more flexible and quite controllable. To be able to control this application, however, you need to know some basic Docker functionalities and features.
Restarting all services
Restarting the database and the Docker container that contains PrestaShop itself, along with the rest of the software, can be done in two ways:
- By restarting the entire virtual machine
- Restarting the Docker containers, which is the faster option. To do this, access your machine via SSH, and run the following commands:
sudo su -
cd /opt/docker-prestashop
docker compose restart
Recreating Docker containers
Recreation of a docker container may be necessary if you've changed the configuration inside the docker-compose.yml
file. If there are changes, please follow these steps:
cd /opt/docker-prestashop/
docker compose stop
docker compose up -d
Checking the status of the Docker application
To check, you need to run the following commands:
sudo su -
docker ps -a
Please pay attention to the STATUS
column. It should show how long the service has been running, for example Up X minutes
. If the status is Restarting
then you need to check what is wrong with the application. In such a case, you can check by following the application logs as follows:
- Get the application name that you can see in the
NAMES
column from the output of thedocker ps -a
command. View the logs with thedocker logs <NAME>
command, whereis the name of the container.
Changing settings
The settings in section Additional Docker settings can be set in the docker-compose.yml file. The path to it is described again in this section. To change a setting, open the configuration file and note the environment
section under prestashop
. Each configuration option must be described on a new line with a dash in front, as in the following example:
environment:
- PRESTASHOP_FIRST_NAME=admin
- PRESTASHOP_PASSWORD=P@ssw0rd!
Please note that the correct indentation (number of spaces) must also be observed, as this is important for yaml configuration files.