Prestashop Test/Production Server Best Practices
Asked Answered
E

2

7

We have an eShop build on prestashop and we are developing new features every week. I'm writing here because I don't find the correct way to update our production environment with the changes, without having to upload all the code again or having to upload the modified files manually.

Now we work like this:

  • Our developers work with local copies connected to a GIT repo.
  • Once we have some new features and we want to create a new release I download the latest version from the repo and test it locally on another computer.

=> HERE comes the part that I don't like... :)

  • Once all the tests have been passed in my local copy we take all the files that have been modified (looking at the commits) and we upload them manually to the development environment.
  • We test it again and if it works we upload the same files to the production environment.

We have been thinking in linking both environments source files with the repo as well, but I don't link it because I don't want to have the .git folder published messing my production code.

I didn't find the way of having a tested copy of our code pushed at our GIT REPOSITORY and update the servers automatically, without having to upload the files manually or having to upload entire folders (themes, classes, etc...) via FTP.

Is there anybody working with prestashop and GIT and having a nice automated system to do all this? :)

Many thanks in advance!

Regards,

Jordi

Entertainer answered 18/4, 2013 at 11:45 Comment(0)
P
8

Here is the workflow we use, it's (I guess) pretty standard:

  • one git repo
  • preprod domain
  • prod domain

All the development is done on branches, when it's ready to ship we merge on the master. So on the preprod we pull the branch we are working on, and on the production we only pull the master. The preprod and prod domain are on the same server, it's just a sub-domain with a htaccess to protect it.

We use this not only for Prestashop but for every thing, it works well.

For the part where you want to automatically pull the code, it must be possible (à la Heroku). But for me the most important is: you should git everywhere and forget about FTP. It's really easier and you're sure everything you need is updated.

Pruritus answered 18/4, 2013 at 14:8 Comment(2)
Hi romainberger. We also use the branches. What I don't understand about your solution is: do you have the .git files inside your /var/www folder? Is this secure?Entertainer
The repo is not hosted on the same server, but yes, for the production the .git folder is here. It's needed to be able to use git. I am not an infosec professional but I've never heard of the .git folder as source of security issues.Pruritus
S
-1

I think you answer is not correct as well :)

Check this code if you use apache on you web server

This need to be present in your .htaccess file

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule . - [E=HTTP_AUTHORIZATION:%1]

And of course you need to have .htpasswd file.

Its mean any file or foldier which name start form "." dot, you need to autorize before you have an access to it.

See more about Mod Rewrite here: http://httpd.apache.org/docs/2.2/rewrite/access.html

I thik it will be useful for you Jordi. (Saludos de Bcn)

Sarad answered 9/9, 2013 at 7:35 Comment(1)
Good point. We did something similar which was adding a Redirect for "all urls containing .git": RedirectMatch permanent .*\.(git)/.* /Entertainer

© 2022 - 2024 — McMap. All rights reserved.