building a rails 3 turnkey cyber-dojo server




I've been working on building a Cyber-Dojo VirtualBox Turnkey image that uses rails 3 and ruby 1.9.3 on top of the Turnkey Rails app. I figured the steps involved might be useful for someone so here they are. You can also download them as a shell file here .

First I removed the existing ruby
# cd ~
# apt-get purge ruby-enterprise
Then install libyaml
# cd ~
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
# tar xzf yaml-0.1.4.tar.gz
# cd yaml-0.1.4
# ./configure
# make
# make install
Then install the version of Ruby I want (this takes quite a while)
# cd ~
# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
# tar xzf ruby-1.9.3-p125.tar.gz
# cd ruby-1.9.3-p125
# ./configure --disable-install-doc
# make
# make install
Then pull the rails3 Cyber-Dojo source (hit return when it asks for a password). I got some utf-ascii conversion warnings which don't seem to matter. When asked if I wanted to overwrite an executable I responded [y]es. This too takes quite a while.
# cd /var/www
# git clone https://JonJagger@github.com/JonJagger/cyberdojo
# chown -R www-data cyberdojo
# chgrp -R www-data cyberdojo
# cd cyberdojo
# gem update --system
# gem update --no-rdoc
# gem install bundle --no-ri --no-rdoc
# bundle install
Then setup apache
# cd /etc/apache2/sites-enabled
# sed s/railsapp/cyberdojo/ <railsapp >cyberdojo
# rm railsapp
# cd /etc/apache2/sites-available
# sed s/railsapp/cyberdojo/ <railsapp >cyberdojo
# rm railsapp
# cd /etc/apache2/conf
# sed s/railsapp/cyberdojo/ <railsapp.conf >cyberdojo.conf
# rm railsapp.conf
Then setup passenger (it takes quite a while), and edit /etc/apache2/conf.d/passenger as directed by the output
# cd ~
# apt-get update
# apt-get install libcurl4-openssl-dev
# cd /var/www/cyberdojo
# gem install passenger --no-ri --no-rdoc
# passenger-install-apache2-module
Then
# cd /var/www/cyberdojo
# service apache2 restart
And viola, Cyber-Dojo was up. Saving to a .ova file creates a 418MB file. This will give you C and C++ (gcc 4.4.5), Perl (5.10.1), Python (2.6.6), Ruby (1.9.3). If you want to upgrade any of these or use any of the other languages you'll need to install their compilers and unit test frameworks. The instructions in the github readme might be useful.

4 comments:

  1. After upgrade, I failed to access cyberdojo: 404 not found. And there is no 'production.log'. But I found that I can start this application by call script/rails manually. Can you please help?

    ReplyDelete
  2. It sounds like you did a git pull onto the current ova image - that won't work - see comments in the readme.txt file.
    I will install the missing compilers and publish a new ova image in the next few days.

    ReplyDelete
  3. Jon

    you are awesome! Thanks for the catalog of all the steps!

    BTW: In the instructions after '# passenger-install-apache2-module', there were no errors and no corrections needed

    This step took quite a while (>30 min):
    ----
    # Fetching: libv8-3.11.8.3.gem (100%)
    # Building native extensions. This could take a while...
    ----

    The restart at the end seemed to be taking forever, as the prompt came out in the middle of the apache output. I waited and waited. Also apache also could not figure out the domain name. In the end, neither mattered.

    ----
    root@rails www/cyberdojo# /etc/init.d/apache2 restart
    Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    .
    root@rails www/cyberdojo# checking for alloca.h... yes
    checking for ruby/io.h... yes
    creating Makefile
    compiling /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/ruby/passenger_native_support.c
    linking shared-object passenger_native_support.so

    Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
    .
    ----

    ReplyDelete
  4. Hi James,
    glad it was useful. You're right, the two steps after passenger install don't now occur if you follow the steps because I've made that change in the cyberdojo git repo. I'll note that in the page. Thanks

    ReplyDelete