my favorite

2010/02/13

RoR on Synology NAS DS209

I am so so so so happy to share this news for everyone who wanna install RoR services running on their Synology DiskStation.

Hardware Spec :
DS-209
For more details please link to HERE

Firmware/Software Spec :
Nowadays, I try installing DSM 2.3 Beta for fresh, u also could install the stable version, please click Official Synology to have a try!

Installation Scripts :

Step 0.
Make sure your NAS web service is running with built-in mysql.

top | grep httpd
top | grep mysqld

These 2 commands will show you if these services are running or not.

Step 1.
Download ipkg from here, then, install it!
Of course, my previous post describe how I do this.

Step 2.
After finish installing ipkg (it should be under /opt/bin/ by default)
please update the package list by typing
ipkg update

Step 3.
We have a lot of things to do in this step. Have a cup of coffee and enjoy it.
// installing toolchain.
ipkg install optware-devel

// ruby1.9.1 by default, rubygems-1.3.1 included
ipkg install ruby

// update to rubygems-1.3.5 for advanced features
gem update --system

// installaing related tools without documents
gem install -v=2.3.5 rails --no-ri --no-rdoc
gem install rake --no-ri --no-rdoc


Step 4.
Because
The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
So please follow this thread to install ruby-mysql gem first.
upload it, unzip it and then install it by typing :
ruby setup.rb

Step 5.
Congrads! We could have a running RoR service in this step.
Make sure your mysql is running, try to check /tmp/mysql.sock if lives. Then
rails -d mysql proj
cd proj
./script/generate scaffold person name:string age:integer profile:text
rake db:migrate


......ahhaah.. error

rake aborted!
Unknown database 'proj_development'


Take it easy, just add a database then it works well.
/usr/syno/mysql/bin/mysql
mysql > create database proj_development;

ctrl-c to quit mysql command mode

Let's try migrate database again!
// works now!!
rake db:migrate
// running RoR server in background
./script/server &

DONE

2 comments:

Berbu said...

Thank you very much for this nice blogpage

I finally got my DS110j running RoR! All went well, except for step4. It's probably all well explained in that link thread, but that link is broken...
So, here is what I did to make it work:
- I installed mysql with ipkg (installed version comes without mysql_config)
- gem install mysql --no-rdoc --no-ri -- --with-mysql-config=/opt/bin/mysql_config
=> this failed in mkmf.rb 'try_do'. So I went digging and it seems mkmf.rb relies on faulty configurations in rbconfig.rb (/opt/lib/ruby/1.9.1/arm-linux-eabi/rbconfig.rb) containing paths like /home/slug/optware/cs08q1armel/staging/opt/include.
- I corrected those paths by hand (using the 'which' command to find the correct paths). The rbconfig.rb file is normally generated by mkconfig.rb, but I couldn't find that file when installing ruby with ipkg. Problem will probably not occur when installing ruby from source code
- I then tried linking a simple file, but this gave me 'undefined reference' errors on libpthread.so
Fortunately, I wasn't the first having that problem: http://forum.buffalo.nas-central.org/viewtopic.php?f=69&t=17016
It seems to be a conflict between 2 versions of this library, So, I replaced /opt/arm-none-linux-gnueabi/lib/libpthread.so.0 by /lib/libpthread.so.0 and that fixed it
- I then retried the gem install: gem install mysql --no-rdoc --no-ri -- --with-mysql-config=/opt/bin/mysql_config and now the installation is successful
- I could also install sqlite3-ruby with these modifications

Hope this helps others as well

sebastian said...

@Huang: Thanks for the nice howto, works for my DS210j expect for the fourth step.

@Berbu: Also thanks to you, which helped me to solve the problem in step 4 :)
I did change the libthread.so and the rbconfig.rb to fit to my ds210j. Here's my rbconfig.rb

Thx a lot ;)

BIO

Taipei, GuTing, Taiwan

huang47 | personal

huang47 | personal