Solved

How to implement "Git push to deploy" on our own hosting environment?

Posted on 2013-11-08
1
521 Views
Last Modified: 2013-11-26
Being inspired by the way Acquia and Pantheon offers its customers "Git push to deploy" code from dev-staging-prod, how can we implement this in our own environment as we expand our team?

Our dev and prod has always been seperate silos, and transfering between them done manually.

So how to automate this with Git? Is there some turnkey solution we can implement or does this involve signficant custom programming?
0
Comment
Question by:sandshakimi
1 Comment
 
LVL 9

Accepted Solution

by:
oliverpolden earned 500 total points
ID: 39633536
The easiest way is to clone the repository on your server and then just do a Git pull when you want to deploy. Then there are varying levels of complexity:
 1. Create tags and then checkout a tag on the live server. This allows for rollback, you just checkout the previous tag.
 2. Have two "live" directories directories. The actual live directory is symlinked, the second directory, you can checkout the latest tag, view the result on a different domain or port then switch the symlink, this allows testing of the new tag in the live environment before it going public.
3. Create a script that exports a tag and then symlink to the exported directory. The benefit of this is that the repository is not in the public html folder, you could always put the Drupal root, one folder down in your repository but this can cause difficulties if you have different branches.

In addition to any of the above you can use deployment automation such as Fabric or Capistrano. These allow you to run a command from your local machine (or another internal machine) that will connect to the server to perform the checkout. This means you can do a command such as: fab test deploy:v1.1
This would deploy a tag v1.1 to the test server, likewise, fab live deploy:v1.1 would deploy to the live server.

You can also use continuous integration systems such as Jenkins which you could use to do your deployment.

Where I currently work, I set up a continuous integration environment which will automatically update our develop branch on the test/staging server when it detects any commits. This way we don't need to worry about "deploying" to test, it just happens. When we deploy to live, we create a tag from the master branch and then use fabric to checkout that tag on the live server.

It's really up to you how convenient/intelligent/complex you want the process to be but I'd be glad to help you further if you can let me know which route you would likely take.

Kind regards,
Oliver
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now