User:Thomas Wood/Rails OBSD

From OpenStreetMap Wiki
Jump to: navigation, search

Install instructions for Rails on OpenBSD

OpenBSD 4.2 has most of the dependencies required by the Rails Port precompiled.

  • Install all required packages for Ruby on Rails
This is now quite difficult, since there is a dependence on 2.0.1, which is not packaged.
  • Install required gems
I had issues with gem fetching the packages, so I wgetted them first
# wget http://gemmirror.rubyforge.org/gems/libxml-ruby-0.5.2.0.gem
# gem install --local libxml-ruby
# wget http://gemmirror.rubyforge.org/gems/mysql-2.7.gem
# gem install --local mysql
# wget http://gemmirror.rubyforge.org/gems/rmagick-1.15.9.gem
# gem install --local rmagick
  • For mysql function extensions, build with gmake rather than make, and drop (or symlink) the library into /usr/lib (couldn't get it to work in /usr/local/lib even with messing with ldconfig) (apparently this step is not required if not converting between versions of the rails port)
  • Comment out first (active) line of config/initializers/limits.rb and change to development config.
Index: config/initializers/limits.rb
===================================================================
--- config/initializers/limits.rb       (revision 6390)
+++ config/initializers/limits.rb       (working copy)
@@ -1,5 +1,5 @@
 # Limit each rails process to a 512Mb resident set size
-Process.setrlimit Process::RLIMIT_AS, 640*1024*1024, Process::RLIM_INFINITY
+#Process.setrlimit Process::RLIMIT_AS, 640*1024*1024, Process::RLIM_INFINITY

 # Force a restart after every 10000 requests
 COUNT = 0
  • Import planet into your database, osmosis or planetosm-to-db.pl seem the best options for this.
    • Osmosis requires java-6, no packages are available, so compile from ports, run this command and follow instructions:
# cd /usr/ports/jdk/1.6 && make install
  • The perl requires a few dependencies:
# pkg_add p5-libwww p5-File-Slurp p5-Bit-Vector
(the script may fail for large planets on low-resource systems)