Phone: +49 30 4373 3797

Magento Server Deployment

Dead-Simple Deployment: Headache-Free Magento Server Deployment with ZERO Downtime

Server Deployment

Server Deployment

Version: 1.0.2

With Mgt Deployment you can deploy a new version or feature in a few seconds. Test a new feature or rollout a new version to production without Headache and Downtime.

Community Edition: 1.2.x - 1.9.x

€ 399.00 *

Automate, Deploy, Scale - ZERO Downtime!

Mgt Deployment is a tool, based on Symfony 2 Console Component (PHP), for automating deployment on one or more remote servers.
It executes commands in parallel on all targeted mashine and provides a mechanism for rolling back a previous version.
It is ideal for anyone who wants release new versions without having a headache of broken deployments.

Automation Means Removing Busywork

Automation means that we are identifying tasks that we do manually on a regular basis and then getting a computer to do those tasks instead. When we have four application servers to configure, we don't type in all the package installation commands and edit all the configuration files on each server. Instead, we write scripts so that once we have one server perfectly configured, we can apply that same configuration to the other servers.

Assumptions

The Mgt Deployment tool makes a few assuptions about your servers. In order to use Mgt Deployment, you will need to comply with these assumptions:

You are using SSH to access your remote servers. FTP is not supported. If you are using passwords, which is not recommended, you must have the same password on every server. The prefered and more secure way is to access your server with a public key.
Please make sure you have got a good passphrase on your private key.

Source Control

It might seem strange to think of source control coming into play in a deployment configuration, but Mgt Deployment is (at least by default) highly dependent on your source control system.

At the moment Mgt Deployment supports only Git.

Tutorial

In this tutorial we will install and configure the Mgt Deployment tool for an example project with 3 Webserver and 1 Admin / Deployment Server.

Mgt Deployment Example Server Configuration

Installation of Mgt Deployment on Admin / Deployment Server
#login with ssh (root other any user with sudo rights)
ssh root@107.20.170.88

#add the deploy user
add user deploy

#add deploy user to group www-data
adduser deploy www-data
#extract mgt_deployment.tgz in /home/deploy/
tar xf mgt_deployment.tgz

#copy the example configuration file and edit cd /home/deploy/deployment/data/

cp config.yml.dist config.yml

vi config.yml

#configure environment overlays
#overlays are environment specific and usually not under version control like local.xml
#They are copied recursive during the deployment process vi /home/deploy/deployment/data/overlays/[environment]/app/etc/local.xml

Configuration file looks like this:

deploy:
    project: 
      name: "your_project_name"
      repository: "https://github.com/your_github_user/Your_Git_Repository"

server:
  production:
    commands:
      before_switch: []
      after_after: []
    shared_directories: ["media","var"]
    servers:
      server1:
        name: "web1"
        host: "10.29.28.108"
        port: "22"
        deploy_to: "/var/www/"
        ssh:
          user: "deploy"
          private_key: "/home/deploy/.ssh/deploy"
          public_key: "/home/deploy/.ssh/deploy.pub"
      server2:
        name: "web2"
        host: "10.28.34.22"
        port: "22"
        deploy_to: "/var/www/"
        ssh:
          user: "deploy"
          private_key: "/home/deploy/.ssh/deploy"
          public_key: "/home/deploy/.ssh/deploy.pub"
      server3:
        name: "web3"
        host: "10.28.34.24"
        port: "22"
        deploy_to: "/var/www/"
        ssh:
          user: "deploy"
          private_key: "/home/deploy/.ssh/deploy"
          public_key: "/home/deploy/.ssh/deploy.pub"
  test:
    commands:
      before_switch: []
      after_after: []
    shared_directories: ["media","var"]
    servers:
      server1:
        name: "test1"
        host: "10.28.35.217"
        port: "22"
        deploy_to: "/var/www/test/"
        ssh:
          user: "deploy"
          private_key: "/home/deploy/.ssh/deploy"
          public_key: "/home/deploy/.ssh/deploy.pub"

As you can see there are 2 environments configured "production" and "test".
The production environment has three webserver and our test environment has only one.
If you have more environments like "staging", "dev1", "dev2" you can easily add them.


Setup a webserver for deployment

Before we can start with the deployment process we have to create the directory structure that Mgt Deployment expects:

#login with ssh to web1, web2, web3 (root other any user with sudo rights)
ssh root@107.20.170.88

#add the deploy user
add user deploy

#add deploy user to group www-data
adduser deploy www-data
#authorize public key from admin / deployment server
cd /home/deploy/.ssh/
echo cat public_key_from_admin_server.pub >> authorized_keys
#cd to your project directory e.g. /var/www/
cd /var/www/

#create releases and shared directory
mkdir releases shared

#create media and var directory which will be symlinked later mkdir shared/media shared/var
Your directory structure should look like this

`-- /var/www/
|-- current → /var/www/releases/2012_09_25_03_16_40_tag_1.0.4/
|-- latest → /var/www/releases/2012_09_25_03_16_35_tag_1.0.3/
|-- releases | `-- 2012_09_25_12_18_22_branch_master
| `-- 2012_09_25_03_16_35_tag_1.0.3
| `-- 2012_09_25_03_16_40_tag_1.0.4
| `-- 2012_09_25_03_16_45_tag_1.0.5 |-- shared
| `-- media
| `-- var


Deployment Process
Mgt Deployment Process


Let's Deploy!

We want release a new version of our Magento store, let's see how it works with the Mgt Deployment

#login with ssh on the admin / deployment server
ssh deploy@107.20.170.88

#go to deployment directory
cd deployment/htdocs/

#let's deploy
php mgt.php deploy [environment] [tag|branch] [branch_name|tag_version]
Examples:
#Deploy a tag to production
php mgt.php deploy production tag 1.0.3

#Deploy a branch to production
php mgt.php deploy production branch master
#Deploy a branch to test
php mgt.php deploy test branch paypal_test



Rollback?

The version you have deployed is not stable? Let's rollback to previous version

#Rollback to previous version
php mgt.php rollback [environment]

Examples
#Rollback production
php mgt.php rollback production

#Rollback test
php mgt.php rollback test


See it in Action



Tags: magento deployment, magento server deployment, mgt deployment

Customer Reviews

Rated 5/5 based on 4 customer reviews

An absolute requirement

Review by customer review by DK for Server Deployment

5/ 5stars

Installation was swift and without problem. Looking back, I am kicking myself for not having this installed earlier as it would have avoided a lot of down time, errors and loss of sales. This is one of the best investments in my site that I have made (along with other MGT products). I highly recommend.

Does what it says on the tin

Review by customer review by David for Server Deployment

5/ 5stars

Good product and quickly installed. Very happy

Fantastic tool very easy to use!

Review by customer review by Tommy Eriksen for Server Deployment

5/ 5stars

It is incredible easy to deploy and test code and is somthing do not work MGT is very professional and fast to fix the problem :) Highly reccomended.

Just amazing

Review by customer review by David Mulari for Server Deployment

5/ 5stars

This is one of the best pieces of software i have ever bought. Now our team ( 5 developers ) has a perfect workflow and we are able to deploy new features and hotfixes in no time. The best is the possibility to rollback to the last deployment in case of unstable releases. It saves so much time to use MGT´s deployment for Magento. Thanks for the great support. David

Write your own review

1 star 2 stars 3 stars 4 stars 5 stars
Value