RubyTime is a web application for time tracking and invoicing, written in Ruby using Merb framework. It’s a complete rewrite of RubyTime 2.4 which was formerly a Ruby on Rails application.
You need to have Ruby version 1.8.7 and RubyGems 1.3.6+ installed on your server. You also need the Bundler gem (0.9+).
Get the source
Next get the source code from RubyTime git repository (‘stable’ branch is recommended):
git clone git://github.com/LunarLogicPolska/rubytime.git -b stable
Inside the rubytime directory, install gems using Bundler:
Note: on 64 bit architectures, you may have to set ARCHFLAGS=‘-arch x86_64’ in your shell environment, otherwise some compiled gems (do_mysql) may not work.
- copy config/database.yml.example to config/database.yml, then edit it to match your database configuration
- copy config/local_config.rb.example to config/local_config.rb, then set application domain and mailer “From” address
Running in development mode (on local machine)
Create a development database (named
rubytime3_dev by default). Then fill it with tables and data:
bundle exec rake db:automigrateto create database structure (note: this destroys existing structure and data)
bundle exec rake rubytime:kickstartto populate database tables with initial data (admin account, example clients and projects)
Run the application:
bundle exec merb
Point your browser to url set in config/local/config.rb and login as
admin with password
Deploying to production server
Deployment is done using the Vlad library. Make a copy of config/deploy.rb.example in config/deploy.rb, and edit the server, username and directory values according to your setup. You can add or remove environments (staging and prodution are included by default). Deploy.rb assumes you use Passenger – you’ll have to customize it if you use something else.
On the server, create a production database (named
rubytime3_prod by default). Then, back on your development machine, call Vlad to create directory structure on the server:
bundle exec rake production vlad:setup
If necessary, replace ‘production’ with ‘staging’ or whatever other environment you have configured in deploy.rb. Then, inside the “shared” directory created by Vlad in the project directory on the server, create a “config” directory, prepare copies of database.yml and local_config.rb configured for your server, and put them inside the shared/config directory.
Call Vlad again (from development machine) to deploy the code:
bundle exec rake production vlad:deploy_with_db_reset
Back on the server, populate the database with initial data (call from project’s ‘current’ directory):
MERB_ENV=production bundle exec rake rubytime:kickstart
Your server should be ready. If it’s not, try deploying once again:
bundle exec rake production vlad:deploy
For future deployments, use
bundle exec rake production vlad:deploy for normal deploys and
bundle exec rake production vlad:deploy_with_autoupgrade if you need to change database schema.