Skip to content
byrnereese edited this page Mar 28, 2011 · 7 revisions

Setting Up Melody to Work with Git

This document will help users configure their system to assist in the deployment and management of plugins they rely on. This document is ideal for:

  • system administrators who want to ease and automate deployments
  • developers who want to make it easier to update plugins they are actively developing

Setting Up Apache

Before doing anything else, we need to make sure your web server is configured to follow symbolic links. Sometimes this is forbidden for security reasons, but can be enabled on a directory by directory basis. The config option in Apache is called FollowSymLinks. So assuming Melody is installed in the /var/www/cgi-bin/melody directory, add this to your Apache httpd.conf file:

 <DIrectory /var/www/cgi-bin/melody>
    Options FollowSymLinks ExecCGI
 </Directory>  

Setting Up Your Git Repositories

For simplicity, create a central location on your file system into which all git repositories will be clones. One convention we recommend is to create the following directory:

/var/github

Then make that directory your working directory and begin cloning your various plugins into it, like so:

prompt> cd /var/github
prompt> git clone git://github.com/github-username/mt-plugin-someplugin.git

Note: If the git://github.com/.... URL doesn't work, try this form instead. More info here and here.

prompt> git clone https://github.com/github-username/mt-plugin-someplugin.git

If the repository you are cloning is one that you expect to be making changes to, and then committing those changes back to github, do not be alarmed if your clone URL looks like this:

prompt> git clone git@github.com:github-username/mt-plugin-someplugin.git

When you are done, your github directory will probably look something like this:

/var/github/mt-plugin-someplugin/plugins/SomePlugin
/var/github/mt-plugin-someotherplugin/plugins/SomeOtherPlugin
/var/github/mt-plugin-coolplugin/plugins/CoolPlugin

And so on.

Github Users: Setting Up SSH Keys

If you are a Github user, and you plan on setting up your repositories not only to pull code down from github, but to push changes back up to github, then you will need to associate an SSH Key with your github account. Otherwise, when you attempt to pull code from a private repository, or push code back up to github, you will get authentication errors.

» Read more about Setting up SSH Key for Github

Linking to Your Respositories

Once your repositories have all been cloned, which effectively downloads the plugins to your local file system, you can install them by creating symbolic links to them inside of Melody's plugins folder. Keep in mind that the symbolic links you create must be with the "plugin envelope" directly. The plugin envelope being the folder or directory that contains the plugin's config.yaml file.

So using the repositories above as an example, here is the sequence of commands you would execute:

prompt> cd $MELODY_HOME
prompt> cd plugins
prompt> ln -s /var/github/mt-plugin-someplugin/plugins/SomePlugin SomePlugin
prompt> ln -s /var/github/mt-plugin-someotherplugin/plugins/SomeOtherPlugin SomeOtherPlugin
prompt> ln -s /var/github/mt-plugin-coolplugin/plugins/CoolPlugin CoolPlugin

Updating Plugins

With your various plugins now linked to a corresponding git repository, updating plugins is easy. Let's say the plugin 'Cool Plugin' just released version 1.1 which you want to upgrade to. No problem, just navigate to the repository and pull down the latest code:

prompt> cd /var/github/mt-plugin-coolplugin
prompt> git pull origin master

And you are done.

Tip for Movable Type Users

So you are a Movable Type user huh? No worries, you can use this technique as well. However Movable Type has a lot of plugins installed for you in the plugins folder. It is our recommendation that you create a separate folder in which to store your linked plugins, and leave Movable Type's plugins folder alone, leaving it to contain only the plugins that come bundled with the core application.

To do this we will take advantage of a configuration directive that both Movable Type and Melody support: PluginPath configuration directive. This directive allows you specify additional directories Movable Type should search for installed plugins.

First, create a directory that will hold the various symbolic links to your installed plugins. For example:

prompt> mkdir /var/movabletype-plugins

Next, edit your mt-config.cgi file (or config.cgi file if you are using Melody) and add the path you just created to your plugin search path by adding the following lines to that file:

PluginPath plugins
PluginPath /var/movabletype-plugins

Finally, create your symlinks just like you would for Melody:

prompt> cd /var/movabletype-plugins
prompt> ln -s /var/github/mt-plugin-someplugin/plugins/SomePlugin SomePlugin
prompt> ln -s /var/github/mt-plugin-someotherplugin/plugins/SomeOtherPlugin SomeOtherPlugin
prompt> ln -s /var/github/mt-plugin-coolplugin/plugins/CoolPlugin CoolPlugin

 

Category: Guide

Tags: symlinks, git, system administration


Questions, comments, can't find something? Let us know at our community outpost on Get Satisfaction.

Credits

  • Author: Byrne Reese
  • Edited by: Violet Bliss Dietz
Clone this wiki locally