Solved

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

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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
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.

829 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