cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 behind a load balancer and git configuration

Highlighted

Magento 2 behind a load balancer and git configuration

Hello. We have planned to host a ecom website on magento2. And for that, I have created 2 linux based vm on gcp behind a network load balancer as a service on Google cloud platform.

 

I am planning to put the magento code on git, so my concern is should I put everything over git or what should I avoid putting on git. 

 

Currently to sync the 2 server (running on apache2) I have put the media folder over nfs as a centralised media for both the server. Media folder stay on th nfs server.

 

So is it ok just to put the media folder over nfs or something else I should put on nfs server instead of pushing on git. I am new to Magento so having a little difficulty sorting things out.

 

What files/folder I should avoid putting on git because it works on autodeployment via Jenkins on both the server. Please suggest

3 REPLIES 3
Highlighted

Re: Magento 2 behind a load balancer and git configuration

Hi @maxjohnsonc680 

You should ignore following files & folders in ".gitignore" file before push code with git:

/.metadata
/.project
/.settings
atlassian*
/nbproject
/sitemap
/.idea
/.gitattributes

/app/config_sandbox
/app/etc/config.php
/app/etc/env.php
/app/code/Magento/TestModule*

/lib/internal/flex/uploader/.actionScriptProperties
/lib/internal/flex/uploader/.flexProperties
/lib/internal/flex/uploader/.project
/lib/internal/flex/uploader/.settings
/lib/internal/flex/varien/.actionScriptProperties
/lib/internal/flex/varien/.flexLibProperties
/lib/internal/flex/varien/.project
/lib/internal/flex/varien/.settings

/node_modules
/.grunt

/pub/media/*.*
/pub/media/solgirl/*
!/pub/media/.htaccess
/pub/media/catalog/*
!/pub/media/catalog/.htaccess
/pub/media/customer/*
!/pub/media/customer/.htaccess
/pub/media/downloadable/*
!/pub/media/downloadable/.htaccess
/pub/media/import/*
!/pub/media/import/.htaccess
/pub/media/theme/*
/pub/media/theme_customization/*
!/pub/media/theme_customization/.htaccess
/pub/media/wysiwyg/*
!/pub/media/wysiwyg/.htaccess
/pub/media/tmp/*
!/pub/media/tmp/.htaccess
/pub/media/captcha/*
/pub/static/
/pub/static/*
!/pub/static/.htaccess
/pub/media/attribute/*
!/pub/media/attribute/.htaccess
/pub/media/logo/*
!/pub/media/logo/.htaccess
/pub/media/emizen/*
/pub/media/ves/
/pub/media/ves/*

/var/*
!/var/.htaccess
/vendor/*
!/vendor/.htaccess

/var/*
!/var/.htaccess
_SpecRunner.html
/pub/*
/pub/media/attributeswatches/*
/pub/media/colorswatches
/pub/media/colorswatches/*
/pub/media/css
/pub/media/css/*
/pub/media/css_secure
/pub/media/css_secure/*
/pub/media/m-css
/pub/media/m-css/*
/pub/media/m-image
/pub/media/m-image/*
/pub/media/m-temp
/pub/media/m-temp/*
/pub/media/sales
/pub/media/sales/*
/pub/media/simpleswatches
/pub/media/simpleswatches/*

/generated


If it will help you. Please click on 'Kudos' & Accept as Solution!

Highlighted

Re: Magento 2 behind a load balancer and git configuration

Hi @Bhanu Periwal ,

As I have configured git poll scm webhook, so whenever someone commit a code on git, it will pull the entire code from git and replace the existing entire code on server.

 

So should should I put all the files/folder mentioned by you on my nfs server as I will not be pushing those to git branch.?

Highlighted

Re: Magento 2 behind a load balancer and git configuration

Hi @maxjohnsonc680 

If you already have folders/files on your server, you should create clone and save them with a separate branch first. By using following commands:

1. git clone <clone url>
2. git checkout -b <branchname>
3. git push origin -u <branchname>
4. git add .
5. git commit -m "commmit string"
6. git push origin <branchname>


Now your existing code will be save with separate branch.
Now create new branches from this branch and push changes with respective branch.
It will help you from conflicts of code/files.


If issue resolve, Please click on 'Kudos' & Accept as Solution!