Archive for category JobsWorth

Setting up a JobsWorth Server in Ubuntu

JobsWorth is a branch of the very awesome Rails application called Clocking IT.  So in order to do my part to help out, I would like to provide a how-to for setting up JobsWorth with Ubuntu Server Edition 10.04.

More information about Jobsworth found here: https://github.com/ari/jobsworth

and here: http://www.clockingit.com/

and here: http://groups.google.com/group/jobsworth

Ok, let’s get started!

My Setup:

  • Ubuntu Server Edition 10.04.3 – 32 bit
    • During Server Setup chose (as seen in screenshot):
      • LAMP Server
      • OpenSSH Server
      • SAMBA Server
      • JobsWorth Install - Server Settings

Prerequisites:

  1. Webmin

    • This is for easy setup of apache – to install, follow the instructions here: http://www.webmin.com/deb.html.  Go to section “Using the Webmin APT repository”.
  2. Ruby Version Manager (RVM)

Steps for the Install:

For the following steps, I adapted the instructions found here: https://github.com/ari/jobsworth.

  1. Install the follow packages, that will be needed to run JobsWorth

    • apt-get install mysql-server apache2 git-core imagemagick gcc libc6-dev g++ zip build-essential bison openssl libreadline6 libreadline6-dev curl zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libcurl4-openssl-dev apache2-prefork-dev libcurl4-openssl-dev libaprutil1-dev libapr1-dev libxslt-dev libxml2-dev openjdk-6-jre
  2. Install Ruby version 1.9.2 ***Note: You need to have followed the instructions here, and have Ruby Version Manager setup and working

    • rvm install 1.9.2
    • rvm --default use 1.9.2
  3. Install Bundler Gem – for more info on Bundler go here: http://gembundler.com/

    • rvm 1.9.2 do gem install bundler
  4. Install Phusion Passenger

    • rvm 1.9.2 do gem install passenger
    • rvm 1.9.2 do passenger-install-apache2-module
      • This will setup Apache for you
    • Once passenger sets up Apache for you, at the end of a successful process you’ll see a message like:
      • The Apache 2 module was successfully installed.
        Please edit your Apache configuration file, and add these lines:
        LoadModule passenger_module /home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
        PassengerRoot /home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
        PassengerRuby /home/tron/.rvm/wrappers/ruby-1.9.2-p290/ruby
        After you restart Apache, you are ready to deploy any number of Ruby on Rails
        applications on Apache, without any further Ruby on Rails-specific
        configuration!
        Press ENTER to continue.
        • Note:  Use your Username in the paths above. (just in case you didn’t notice :))
    • Don’t worry about the lines for the Apache configuration file – we’ll deal with those in a later step.
  5. Modify your “hosts” file

    • If your like me, and you are installing your server on an Intranet, you’ll need to modify your “hosts” file so Apache knows where to go.  Additionally, the JobsWorth setup needs a domain.
    • gksudo gedit /etc/hosts
    • Add this line to your “hosts” file – remember the domain you use, you’ll need it later
      • 127.0.0.1    wiki.yourmadeupdomain.com
  6. Get the source

    • sudo git clone git://github.com/ari/jobsworth.git /var/www/jobsworth
  7. Change the permissions for the jobsworth directory

    • sudo chown -Rv $USER /var/www/jobsworth
  8. Setup a Virtual Host on Apache using Webmin

    1. Log into your local instance of Webmin – default = https://localhost:10000 (sceenshot)
      • JobsWorth Install - Log into Webmin
    2. Create a Virtual Host for the jobsworth application (screenshot)
      • Servers –> Apache Webserver –> Create Virtual Host
        • see screenshot for the proper settings
      • Click Create
      • JobsWorth Install - Webmin - Apache Virtual Host
    3. Select the Virtual Host you just created (screenshot)
      • JobsWorth Install - Webmin - Select Virtual Host
    4. Click on Edit Directives (screenshot)
      • JobsWorth Install - Webmin - Edit Directives
    5. Change your Directive file, ***ignore the text in the sceenshot, copy the text BELOW the screenshot***
      • JobsWorth Install - Webmin - Virtual Host Directive
      • DocumentRoot "/var/www/jobsworth/public"
        ServerName wiki.yourmadeupdomain.com
        RailsEnv production
        PassengerHighPerformance on
        LoadModule passenger_module "/home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so"
        PassengerRoot "/home/tron/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11"
        PassengerRuby "/home/tron/.rvm/wrappers/ruby-1.9.2-p290/ruby"
        <Directory "/var/www/jobsworth/public">
        AllowOverride All
        Options -MultiViews +Indexes
        Order allow,deny
        Allow from all
        </Directory>
        • Note:  Use your Username in the paths above. (just in case you didn’t notice :))
      • Click Save
    6. Now restart your Apache Server
      • sudo /etc/init.d/apache2 restart
  9. Install the Gems that JobsWorth needs to run

    • cd /var/www/jobsworth
    • rvm 1.9.2 do bundle install
  10. Setup the database

    1. As of the time of this writing there were some database setup issues.  The following steps are a work-around.  If you have the more “up-to-date” steps, please comment and I will update this tutorial 🙂
    2. You have to set up your database.yml file manually.
      • Make sure you are in the right directory:
        • cd /var/www/jobsworth
      • cp config/database.example.yml config/database.yml
      • Mine looks like this:
        • development:
            adapter: mysql2
            database: jobsworth
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          test: &TEST
            adapter: mysql2
            database: jobsworth_test
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          production:
            adapter: mysql2
            database: jobsworth
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
          
          cucumber:
            <<: *TEST
          selenium:
            <<: *TEST
          
          staging:
            adapter: mysql2
            database: jobsworth_staging
            username: jobsworthDBA
            password: keepitsecretkeepitsafe
            host: localhost
            encoding: utf8
    3. Now create the database:
      1. echo "CREATE DATABASE jobsworth DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ON jobsworth.* TO 'jobsworthDBA'@'localhost' IDENTIFIED BY 'keepitsecretkeepitsafe'; FLUSH PRIVILEGES;" | mysql -u root -p
  11. Modify Ruby Setup File

    • As of the time of this writing (12/20/2011) the Dev made a change that broke the setup (at least for Ubuntu), so you’ll need to change it back.  Look for the following code, and make sure it looks like what I have below:
      1. Open the setup.rb file, located in /var/www/jobsworth/setup.rb
      2. Go to line 123, and make sure the code looks like this:
        • puts "Loading Rails to create account..."
          begin
            require File.expand_path('../config/environment.rb', __FILE__)
          rescue
            puts "*** Unable to load Rails, please ensure you have a working Rails environment. ***"
            exit
          end
        • Save changes
  12. Run the Ruby Setup File

    • cd /var/www/jobsworth
    • ruby setup.rb
    • Answer the first question “Enter hostname for the Jobsworth service (for example projects.mycompany.com):”
      • wiki.yourmadeupdomain.com
    • When you get to the question “Initialize database schema [n]:”, answer “y”.
  13. Email Setup

    • I have not yet gone through the email setup since my need is only for a local server.  The directions are located at “Step 8: Sending email” following this link: https://github.com/ari/jobsworth
  14. Finishing up

    • sh update.sh
    • ***Note: Could someone please comment and let me know if I am able to setup the Email after I run the “sh update.sh”????  I’m not going to need email for a while, so I have not set it up this tutorial, but I will and I don’t want to have to start all over to just setup Email.  PLEASE PLEASE let me know if you know
  15. Start using JobsWorth 🙂

That will do it.  Hope this helps some folks out! 🙂

And again, a big thanks to the JobsWorth Dev Team – thanks for this great tool! 🙂

End of Line.

Advertisements

15 Comments