Skip to content

Presta Shop as SUT (Docker)

Original installation Guide

Your own virtual machine setup & checkings

When you are setting up your own Virtual Machine for the presta service you have to check first some configurations first. In this example you should use as Ubuntu Linux 24.04 for installation

  • Make sure you have Docker up and running
  • If not install Docker according latest guides https://docs.docker.com/engine/install/ubuntu/
  • Check what is you current virtual machine local ip and external_ip if you are using hosting environment like cPouta at CSC.
  • You have to check also which is your virtual machines Docker network address

Login your Virtual Machine first!!

You can get you network addresses by using ip command

ubuntu@squash-evo:~$ ip a

Result example below

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8950 qdisc pfifo_fast state UP group default qlen 1000
    link/ether fa:16:3e:ea:18:e6 brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 192.168.1.213/24 metric 100 brd 192.168.1.255 scope global dynamic ens3
       valid_lft 85669sec preferred_lft 85669sec
    inet6 fe80::f816:3eff:feea:18e6/64 scope link
       valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    link/ether 02:42:16:e7:fb:07 brd ff:ff:ff:ff:ff:ff
    inet ---->>> **172.17.0.1/16** brd 172.17.255.255 scope global docker0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:16ff:fee7:fb07/64 scope link
       valid_lft forever preferred_lft forever

Internal IP: You will find you intrnal ip 192.168.1.213

Docker Network: As you can see above docker0 is reserved address is 172.17.0.1

How to check out your machines external ip (if in CSC)

Try: dig +short myip.opendns.com @resolver1.opendns.com

ubuntu@squash-evo:~$  dig +short myip.opendns.com @resolver1.opendns.com
195.148.30.154

DNS and your machines domain name

try: nslookup + IP-address

ubuntu@squash-tm-evo:~$ nslookup 195.148.30.154
154.30.148.195.in-addr.arpa     name = vm1664.kaj.pouta.csc.fi.

Installing Presta Shop

Now we have checked our current virtual machine's internal ip, external ip and docker network ip

Docker and Presta Shop

About docker usage you can read at https://devdocs.prestashop-project.org/8/basics/installation/environments/docker/

1. Creating first docker network for presta-shop service

sudo docker network create prestashop-net
2. Installing MySQL server as container

sudo docker run -ti --name some-mysql --network prestashop-net -e MYSQL_ROOT_PASSWORD=admin -p 3307:3306 -d mysql:5.7
Beware of different port setting 3307 for MySQL server

Starting Presta Shop Service as Container with selected tag (1.7.8.11):

sudo docker run -ti --name some-prestashop --network prestashop-net -e DB_SERVER=some-mysql -p 8080:80 -d prestashop/prestashop:1.7.8.11

Remember this will install presta shop version 1.7.8.11

Set Security rules for network:

Read about Security Group settings and Open Stack Network Settings

Open port for running apache service and Presta Shop through firewall by updating security group for yor service

In this case you have to allow port number 8080 for your VM

If you service is running ok you should be able to open this service page using browser with your server ip and port.

IF you are running at own desktop_http://localhost:8080/_

Diret IP addrss http://126.23.56.33:8080 or http://vm2460.kaj.pouta.csc.fi:8080

If you are lucky you will see installation wizard pages opening!

Installing service from web page wizard

Next task is to install Presta Shop with vm specifc configuration.

If you know your Docker network address you can locate you docker container ip addresses. We assume now you have docker installed and docker tool is working. When you have executed commands above to startup Pesta Shop service as containers you have to recheck ip where you MySQL server should be running. It is not running in default location like 127.0.0.1. It is located at Docker network space. In this case docker network is found at 172.17.0.1 When you hare running configuration pages you should enter corret values according you virtual machine.

Database server address will be changed according you docker network

address: 172.17.0.1:3307

Database login: root

Database password admin

Tables prefix ps_

Drop existing tables

After installation we should remove install directory

sudo docker exec -it some-prestashop rm -fr install

Original source: https://autom-devops-en.doc.squashtest.com/2022-07/howto/annexes/prestashopInstallation.html

Some background

Home pages: https://prestashop.com/

Release Notes: https://github.com/PrestaShop/PrestaShop/releases/

Download links for releasese: https://prestashop.com/versions/

Building SUT as example

Prestashop installation The installation of Prestashop using Docker is described in its Docker Hub page:

docker network create prestashop-net docker run -ti --name some-mysql --network prestashop-net -e MYSQL_ROOT_PASSWORD=admin -p 3307:3306 -d mysql:5.7 docker run -ti --name some-prestashop --network prestashop-net -e DB_SERVER=some-mysql -p 8080:80 -d prestashop/prestashop:1.7 Log to http://localhost:8080/ and perform the Prestashop configuration.

Then, remove the ìnstall directory

docker exec -it some-prestashop rm -fr install Rename the admin directory, for example into adminx.

docker exec -it some-prestashop mv admin adminx The admin page can now be accessed in http://localhost:8080/adminx/.