Install Ruby on Rails and Redmine on DS210+
I mentioned it in my manual for (trying) installing Redmine on a DS106j, the 32MB are to few.
As we got a new DS210+ with 512MB RAM and a 1 GHz CPU there was a new chance to get Redmine up and running - and it works!
Inhaltsverzeichnis |
pre-requirements
- user redmine (if you like to run the service without root privileges)
- ssh aktivated
- ipkg installed
- (HTTP Service and) MySQL Server running (use the Synology DiskStation Manager to start)
- phpMyAdmin for easier access to MySQL
install Ruby on Rails
As you have ipkg up and running, you can simply use the following command to install ruby:
ipkg install rubygems
Additionally (maybe it is not necessary) install zlib:
ipkg install zlib
Now install Rails in Version 2.3.5 to be fit most Redmine pre-requirements (this step will take ca. 30 Minutes even on the shiny new DS210+ so imagine that on the DS106j):
gem install rails -v 2.3.5
install Redmine
Use phpMyAdmin to create a database redmine and optionally a MySQL-user redmine with the rights to access it.
install ruby-mysql
wget http://github.com/downloads/tmtm/ruby-mysql/ruby-mysql-2.9.3-beta.tar.gz tar -xzvf ruby-mysql-2.9.3-beta.tar.gz cd ruby-mysql-2.9.2-beta ruby setup.rb
create a folder in /volume1 for the redmine service:
cd /volume1 mkdir rubyapps cd rubyapps
download redmin (We have used the 0.9.5 because we had some strange errors with the newest 1.0.1 redmine):
wget http://rubyforge.org/frs/download.php/71421/redmine-0.9.5.tar.gz
extract it:
tar -xzvf redmine-0.9.5.tar.gz
create a symbolic link to the folder (for easier access later):
ln -s redmine-0.9.5 redmine
change the rights of the folder to the user redmine:
chown redmine:1000 redmine-0.9.5 -R
configure Redmine
login as user redmine:
su redmine
change to folder config in redmine and create database.yml
cd /volume1/rubyapps/redmine/config cp database.yml.example database.yml
edit the database.yml
nano database.yml
change:
production: adapter: mysql database: redmine <= created in MySQL host: localhost username: redmine <= created in MySQL password: my_password <= set for the user redmine n MySQL
in folder config run following command:
RAILS_ENV=production rake initializers/session_store.rb
Job done!
start Redmine Service
change to root folder of redmine installation:
cd /volume1/rubyapps/redmine
And start the service:
ruby script/server webrick -e production
You can now use your browser and surf to:
http://synolgyIP:3000
start stop script for automatically start service on boot
create the file S97redmine.sh in /usr/syno/etc.defaults/rc.d/ and make it runnable.
Following content (correct the paths!):
#!/bin/sh case "$1" in start) /opt/bin/ruby /volume1/rubyapps/redmine/script/server webrick -d -e production ;; stop) killall ruby ;; restart) $0 stop sleep 1 $0 start ;; *) echo “usage: $0 { start | stop | restart}” >&2 exit 1 ;; esac
Make it runnable:
chmod 755 S97redmine.sh
And here is the annoying point:
as you have created the system user redmine and changed the folder rights to this user, you may wish to start the deamon as this user, to avoid root to be the files owner. I first thought of using su, so changing the line /opt/bin/ruby to:
/bin/su redmine -c "/opt/bin/ruby /volume1/rubyapps/redmine/script/server webrick -d -e production"
This doesn't work. So I tried to use sudo - installed it with ipkg install sudo and changed the line to:
/opt/bin/sudo -u redmine /opt/bin/ruby /volume1/rubyapps/redmine/script/server webrick -d -e production
This also doesn't work.
My assumption is that the -d to start it as a deamon, prevents the service to be run as a different user than root.
So i tried to run it without the -d and fork it away with the &
/opt/bin/sudo -u redmine /opt/bin/ruby /volume1/rubyapps/redmine/script/server webrick -e production &
Also doesn't work.
If somebody knows the solution, please provide me the information:
joachim.schuster [at] web.de
or via contact form:
http://www.joachimschuster.de/contact/