Jump to content

Prestashop within a docker container


Recommended Posts

Hello, 

 

I am reconsidering the development workflow of our prestashop store as well as the better management of all the aspects that impact with the store.

 

For a while I have been looking for a way to try setting up memcache or / and vanish in order to find best optimazition techniques that can work with my setup. I was always afraid that things wouldnt work as expected on live website (as they didnt once) and a way to go back might not be that easy since the librarys would already been installed on server.

 

Docker seems to provide a very good soltuion for this.

 

I have been reading a lot about docker lately and the benefits that provides seems amazing. We can actually test anything and be sure that it will work exacly the same on live site.

 

Still havent resolved how a few major things should be configured before start working on it, such as:

- Do we include all the product images/attachments on the image? If so, this wouldnt make the image file size huge?

- Is database saved & included in the docker? If so, lets say we install a new theme on the image we have from a week ago. We push this new version of the image with the new theme to live site, in such a case, wont database be as it was a week ago + with any changes the theme installation applied? What about the data that were created on live site within this time?

 

If anyone is already using a docker for running prestashop, any workflow guidance would be more than welcome :) .

 

Regards,
C

Link to comment
Share on other sites

Hello & thanks for the reply!

 

 

Database should be inside of other Docker Container as per Docker best practices.

 

Prestashop & MySQL should be in different containers that are been tracked separately?

Whene we install a module or we do a ps update that impacts both ps files & mysql. How can we bring such an update to the live server?

What about the assets managment (product images, attachments etc), will we be able to manage them in a container?

 

Thanks,
C

Link to comment
Share on other sites

Never bring a Docker container used in development into production... just play with it and then apply the same changes in production and do not forget to point the development one to the mysql one for development.

 

You need to be very comfortable using the command line in Linux to be able to properly use a Docker Container or mange your own VPS or Server, otherwise you cause lot of Security problems for your Online Store.

Link to comment
Share on other sites

Never bring a Docker container used in development into production... just play with it and then apply the same changes in production and do not forget to point the development one to the mysql one for development.

 

You need to be very comfortable using the command line in Linux to be able to properly use a Docker Container or mange your own VPS or Server, otherwise you cause lot of Security problems for your Online Store.

So, docker is not ready for production yet?

Link to comment
Share on other sites

What Docker are you refering to?

 

If is ready or not only depends how it was configured.

 

Docker by itself alone is not enough, you need to setup a server inside of it with your application and then create a Docker Image.

Link to comment
Share on other sites

What Docker are you refering to?

 

If is ready or not only depends how it was configured.

 

Docker by itself alone is not enough, you need to setup a server inside of it with your application and then create a Docker Image.

 

A docker container like the one you mentioned above [ https://github.com/PrestaShop/docker

 

I am not refering to any specific image that i am tracking since my questions are about the workflow & best practises of running docker with prestashop for development & syncing with live server. 

 

 

When we install a module or we do a ps update that impacts both ps files & mysql. How can we bring such an update to the live server?

What about the assets management (product images, attachments etc) ??

Link to comment
Share on other sites

I use Docker Compose to create a set of docker images that can work together. In fact, I have more docker-compose configurations for LAMP/LEMP, for XDebug or not, different PHP versions, different PrestaShop versions, and so on. Docker Compose works very nice in my case.

 

Here is the list of the images "composed" for PHP development:

application
memcached
db
php
php-cli
apache

Link to comment
Share on other sites

I use Docker Compose to create a set of docker images that can work together. In fact, I have more docker-compose configurations for LAMP/LEMP, for XDebug or not, different PHP versions, different PrestaShop versions, and so on. Docker Compose works very nice in my case.

 

Here is the list of the images "composed" for PHP development:

application

memcached

db

php

php-cli

apache

Hi tuk66,

 

Can you give us more details about the workflow you follow?

- How do you install a new module and how do you push that to production?

-- What if this module creates new db tables & new php files? You ll have changes in your 2 images.

- If you db data saved within your container ? If you push a new db update you actually roll back to the state your db was when you backedup?

- How do you manage your store assets (pictures, attached documents etc)? Do you dockerise them?

 

 

Thanks in advance,

C

 

edit: Do you have to turn down in order to rebuild and use the newest image?

Edited by HaCos (see edit history)
Link to comment
Share on other sites

Database is stored in one container. I call it db.

Everything else is another level, on top of Docker containers. I must say that to manage PrestaShop in a container (or a web server) is incredible difficult and I have created several CLI scripts that do backup, restore, install, database_dump, load_fixtures and mostly work with "PrestaShop images" - files and database ready to backup and restore.

  • Haha 1
  • Sad 1
Link to comment
Share on other sites

  • 2 years later...

I never used docker but have experienced using vagrant as my main website development for many years but I just stopped there. I know vagrant and docker, the concept still the same. Do not over obsessed with the purpose of this technologies. They are not developed to make your development easy but the point is to make the testing environment better by working with team. Normally if you work with team, you need to use docker or you gonna have miscommunication. So the other people can test your work without asking you "what do I need to run this thing" and you wasted a lot of time for setting up the same environment? if you are like me working alone, I just use private git repo + ftp push. You don't need docker.

Normally this is what I do without docker or vagrant. Only do this if you don't share your server configuration with other team:

1) Create a random dev subdomain for testing purposes like dev.mywebsite.com, install prestashop in here with the database dev_prestashop. You can put more tests in the same server like dev2.mywebsite.com, dev3.mywebsite.com. So the dev.mywebsite.com is like a beta version of the live site in www.mywebsite.com

2) Secure this dev.mywebsite.com with httpd or nginx password and only you and your team can access this

3) Now create an empty git repository inside this directory and push as a new repo at your git online repo (I choose my own hosted gitlab svn.mywebsite.com)

4) Now you have the test server with the same configuration as live server and git-able with your team! The reason I don't see the need of Docker.

So, how do you update changes to live production on www.mywebsite.com? What about the database? Here is how I did it:

1) in the public_html for my dev.mywebsite.com, I created a new folder that stores prestashop sql files -> public_html/mydb/ . Then, I dump the sql file without zip or gz compression (eg. dev-prestashop.sql) so I can detect changes from my private git.

2) If let say I want to commit the dev project, I have to set a rule that I always need to copy a new database inside the directory so it will be synced.

3) Then, for the live production, I can just pull it from the dev repository and make changes there

 

Edited by arafatx
Share how I setup my development. (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...