Automating Movable Type Installation

| No Comments

Update: I’ve placed this upgrade script on the wiki, a better place for more people to enjoy and collaborate: wiki.movabletype.org/MT_Shell_Script_Installer

Automation is awesome! This script I use to set up a new MT instance probably saves me 15-20 hours a year, that 2-3 workdays.

I use the below shell script to:

  • checkout target release of MT
  • checkout addons (Packs [ProPack, MTCS, Enterprise], static files, & Tristan Theme)
  • checkout addons themes (Tristan
  • issue make
  • set up a static directory for the release
  • set permissions
  • create a mt-config.cgi file
  • and finally… open the release in TextMate

If you have an suggested improvements, please comment below!

Usage

Simple command does the above

$ makemt 41

Full command

$ makemt target-release {local-dir} {addons-release}

Note: If you are not using the addons (or don’t have access to them) you’ll need to comment out the portions of the script containing addons_branch.

Script

#!/usr/bin/env sh

# setup a new MT release
function makemt ()
{
    # usage: makemt target_release local_release_dir addons_branch
    # example: makemt 40 r40
    # target_release = svn repo name
    # local_release_dir = local release dir to place this repo
    target=${1};
    local_release_dir=${2};
    if [ ! $local_release_dir ]; then
        local_release_dir=$target;
    fi
    addons_branch=${3};
    if [ ! $addons_branch ]; then
        addons_branch="cal";
    fi
    if [ $target ]; then
        echo $target $local_release_dir $addons_branch;

        svn co http://code.sixapart.com/svn/movabletype/branches/release-$target /Sites/_live/cgi/release-$local_release_dir;
        echo SUCCESS: release-$target checked out;

        cd /Sites/_live/cgi/release-$local_release_dir;
        make;
        echo SUCCESS: make;

        mkdir /Sites/_live/html/r$local_release_dir;
        echo SUCCESS: created /Sites/_live/html/r$local_release_dir;

        chmod 777 /Sites/_live/html/r$local_release_dir;
        echo SUCCESS: permissions updated /Sites/_live/html/r$local_release_dir;

        cd /Sites/_live/html/r$local_release_dir;
        ln -s /Sites/_live/cgi/release-$local_release_dir/mt-static /Sites/_live/html/r$local_release_dir/mt-static;
        echo SUCCESS: symlink to /Sites/_live/html/r$local_release_dir/mt-static;

        chmod -R 777 /Sites/_live/cgi/release-$local_release_dir/mt-static/support;
        echo SUCCESS: permissions updated /Sites/_live/cgi/release-$local_release_dir/mt-static/support;

        cd /Sites/_live/cgi/release-$local_release_dir/;
        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/addons/;
        echo SUCCESS: svn co $addons_branch/addons;

        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-static/addons mt-static/addons;
        echo SUCCESS: svn co $addons_branch/mt-static/addons;

        svn co http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-static/themes/tristan-blue mt-static/themes/tristan-blue;
        echo SUCCESS: svn co $addons_branch/mt-static/themes/tristan-blue;

        curl http://svn.sixapart.com/repos/eng/mtaddons/branches/$addons_branch/mt-cp.cgi > mt-cp.cgi;
        echo SUCCESS: svn co $addons_branch/mt-cp.cgi;

        chmod 755 mt-cp.cgi
        echo SUCCESS: chmod 755 mt-cp.cgi;

        mt_config="# Config File Generated via makemt command
CGIPath /cgi-bin/release-$target/
StaticWebPath /r$target/mt-static

ObjectDriver DBI::mysql
Database mt_r21
DBUser root
DBPassword root
DBHost localhost
#DBSocket /Applications/MAMP/tmp/mysql/mysql.sock

##### CGI LOCATIONS #####
# AdminScript mt.fcgi
# CommentScript mt-comments.fcgi
# TrackbackScript mt-tb.fcgi
# ActivityFeedScript mt-feed.fcgi
# XMLRPCScript mt-xmlrpc.fcgi
# AtomScript mt-atom.fcgi
# UpgradeScript mt-upgrade.fcgi

DebugMode 1
DeleteFilesAtRebuild 1
# HTTPTimeout 60
# EnableAddressBook 1
# ShowIPInformation 1";
        echo "$mt_config" > mt-config.cgi;
        echo SUCCESS: mt-config.cgi created;

        mate /Sites/_live/cgi/release-$local_release_dir/;
        mate /Sites/_live/cgi/release-$local_release_dir/mt-config.cgi;
    else
        echo 'usage = makemt target local_release_dir addons_branch';
    fi
}

Leave a comment

About this Entry

This page contains a single entry by Beau Smith published on June 26, 2008 11:41 AM.

Enabling FastCGI on Movable Type 4.x was the previous entry in this blog.

MTML Code in Entries or Pages is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.21-en