I installed Magento 2 using composer locally (on my local Dev environment using MAMP).
- I added my custom theme and did all my frontend work on my local Dev site.
- I want my code and changes to be tracked by Git and pull it in on my Staging site (from the Beanstalk remote repo)
I installed Magento 2 using Composer and @Claudiu Creanga advised me in this article to use the service Deploybot to deploy the site to Staging.
I have a few questions regarding this process:
- How do I have to setup my .gitignore file? In other words; which files and folders I have to track and I have to commit and push to my remote repo?
- How do I install my site on the Staging server? Also using Composer?
- Because I used Composer to install Magento 2, I can use
composer updateto update Magento 2 core. But how do I update my Staging site? Also usingcomposer update? So if I understand wright I don't pull in this update changes by Git from my remote repo? - How do I install and update Extensions? Also using Composer? So I don't add the Extensions via Git and I don't track the Extensions, isn't it?
1 Answer 1
You should use this .gitignore
In my opinion you should remove the line /dev/tools/grunt as you want to track the grunt folder. You deploy the composer files and a few other folders needed.
Then on your staging server you run automatic commands like:
cd ~/your_root_folder
php bin/magento cache:flush
composer install
php bin/magento setup:upgrade
grunt clean
grunt exec
grunt less
php bin/magento setup:static-content:deploy en_US en_GB
Depending on your configuration other commands may need to run.
Ideally you should install extensions with composer because it makes managing dependencies better. The truth is that few vendors offer them through composer, they still send you a zip package via email. So you should drop it in the app/code folder which is tracked by git.
*If you're using mamp, check the php version. Magento2 doesn't work with php 7.0.0 and mamp didn't yet release a newer version of php7 I think.
-
Thanks! About the
.gitignorefile; I added your.gitignorebut it still tracking 32169 files? 1) Do I have to add/node_modulesand what about/updatefolder? Do I have to add/updatealso to.gitignorefile? 2) What is the purpose of tracking the grunt folder? 3) To get things clear: What are my steps to get my Staging server ready? I am a bit lost here? Do I have to do acomposer installon my Staging server. What steps I have to do to migrate my local version to staging server using composer and Deploybot etc?meez– meez2016年06月16日 08:05:49 +00:00Commented Jun 16, 2016 at 8:05 -
1/node_modules should not be tracked so add it to your .gitignore. track the grunt folder because in themes.js you will add your theme settings. yes, you need to do a composer install on the staging server. composer update locally, push to staging and on staging composer installlClaudiu Creanga– Claudiu Creanga2016年06月16日 08:36:23 +00:00Commented Jun 16, 2016 at 8:36
-
1) So I will track the whole
/dev/tools/gruntfolder in Git? And what about the/update folder? 2) So after I properly set my.gitignoreI push all tracked code to Beanstalk remote repo. Till here I can follow the proces. But what do I have to do next? Where does Deploybot is getting involved. And before hand what do I have to do on the Staging server? 3) Can you explain this 'composer update locally, push to staging and on staging composer installl'. I don't understand exactly the proces?meez– meez2016年06月16日 10:59:41 +00:00Commented Jun 16, 2016 at 10:59 -
sorry but do you have an answer on my last comment? Thanks!!meez– meez2016年06月20日 16:27:29 +00:00Commented Jun 20, 2016 at 16:27
-
In addition: 1) For what do I need Composer anyway on Staging server? Is this to get the vendors once only on the Staging server? Why shouldn't I do this via ssh on the server with
php composer.phar install? 2) I need Composer on the Staging server only 1 time for the installation isn't it? The site isn't getting 100 visitors per hour and are symlinks working on shared hosting?meez– meez2016年06月21日 08:59:59 +00:00Commented Jun 21, 2016 at 8:59
Explore related questions
See similar questions with these tags.