Solved

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

Posted on 2013-11-08
1
529 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 10

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

When working in a large software development team, whether you have many developers working on the same projects, or your project is linked to other projects; it is very important that developers regularly perform "get latest" to ensure that the cha…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 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