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
  1. #1 by sbeex on December 16, 2011 - 05:10

    Hello,
    nice how-to but could you explain in details the procedure to install rvm correctly because it’s a big problem for a noob like me to understand all of what they said on their page… should I install the multi user version ?

    It could be very friendly to add this part in my opinion 😉

    (And just a small mistake : you have written “curl” twice on the line with packages to install.)

    Thanks ! This how-to will maybe solve my problems… I’m trying again and again to install rvm correctly…

    • #2 by Aang on December 16, 2011 - 05:23

      Thanks for your comment 🙂 I will work on an RVM install how-to, although I cannot promise it will be right away :/ I can tell you however, that you want the Single-user installation for RVM.

      Also, one quick tip. If you are using Ubuntu on “2. Load RVM into your shell sessions as a function”, the command should be:

      echo ‘[[ -s “$HOME/.rvm/scripts/rvm” ]] && . “$HOME/.rvm/scripts/rvm” # Load RVM function’ >> ~/.bashrc

      You just need to change “~/.bash_profile” to “~/.bashrc”

      That part had me stuck on my first try.

      Thanks for the corrections 🙂

  2. #3 by Jhonny5 on December 20, 2011 - 08:04

    Hi!

    I still have problems with the line: require File.expand_path(‘../config/environment.rb’, __FILE__)

    Following your tutorial i got:

    # ruby setup.rb
    [..]
    Initialize database schema [n]: y

    /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’: no such file to load — bundler/setup (LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require’
    from /var/www/jobsworth/config/boot.rb:6:in `’
    from :29:in `require’
    from :29:in `require’
    from /var/www/jobsworth/config/application.rb:1:in `’
    from :29:in `require’
    from :29:in `require’
    from /var/www/jobsworth/config/environment.rb:2:in `’
    from :29:in `require’
    from :29:in `require’
    from setup.rb:135:in `’

    Thanks for the tutorial!

    Cheers,
    Jhonny5

    • #4 by Aang on December 20, 2011 - 14:29

      Howdy,

      Thanks for your comment. However, unfortunately I am not a Ruby/Rails expert, and that looks like a Ruby/Rails issue.

      Off the top of my head, did you do Step 9 “Install the Gems that JobsWorth needs to run”?

      If so, and you still have trouble, consider posting to the forums (http://groups.google.com/group/jobsworth) so we can get more people aware of the issue.

      -Aang

      • #5 by Jhonny5 on December 23, 2011 - 07:12

        Yes, every step works out fine.

        I already wrote to the ML.

        I will come again with any fix from there.

        Thanks again. 🙂

        Jhonny5.

  3. #6 by Nikita on December 31, 2011 - 08:48

    I have done all installation steps properly, without any errors. Then i have runned update.sh script, no errors occurred too.

    Then i’ve restarted apache and tried to access http://crm.local.dev (my installation address), but nothing happend, i still see only default index.html there. What i did wrong?

    • #7 by Aang on December 31, 2011 - 21:23

      Try http://localhost/jobsworth or http://localhost/jobsworth/public

      The above suggestion is assuming you followed my naming convention in the above tutorial. (i.e. – you followed this instruction exactly: sudo git clone git://github.com/ari/jobsworth.git /var/www/jobsworth)

    • #8 by renangurge on August 21, 2012 - 12:49

      Jhony did you already solve this problem? I stay with the same error here.

  4. #9 by Dhruv on January 8, 2012 - 13:04

    Documentation is incomplete.

    Before executing ruby setup.rb:
    1. Run update.sh
    2. export RAILS_ENV=production
    3. ruby setup.rb

  5. #10 by Dr.S on March 1, 2012 - 22:39

    After couple of tries , this one is working fluently. I am currently at the last step of running the setup.rb

    When I tun ruby lib/setup.rb the results is at follows:
    “””
    Initialize database schema [n]: y
    Initializing database schema
    Invalid gemspec in [/usr/local/www/jobsworth/vendor/bundle/ruby/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: “2011-08-25 00:00:00.000000000Z”
    Invalid gemspec in [/usr/local/www/jobsworth/vendor/bundle/ruby/1.8/specifications/orm_adapter-0.0.6.gemspec]: invalid date format in specification: “2012-01-10 00:00:00.000000000Z”
    Invalid gemspec in [/usr/local/www/jobsworth/vendor/bundle/ruby/1.8/specifications/jquery-rails-1.0.19.gemspec]: invalid date format in specification: “2011-11-26 00:00:00.000000000Z”
    Invalid gemspec in [/usr/local/www/jobsworth/vendor/bundle/ruby/1.8/specifications/remotipart-1.0.2.gemspec]: invalid date format in specification: “2012-02-03 00:00:00.000000000Z”
    Could not find tilt-1.3.3 in any of the sources
    Run `bundle install` to install missing gems.
    “””
    I installed titlt-1.3.3 “Your bundle is complete! It was installed into ./tilt-1.3.3
    ” ,but the same error occured. Thank for your help in advance

    • #11 by sbeex on March 2, 2012 - 04:16

      If like me you are boring about jobsworth bugs… you can use Tuleap that is a huge better tools and fully open-source also ! 😉

  6. #12 by darkpollo on June 30, 2012 - 19:24

    Hi,
    Great tutorial. Thanks.
    I think i found the problem with the setup.rb.
    When you edit the config/database.yml you must leave just this:
    production:
    adapter: mysql2
    database: database
    username: username
    password: keepitsecretkeepitsafe
    host: localhost
    encoding: utf8

    When i remove all the other info from this file, everything works on the setup.rb using the
    bundle exec lib/setup.rb

    I hope this helps somebody.

  7. #13 by Manish on November 20, 2012 - 01:07

    Thanks a lot.
    I have successfully installed jobsworth on my ubuntu (http://jobsworth.example.com) but now I have to install it like this http://192.168.1.110/jobsworth
    What steps should I follow ?
    Please reply me.

  8. #14 by sanga collins on February 26, 2013 - 13:17

    I was able to get this installed on my ubuntu server with some trial and error. Now I can login and create users, but anything to do with Tasks give me the dreaded “We’re sorry, but something went wrong”

    How can i troubleshoot this issue? tail -f /var/log/apache2/* is not giving me any useful pointers. Maybe if there is a way to turn up logging it may show more.

    Let me know what you think, or any ideas.

    Thanks

  9. #15 by sanga collins on February 26, 2013 - 15:41

    Just came back to let everyone know. that I needed to instal sendmail, and fix the permissions on the folder. i used the following command:

    chown -R $MYUSER:$WEB “${JW_PRJ_ROOT}”
    chmod -R a+rwX “${JW_PRJ_ROOT}”

    where …
    JW_SERVER=project.itm # Name of linux box
    JW_PRJ_ROOT=/var/www/jobsworth # Full path to jobsworth clone
    JW_WWWROOT=${JW_PRJ_ROOT}/public # Name of www folder (called ‘public’ by default)
    MYUSER=system # (optional) user allowed to edit/own files (default is user installing)
    WEB=www-data # Apache user

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: