• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deploying CodeIgniter applications

I've used CodeIgniter to code up a small application (www.operational-research.gov.uk) that uses shared hosting. I just wanted to know how others deploy when they're using shared hosting (and hence don't generally have SSH access to do a SVN export or rsync).

My solution for now is to use the PEAR package Phing to automatically FTP all the relevant files into place - I've written a short blog post with details of the script here if anyone's interested (apologies for the shameless plug):

It works really well for me at the moment (while I'm the sole developer on the project) and it can easily be extended for team development using a version control package.

What do other people use for automated deployment?

I was using GIT with github while my application was in development (bluebookreport.org). It's easy to just to a git commit with gitx on the mac and then git push - git pull onto the server. Of course this doesn't deal with MySQL table changes, so you may or may not consider this automated deployment. I almost used capistrano but decided it wasn't worth the effort.

Also, randomly, and this may or may not help anyone, but it's really easy to change the mysql database settings using a hostname config like this (in the database config file):
if ($_SERVER['HTTP_HOST'] == 'localhost')
$active_group = "dev";
$active_group = "default";

$db['dev']['hostname'] = "localhost";
$db['dev']['username'] = "";
$db['dev']['password'] = "";
$db['dev']['database'] = "";
$db['dev']['dbdriver'] = "";
$db['dev']['dbprefix'] = "";


So that's basically my set up...

I do a similar thing in my index.php:
if ($_SERVER['HTTP_HOST'] == 'dev.operational-research.gov.uk') {
    define('DEV_ENVIRONMENT', true);
} else {
    define('DEV_ENVIRONMENT', false);
I then use this flag to switch between db settings based on the DEV_ENVIRONMENT constant.

This is of course quite hacky. I'm surprised Code Igniter doesn't have a better way of seamlessly switching between environments. I use Zend Framework for several projects and that handles config.ini files in a much more sophisticated way. CI doesn't seem to have an equivalent features.

[eluser]Michael Wales[/eluser]
Any shared host worth your money will offer SSH and SVN - if they don't: switch hosts. I can almost guarantee you are paying to much for the features you are receiving.

I'm on ASO, I do an svn export from my repository (either hosted on Beanstalk, Unfuddle, or on the shared hosting). During my development I keep a history of SQL files to create that environment, so a quick dump from that directory into MySQL and environment constant change (like david mentioned) and the site is live.

You're right about the shared hosting deal - any decent package includes SSH and the current shared hosting is too expensive for what it is. I personally am a big fan of https://nearlyfreespeech.net which gives SSH access and has a great dashboard for managing your sites. It also has a innovative pricing structure based on the bandwidth your site uses.

However, changing the DNS of a .gov.uk domain is like wading through treacle as they are controlled by a central government office and several committees have to sign off on the move. It's much easier to live with the FTP deployment for the time being.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.