Radiant kickstart script

Creating new Radiant instances can become tiresome after a while, especially when you use a lot of the same extensions all the time. John Muhl's Ray extension can get you a long way for that, but there's still a lot of typing that could be cut..

I've put together a shell script that will:

  1. Create a new Radiant instance and
  2. Make it a git repository
  3. Create a local development and test database
  4. Install all your favorite extensions through ray
  5. Give you a preset Capfile, tailored to Radiant.

How it works

Put the contents of this gist in a file at /usr/local/bin. If you want to call the script with 'kickstart', as I do, create a file at /usr/local/bin/kickstart (kickstart being a file without extension, not a dir). That's it. You can now create a new instance as such: kickstart site_nameIf that gives you this:

mbpjomz:~/rails bennydegezelle$ kickstart foo                                                                                                  
bash: /usr/local/bin/kickstart: Permission denied                                                                                                    
mbpjomz:~/rails bennydegezelle$ sudo kickstart foo                                                                                             
Password:                                                                                                                                               
sudo: kickstart: command not found

This should fix it:

chmod +x /usr/local/bin/kickstart

Sorry windows people, I have no idea how to get this going on Bill's turf..

Due to the gallery extension, you need to tell which gallery layout you want. Other than that, it's a good idea to grab yourself a coffee while the script runs, as it downloads each extension live from github. Right.., let's kickstart the gems (yeah!).

MBPjomz:rails bennydegezelle$ kickstart foo
Creating new Radiant instance and initializing git repository.............[DONE]
setting up development and test db........................................[DONE]
Installing plugins........................................................[DONE]
Installing ray extension..................................................[DONE]
Installing default extensions(in /Users/bennydegezelle/rails/foo)
...
whole lotta feedback that you don't have to pay much attention to
...
Select which layout to create (leave blank to skip):
1. Simple
2. Simple carbon
3. Simple carbon with lightbox
4. Simple with lightbox
[1-4] values separated by commas: 
...
more extension installation feedback from Ray
...
Tweaking mailer ext.......................................................[DONE]
capify'ing................................................................[DONE]
committing kickstart......................................................[DONE]
setting ignore rules......................................................[DONE]

You actually don't have to wait for the gallery extension to ask for a layout number; press 1 (or nothing to skip) + enter right after the script started. It will then pass that to the script as soon as it expects feedback.

The Capistrano deploy file will go for a setup with git, mysql and Passenger. It also keeps your uploaded files (i.e. paperclipped assets and galleries) in the shared directory i.o. per release, for faster deploys and less diskspace usage. You will probably want to tweak the script to your own likings, just dive in and see how it's done! Any patches or suggestions are very welcome. And now for the second MC5 reference:

I done kicked 'em out!

I am in no way responsible for any sillyness going on below this line:

undefined tag `gravatar'

Jomz, any idea on this:

$ ruby kickstart kickthatshit2 Creating new Radiant instance and initializing git repositorykickstart:54:in `chdir’: No such file or directory – kickthatshit2 (Errno::ENOENT) from kickstart:54 from kickstart:7:in `announcing’ from kickstart:52

undefined tag `gravatar'

Judging from the line number, it looks like the ‘radiant’ command failed. Do you have the radiant gem installed? If not, just run

sudo gem install radiant

If it still doesn’t work, what feedback do you get when you manually try to generate a new radiant instance? i.e. radiant chunky_bacon

