Getting Catarse to Build and Run

I’m working on a crowd-funding website for a client out in Colorado, and we’re basing our work on Catarse, an open source Ruby on Rails crowd-funding website.  Getting a build of Catarse to actually run has not been easy, so I’m documenting the steps I’ve taken so far – there are still a couple kinks to work out, but it does come up.

Because I’m working on a Windows platform, I run Ubuntu in a VM, which does offer me the luxury of starting from a completely clean install – I was not able to get Catarse running with my other Ubuntu VM’s which already have other Ruby on Rails projects loaded in them, nor have I gotten Catarse to run natively in Windows, which is something I would very much like to succeed in doing.

Therefore, I started with a clean Unbuntu VM (see here).

Pre-Configuration

“dev” Components

sudo apt-get install git-core
sudo apt-get install curl
sudo apt-get install zlib1g-dev
sudo apt-get install libyaml-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install nodejs
sudo apt-get install build-essential
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libmagickwand-dev
sudo apt-get install postgresql
sudo apt-get install libpq-dev

RVM

curl -L get.rvm.io | bash -s stable
source /home/ubuntu/.rvm/scripts/rvm

Download Catarse

git clone https://github.com/catarse/catarse
cd catarse

Configure database.yml

cd config
cp database.sample.yml database.yml
[edit the username and password]
cd ..

Download Ruby & Rails

rvm install ruby-1.9.3-p448
gem install rails -v 3.2.12

Bundle

bundle install

Install PostgreSql

sudo apt-get install pgadmin3

Create Database

sudo -u postgres psql
\password
[enter password twice]
\q

pgadmin3 -> connect -> create the database catarse_development and catarse_test

Install PostgreSql-Contrib

from: https://groups.google.com/forum/#!msg/catarse-dev/V_kly5WT4i0/kzxqwpTdgAMJ
sudo apt-get install postgresql-contrib

(the database should restart automatically,
otherwise: sudo /etc/init.d/postgresql-8.4 restart)

Catarse DB Initialization and Additional Configuration

Migration and Seeding

rake db:migrate
rake db:seed

Change the Locale

In initializers\locale.rb, change:

I18n.default_locale = :pt

to:

I18n.default_locale = :en

Other Useful Things

I use RubyMine as my development IDE, which requires a JDK.

JDK RubyMine

sudo apt-get-install openjdk-7-jre

or download from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

and follow instructions here:
http://stackoverflow.com/questions/9862143/error-cannot-start-rubymine-no-jdk-found-jdk-version-desktop-link

Catarse Issues

Route error

https://github.com/catarse/catarse/issues/179

This is in app/views/devise/sessions/new.html.slim:

.login_with_social
.content_form
h1=t(‘.with_facebook’)
-> h3=t(‘.with_facebook_subtitle’)
-> = link_to t(‘layouts.login.login_with_facebook’), user_omniauth_authorize_path(provider: ‘facebook’, locale: nil), :class => ‘facebook_start’
h1=t(‘.google_warning_html’)
h3=t(‘.google_step_1’, link: (link_to t(‘devise.links.forgot_password’), new_password_path(resource_name))).html_safe
h3=t(‘.google_step_2’)
.clearfix

FIX:

Removed the indicated lines.

Strange tags at the top of the page:

https://github.com/catarse/catarse/issues/182

Getting some strange tags at the top of each page:

Description” name=”description” />Keywords” name=”keywords” />

I removed these lines (23 & 24) from app/views/layouts/application.html.slim:

meta name=”description” content=t(‘site.description’)
meta name=”keywords” content=t(‘site.keywords’)

uservoice_sso issue:

https://github.com/catarse/catarse/issues/183

undefined method `+’ for nil:NilClass

NoMethodError – undefined method `+’ for nil:NilClass:
ezcrypto (0.7.2) lib/ezcrypto.rb:550:in `get_key’
ezcrypto (0.7.2) lib/ezcrypto.rb:84:in `with_password’
lib/uservoice_sso.rb:13:in `generate’
app/controllers/application_controller.rb:45:in `display_uservoice_sso’

FIX (to be done):

