Thursday, May 19, 2011

Installing a Netzke demo app on Ubuntu

Installed a Netzke demo successfully but with some hiccups.

1. Resouces.
Demo souce codes: https://github.com/skozlov/netzke-demo
Netzke Home page: http://blog.writelesscode.com/

2. Install demo code and netzke gems: netzke-core, netzke-basepak, and netzke-persistence.
$ git clone git://github.com/skozlov/netzke-demo.git && cd netzke-deom
$ git clone git://github.com/skozlov/netzke-core.git vendor/gems/netzke-core 
$ git clone git://github.com/skozlov/netzke-basepack.git vendor/gems/netzke-basepack 
$ git clone git://github.com/skozlov/netzke-persistence.git vendor/gems/netzke-persistence 

3. Insall required gems. It failed to install mysql2
$ bundle
....
Installing mysql2 (0.2.6) with native extensions /home/socrateos/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
....

3.1. Install missing mlysql.
$ sudo apt-get install libmysql-ruby libmysqlclient-dev

3.2 Rerun bundle. I aborted when it was installing perftools.rb; it seemed hung.
$ bundle
...
Installing perftools.rb (0.5.6) with native extensions  # it hangs here
^C

3.3 Then I tried to install perftools.rb separately. It turned out that it just takes a very long time to install. You just have to wait for several minutes!
$ gem install perftools.rb
Building native extensions.  This could take a while...    # go and get a coffee!
Successfully installed perftools.rb-0.5.6
1 gem installed
Installing ri documentation for perftools.rb-0.5.6...
Installing RDoc documentation for perftools.rb-0.5.6...

4. Created links to extjs and sencha-touch folders in public directory.
$ ln -s ~/work/extjs/ext-3.3.1/ public/extjs
$ ln -s ~/work/extjs/sencha-touch-1.1.0/ public/sencha-touch

5. Create database and migrate. But I got an error.
$ rake db:create && rake db:migrate
...
Could not find rack-perftools_profiler-0.4.0 in any of the sources
Try running `bundle install`.

5.1. Run bundle again to install remaining required gems.
$ bundle install
...
Using perftools.rb (0.5.6) 
Installing rack-perftools_profiler (0.4.0) 
Using thor (0.14.6) 
Installing railties (3.0.4) 
Installing rails (3.0.4) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Thank you!

5.2. Try again to create database and migrate. Still I got an error.
$ rake db:create && rake db:migrate
...
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
...
rake aborted!

5.3 Modified my config\database.yml file, giving the following info for all 3 databases.
password: secrete                                     # was empty
  socket: /var/run/mysqld/mysqld.sock # replaced /tmp/mysql.sock

5.4 Try one more time to create the database and migrate.
$ rake db:create && rake db:migrate
(in /home/socrateos/work/ruby/rails/netzke-demo)
(in /home/socrateos/work/ruby/rails/netzke-demo)
==  CreateBosses: migrating ===================================================
-- create_table(:bosses)
   -> 0.1495s
==  CreateBosses: migrated (0.1496s) ==========================================

==  CreateClerks: migrating ===================================================
-- create_table(:clerks)
   -> 0.1622s
==  CreateClerks: migrated (0.1623s) ==========================================

==  AddSessionsTable: migrating ===============================================
-- create_table(:sessions)
   -> 0.1624s
-- add_index(:sessions, :session_id)
   -> 0.3012s
-- add_index(:sessions, :updated_at)
   -> 0.2921s
==  AddSessionsTable: migrated (0.7561s) ======================================

==  CreateNetzkeComponentStates: migrating ====================================
-- create_table(:netzke_component_states)
   -> 0.1633s
-- add_index(:netzke_component_states, :component)
   -> 0.2925s
-- add_index(:netzke_component_states, :user_id)
   -> 0.3761s
-- add_index(:netzke_component_states, :role_id)
   -> 0.3185s
==  CreateNetzkeComponentStates: migrated (1.1508s) ===========================

==  AddImageToClerks: migrating ===============================================
-- add_column(:clerks, :image, :string)
   -> 0.3050s
==  AddImageToClerks: migrated (0.3051s) ======================================
It worked.

6. Now launch the server.
$ rails s
=> Booting WEBrick
=> Rails 3.0.4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-05-18 06:05:59] INFO  WEBrick 1.3.1
[2011-05-18 06:05:59] INFO  ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-05-18 06:05:59] INFO  WEBrick::HTTPServer#start: pid=3105 port=3000

7. Now go to http://localhost:3000 and see the result.

No comments:

Post a Comment