undefined tag `gravatar'

There's something funky that keeps the radiant command from working. Also, I shed tears of blood trying to get radiant to work with passenger 2.2.2. The workaround is to use 2.1.3 and build radiant from the repo.

This bash script installs Enterprise Ruby and Radiant. Ent Ruby automatically installs 2.2.2, so you have to say 'yes' when it asks you if you want to uninstall passenger. The script will then install 2.1.3. Also, no password for mysql if you want it to work out of the box.

#################For Windows Users

1. Go to Slicehost.
2. Signup for an account
3. Choose Ubuntu 9.04 Jaunty.
4. Type sudo sh what_you named_this_script
5. Login to www.site.com/admin/login
6. Get a beer.

#!/bin/bash

###########################################################################################
# Variables section. Edit these variables to customize the script
##########################################################################################
VERSION="1.1"
REEV="http://rubyforge.org/frs/download.php/51100/ruby-enterprise-1.8.6-20090201.tar.gz"
REEF="ruby-enterprise-1.8.6-20090201.tar.gz"
REEFF=${REEF%".tar.gz"}
PASSENGER="2.1.3" # beware the 2.2.2 issue. See kluge in passenger section below.
SERVER_NAME=""

#########################################################################################
#########################################################################################

echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"

echo "Updating Aptitude"
sudo apt-get install aptitude -y
sudo aptitude update

echo "Installing build essentials"
sudo aptitude install build-essential libreadline5-dev zlib1g-dev libssl-dev wget -y

echo "Installing GIT"
sudo aptitude install -y git-core

echo "Installing apache and headers"
sudo aptitude install -y apache2 apache2-prefork-dev

echo "Installing Ruby Enterprise from following url"
echo $REEV
wget $REEV

if [ -e $REEF ]
then
echo "File downloaded succesful"

else
echo "Error, file wasn't downloaded!"
exit
fi

tar -zxvf $REEF
# possible options perhaps for checker

if [ -d ./$REEFF ]
then
sudo ./$REEFF/installer --auto /opt/ruby
echo "Dir test"fi
else
echo "Dir not found, exiting.."
exit
fi
########################################################################
########################################################################
## Doesn't work with just editing the path.
echo "Creating ruby symlinks"
sudo ln -s /opt/ruby/bin/ruby /usr/bin/ruby
sudo ln -s /opt/ruby/bin/gem /usr/bin/gem
sudo ln -s /opt/ruby/bin/rake /usr/bin/rake
sudo ln -s /opt/ruby/bin/rails /usr/bin/rails
########################################################################

################### Add github and rubyforge
echo "Update gem sources"
sudo gem sources -a http://gems.github.com
sudo gem sources -a http://gems.rubyforge.org

#################### Sqlite3 for an easy alternative to mySql
sudo aptitude install sqlite3
sudo aptitude install libsqlite3-dev
sudo gem install sqlite3-ruby

######### Setup Mysql
echo "installing mysql"
sudo aptitude install mysql-server mysql-client libmysqlclient-dev -y
sudo gem install mysql
sudo aptitude install -y libmysql-ruby

mysql -u root -e 'CREATE DATABASE radiant_dev;'
mysql -u root -e 'CREATE DATABASE radiant_test;'
mysql -u root -e 'CREATE DATABASE radiant_live;'

################ install rails
echo "Installing rails and other gems"
sudo gem install rails -no-ri -no-rdoc

#############################################################################
################# Install radiant from gems #############################
#############################################################################
sudo gem install cucumber
sudo gem install rspec

cd /var/www/
sudo git clone git://github.com/radiant/radiant.git
cd radiant
sudo rm public/.htaccess
sudo cat config/database.mysql.yml | sed -e '/socket/ c\#socket: /tmp/mysql.sock' > tmp
sudo cp tmp config/database.yml
sudo chown -R www-data:www-data /var/www/radiant

sudo cat /etc/apache2/sites-enabled/000-default | sed -e '/DocumentRoot/ c\DocumentRoot /var/www/radiant/public' > tmp
sudo cp tmp /etc/apache2/sites-enabled/000-default

########################################################################################
## Passenger Setup
#######################################################################################

############# Prefered kluge ########
sudo gem uninstall passenger -v=2.2.2

echo "Installing passenger"
sudo gem install passenger -v=$PASSENGER
echo "Config passenger"
yes '' | sudo /opt/ruby/bin/passenger-install-apache2-module
sudo chmod +w /etc/apache2/apache2.conf
#################################################################
#Passenger 2.1.3 Config with Enterprise Ruby Setup
################################################################
echo "LoadModule passenger_module /opt/ruby/lib/ruby/gems/1.8/gems/passenger-$PASSENGER/ext/apache2/mod_passenger.so" >> /etc/apache2/apache2.conf
echo "PassengerRoot /opt/ruby/lib/ruby/gems/1.8/gems/passenger-$PASSENGER
PassengerRuby /opt/ruby/bin/ruby" >> /etc/apache2/apache2.conf

echo "Enabling passenger module"
sudo a2enmod passenger
echo "Reloading apache"
sudo /etc/init.d/apache2 reload

echo "##########################"
echo "# Installation Complete"
echo "##########################"
sudo /opt/ruby/bin/passenger-status
cd /var/www/radiant
sudo rake production db:bootstrap

echo "That's all folks. Make your way to the exits. And please, drive safely........."
##########################################################################################
############################ The End ######################################################
###########################################################################################

undefined tag `gravatar'

This fix below was on the Radiant Dev mailing list yesterday. My script installs to /opt/ruby. The principle should be the same.

#############################
I edit in my Fedora the file: ./.bash_profile

Put the Ruby Enterprise path before the other path and this will let
me call ruby or gem first in this order path... It worked as a regular
user and doing su.

# User specific environment and startup programs

RE=/usr/local/bin/ruby-enterprise/bin/
export RE

#PATH=$PATH:/usr/local/bin/:$HOME/bin/
PATH=$RE:$PATH:/usr/local/bin/:$HOME/bin/

export PATH
unset USERNAME
[dinooz@fedora ~]$

Successfully able to install and run Radiant with Ruby Enterprise in
Fedora Core 6. but should be the same for any other Linux.

undefined tag `gravatar'

Hi Paul,

not much serverside configuration experience here, so thanks for sorting that one out yourself :)

Your bash script is not really directly related to mine, but thanks for posting it here anyway, I’m sure other people will benefit from it.

Have something to add?



  • (required, but not displayed)

  • (optional)

About this article

You’re reading an entry titled “Radiant kickstart script”. Written

undefined tag `time_ago_in_words'
ago (05/05/2009) — and archived under radiant, script, shell. So far, 5 people (dis)agreed with me, what do you think?

What the fuzz is all about

  1. 2 pages are tagged with WYM
  2. 1 page is tagged with absolute-urls
  3. 1 page is tagged with arrrrcamp
  4. 2 pages are tagged with documentation
  5. 2 pages are tagged with editor
  6. 2 pages are tagged with extension
  7. 2 pages are tagged with extensions
  8. 1 page is tagged with minitorial
  9. 1 page is tagged with navigation
  10. 10 pages are tagged with radiant
  11. 4 pages are tagged with rails
  12. 2 pages are tagged with ruby
  13. 2 pages are tagged with shell
  14. 1 page is tagged with sifr
  15. 2 pages are tagged with troubleshooting

Github activity

More places where you can find me

Back to top