Create a uservoice account, and see this example:

https://github.com/uservoice/uservoice-sso/blob/master/ruby.rb

and read more here:

https://www.uservoice.com/

Alternatively, do as “ianfleeton” suggested (see issue ticket):

Configuration.create(name: 'uservoice_subdomain', value: 'xyzzyexample')
Configuration.create(name: 'uservoice_sso_key', value: 'xyzzyexample')

nil in User.has_facebook_authentication?

FIX:

Add check for oauth == nil:

def has_facebook_authentication?
oauth = OauthProvider.find_by_name ‘facebook’
return false if oauth.nil? # <— added this line
authorizations.where(oauth_provider_id: oauth.id).present?
end

Alternatively, get the facebook dev ID stuff set up?

ActionController::RoutingError – No route matches {:controller=>”omniauth_callbacks”, :action=>”passthru”, :provider=>”facebook”}:

In app/views/users/_current_user_fields.html.slim line 23:

= link_to t(‘layouts.login.login_with_facebook’), user_omniauth_authorize_path(provider: ‘facebook’, locale: nil), class: ‘facebook_start’
#

FIX (sort of):

Changed above (see “nil in User.has_facebook_authentication?) to return true!!!!

Finally, Launching the Server

at the terminal:

/bin/bash –login (I have to do this, you may not need to)
rails s

The website should now come up!

— Marc

Advertisements

8 thoughts on “Getting Catarse to Build and Run

  1. This guide is extremely helpful. Could you make more guides along the way? I’m sure there are many people it would benefit from guides like this explaining the basics of how to customize the Catarse platform. Please consider it! Thanks!

    1. Thanks! At the moment I’m deep in the process of replacing things like the header, changing page content, and getting my head wrapped around Compass and grid-whatever, as the whole grid thing is a mystery to me — especially when I comment out the sass .grid lines and there’s no visible change!!!

  2. Hi Marc,

    Fantastic tutorial, many thanks! I was wondering about the step above “pgadmin3 -> connect -> create the database catarse_development and catarse_test “. What is the precise syntax for actually creating those databases?

    Kind Regards,
    Andrew.

    1. I’m using pgadmin3, the UI for Postgres, so after connecting to my Postgres server (the power plug icon on the toolbar), I right-clicked on the “Databases” tree node and selected “New database…” fro the popup menu.

  3. Hi Marc

    Thanks for the advice & info! I’ve been reading your blogs, and I finally have Catarse up & running on ubuntu 12. Sorry to be a bother, but do you know if the admin function is meant to be working currently? I used the latest stable build, but when I go to /en/admin, I get some sort of routing error (“RecordNotFound in ProjectsController”). I’ve seen some blog & news posts indicating there may be problems with the admin function.

    I’ve created a base user, and registered them as admin in rails console, so I think I’ve done the prerequisite stuff. If by any chance it’s something you’re aware of I’d be very grateful.

    All the best,
    Andrew.

    1. Hi Andrew,

      Thanks for your post on my blog.

      I find that the following pages work:

      en/adm/backers
      en/adm/financials
      en/adm/projects
      en/adm/statistics

      However, en/adm/users does not work, giving me an “undefined method ‘provider’ ” error.

      (Note that all the URLS’s are “adm”, not “admin”)

      Provider seems to be a field that’s supposed to be in the users table, however migration 20130225141802_alter_user_drop_provider_uid_constrants seems to drop this field:

      ALTER TABLE users ALTER provider DROP NOT NULL;

      So, for the moment, I’ve simply commented out the references to the provider column in users\index.html.slim here:

      /th= t(‘.provider’)

      and here:

      /td= user.provider

      Hope that helps, and thanks for getting me to look through the admin pages again, it would have been a while before I saw that problem.

  4. HI Marc, great blog, this is invaluable.

    How long did it take you to get Catarse up and running to an acceptable level? I’ve been asked to quote for a job using the platform and I’m unsure whether 2 weeks is enough. Am I hideously naive?

    1. For the latest codebase, it’s quite fast. Except a weird subdomain config I think Catarse people need to put into the documentation. It takes me three hours to figure out.

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