Subversion on Media Temple (Subclipse, Auto-Deploy Method via SVN Update)

  • How would you like to have all of your code backed up?
  • How would you like it if you didn’t have to even FTP your files to your webhost?
  • How about being able to roll-back your production data to a previous revision with one line of code?

I had been wanting to do just that the past couple of weeks, and finally stumbled upon several different resources that helped me to do just that!

I am using Zend Studio for Eclipse, Media Temple as my host, and subversion as my versioning software.

Start Here:

Creating your subversion repository – only complete the first 3 steps:
http://kb.mediatemple.net/article.php?id=143

Setting up the repository and importing your projects:

http://www.bit-101.com/blog/?p=1060 or just continue along here – I have included the straight forward steps after going to the link above.

STEP 1: Add a New Repository in your Eclipse IDE (subclipse)

Go to the Subversion Repository View in Eclipse – Add a new repository location and enter the following details in order to connect:

  • svn+ssh://<your domain>/home/<your user number>/data/<your repository name>

NOTE: Make sure that your user number does not contain the prefixed ‘s’.

Then insert your user name and password:

  • serveradmin@<your domain>
  • <your password>

STEP 2: Creating Folders in your Repository:

Create the following folders in your new repository:

  • <your domain>
  • branches
  • tags

Note: Do not yet add a trunk folder, that part is coming!

STEP 3: Import your existing Project from Eclipse:

  1. Right-click on your project, and go down to Team – then click Share Project.
  2. Select SVN
  3. Choose the repository that we just setup
  4. Use your own name instead of the one it suggests, name it your domain name, or the folder that you created in your repo for this domain.

STEP 4: Setting it up so it will make your changes live on SVN Update – here comes the really good part!

Again – this will allow us to auto-magically update our files to the live server after committing them through subclipse.

I’m assuming that you are still in the shell on media temple, from there:

IMPORTANT:
You should be in the directory that you want to put these files (public html directory)

Let’s checkout the latest version of our trunk:

svn co svn+ssh://serveradmin%<your domain>@<your domain>/home/#####/data/svn/<repo name>/trunk ./

If you already have files inside your html directory:

svn add ./ –force

Then, check-in the latest copy of your code to your html public directory: (-m / -message)

svn ci –m “committing to my live site”

Then after committing any changes through subclipse, SSH into the live site folder (html) and type:

svn update

And voila! The latest files are added / updated!

Isn’t subversion sweet?

Other Subversion References:

http://kb.mediatemple.net/questions/143/Using+Subversion

http://www.breakitdownblog.com/using-mediatemples-subversion-svnssh-with-eclipse/

http://mitchellhashimoto.com/subversion-on-mediatemple/

http://stackoverflow.com/questions/438348/pushing-from-subversion-to-web-server

Saturday, July 11th, 2009 Subversion

1 Comment to Subversion on Media Temple (Subclipse, Auto-Deploy Method via SVN Update)

Leave a Reply

You must be logged in to post a comment.

[ad code=1 align=center]