Deploying a Prestashop ecommerce: the cloud friendly way — Part 6 — Git Power 💪
This article is a continuation of Deploying a Prestashop ecommerce: the cloud friendly way — Part 5
Will learn how to integrate Git with Prestashop
If you plan on modifying the original Prestashop, I’ll recommend using a version management tool such as Git and Github. This will help you in:
- Tracking changes: features, fixes, etc.
- Sync your local development machine with your production server.
I am assuming that you are familiar with Git and Github, so I won’t go into details on how to set-up a repository, commit changes, etc.
I’ll recommend not modifying the core of Prestashop to avoid issues. Hence I’ll be only tracking changes on these folders:
- /modules
- /themes
- /overrides
To do that I’ll use this .gitignore
file:
I’ll consider that you already have a working local repository sync with a remote repository in Github or other service of choice. Gitlab is my other go to service.
The next steps will show you how to link that repo to the server that is running your Prestashop.
The first step is to install git in the server:
sudo apt-get install git
Then you need to generate an RSA key that you’ll use to link with your Github account:
ssh-keygen -t rsa
Follow the instructions in the console. Once is generated, access the key and add it to your github account.
Once it is completed then you can clone the repository you are going to be using to your user’s folder:
git clone git@github.com:yourusername/mod-prestashop-repo.git
Move the files to the /var/etc/www/
and your server is ready to push/pull changes to the remote repository in Github.
Make sure to sync any changes you are making in the server as well. Every time you install a theme or a new module, Prestashop is introducing changes to the repository in your server, make sure to sync those changes with the remote repository in Github and local development machine to avoid running into issues.
Last but not least … on Part 7 — Coming soon — we’ll learn how to add SSL encryption to our Prestashop 🔐