Solved

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

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Suggested Solutions

rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

757 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

23 Experts available now in Live!

Get 1:1 Help Now