Solved

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

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Fine Tune your automatic Updates for Ubuntu / Debian
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.:
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.

773 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