Digital Notepad

Internet, Mobility and Serious Geekery

Mac OS X - ideal development platform - VMware, Ruby on Rails & Ubuntu

December28

Mac as the ideal development platform? Maybe for the iPhone I hear you mumble. Until I found this nice, clean and extremely flexible solution I wholeheartedly agreed. The basic scheme goes like this:

As foundation I am now running a clean, basically stock OS X. On top of this I am running a bunch of VMware Fusion Virtual machines, ranging from OS X, Ubuntu down to Windows XP ;-). Basically I am running all the development environment in Ubuntu and doing all the research and editing on OS X natively.

To achieve this I have a Ubuntu Server 8.10 with PostgreSQL, Apache 2 prefork, Ruby Enterprise Edition and Rails 2.2.2 installed. This Linux VM shares my Mac OS X Project folder via VMware HGFS mount directly in /var/www/projectname. This setup enables me to work with Textmate and save/copy/mess around locally on my Mac OS X host system (10.5.6) and immediately have the changes reflected in the Ubuntu machine. So the basic workflow is the same than before with having RoR etc. installed locally on my OS X. Hope I made myself clear!?

Here is how to get there (you may have to adjust the version numbers and replace cabchap&tom with the required domain/user):

  1. Install Ubuntu Intrepid Ibex Server CD, using F4 - minimal system, then press “Install” and later select “Basic Ubuntu Server”, “SSH Server” and “PostgreSQL Server”.
  2. sudo apt-get update -o Acquire::http::No-Cache=True
  3. sudo apt-get dist-upgrade
  4. sudo apt-get install build-essential zlib1g-dev libssl-dev libpq-dev apache2-mpm-prefork apache2-prefork-dev libreadline5-dev git-core
  5. wget http://rubyforge.org/frs/download.php/48623/ruby-enterprise-1.8.6-20081215.tar.gz
  6. tar xvfz ruby-enterprise-1.8.6-20081215.tar.gz
  7. cd ruby-enterprise-1.8.6-20081215/
  8. sudo ./installer
  9. sudo ln -s /opt/ruby-enterprise-1.8.6-20081215/ /opt/ruby-enterprise
  10. sudo ln -s /opt/ruby-enterprise/bin/gem /usr/bin/gem
  11. sudo ln -s /opt/ruby-enterprise/bin/ruby /usr/bin/ruby
  12. sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/rake
  13. sudo ln -s /opt/ruby-enterprise/bin/irb /usr/bin/irb
  14. sudo ln -s /opt/ruby-enterprise/bin/rails /usr/bin/rails
  15. sudo /opt/ruby-enterprise-1.8.6-20081215/bin/passenger-install-apache2-module
  16. sudo vi /etc/apache2/httpd.conf [and enter the following:]
    # General stuff
    ServerSignature Off
    LogLevel warn
     
    # Set Rails mode
    RailsEnv development
     
    # Lock down GIT files
    <Files ~ “^\.git”>
        Order allow,deny
        Deny from all
    </Files>
     
    # Prepare for Rails
    LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    PassengerRoot /opt/ruby-enterprise-1.8.6-20081215/lib/ruby/gems/1.8/gems/passenger-2.0.6
    PassengerRuby /opt/ruby-enterprise-1.8.6-20081215/bin/ruby
  17. cd /etc/apache2/sites-available/
  18. cp default default.orig
  19. sudo vi /etc/apache2/sites-available/default [fill only with:]
    <VirtualHost *>
      ServerName dev.cabchap.com
      ServerAdmin devmaster@cabchap.com
      DocumentRoot /var/www/cabchap/public
      ErrorLog /var/log/apache2/error.log
      CustomLog /var/log/apache2/access.log combined
    </VirtualHost>
  20. cd /var/www
  21. sudo mkdir cabchap
  22. sudo chown tom cabchap
  23. rails -d postgresql cabchap
  24. sudo -u postgres createuser cabchap [answer yes to superuser]
  25. sudo vi /etc/postgresql/8.3/main/pg_hba.conf
     host all all 192.168.0.0/16 md5
    Replace:
    local all all ident sameuser
    with this line:
    local all all md5
  26. sudo vi /etc/postgresql/8.3/main/postgresql.conf
    listen_addresses=’*’
  27. sudo /etc/init.d/postgresql-8.3 restart
  28. sudo /etc/init.d/apache2 restart
  29. Finally configure the VMware shared folder in VMware settings for the relevant machine:
  30. Name: cabchap (this name is mounted in fstab)
  31. Folder: dev (in Projects/Something/dev)
  32. In etc/fstab enter
     .host:/ /mnt/hgfs vmhgfs defaults,user,ttl=5,uid=tom,gid=tom 0 0

Let me know if this interesting for someone out there. If it is, I will invest more time in clarifying these quick draft notes. May this be helpful.

posted under Tech | No Comments »

Updating Automattic’s Akismet using SVN

November27

It is soooo easy, but I still keep forgetting it:

Just cd down to wp-content/plugins/akismet and execute ‘svn up‘. Voilà, that’s it. Maybe you have to enter the plugin area of the WP-dashboard to make WP realize, but once there - it recognizes that you updated.

posted under Tech | No Comments »

Fast Ship (EMEA) - Next Order from Apple

November7

Next MacBook ordered, different experience alltogether. Just ordered a few minutes ago and got “Fast Ship (EMEA) / Schnellversand (EMEA)” as shipping method. It seems that by selecting a single BTO/CTO Mac it is possible to skip the centralized european logistics hub in Tilburg/NL and go directly with UPS from factory door to my desktop.

I am wondering if this shipment method is more trackable than “Merge In Tnst NL Til“; at least it is a lot faster, with comparable orders I used to wait 12 days just for delivery, not including manufacturing. This is down to seven days max with “Fast ship (EMEA)”.

It pays to order the machine without any other stuff that needs to be merged in transit. Get it at your local dealer. Order global, buy local ;-)

Check out Adrian Spender’s experiences on this as well.

Update 11/10: Future looks bright :-) Just minutes ago, my next laptop has been shipped, directly with UPS, tracking and everything. And you won’t believe it, it is supposed to arrive in two days! Nice.

Update 11/12: After just three days in production (Friday, Saturday and Sunday - Apple calls them ‘workdays’ - go figure) and measly three more days for transport - the MacBook is here! For your reference this is the full UPS schedule of the package. Take care, though, the data on UPS’s site is updated with a lot of delay, sometimes more than 10h!

Package Progress
Location Date Local Time Description
UMKIRCH,
DE
11/12/2008 7:44 A.M. IN-TRANSIT SCAN
  11/12/2008 4:41 A.M. DESTINATION SCAN
  11/12/2008 4:40 A.M. ARRIVAL SCAN
KOELN (COLOGNE),
DE
11/12/2008 1:12 A.M. DEPARTURE SCAN
KOELN (COLOGNE),
DE
11/11/2008 11:58 P.M. IMPORT SCAN
  11/11/2008 11:50 P.M. IMPORT SCAN
WARSAW,
PL
11/11/2008 6:25 P.M. ARRIVAL SCAN
KOELN (COLOGNE),
DE
11/11/2008 11:40 A.M. PACKAGE DATA PROCESSED BY BROKERAGE. WAITING FOR CLEARANCE / RELEASED BY CLEARING AGENCY. NOW IN-TRANSIT FOR DELIVERY
INCHEON,
KR
11/11/2008 10:31 A.M. DEPARTURE SCAN
  11/11/2008 7:56 A.M. ARRIVAL SCAN
SHANGHAI,
CN
11/11/2008 4:38 A.M. DEPARTURE SCAN
KOELN (COLOGNE),
DE
11/10/2008 7:26 P.M. PACKAGE DATA PROCESSED BY BROKERAGE. WAITING FOR CLEARANCE
SHANGHAI,
CN
11/11/2008 2:17 A.M. EXPORT SCAN
  11/11/2008 1:50 A.M. THIS SHIPMENT IS WAREHOUSED UNTIL IT IS RELEASED BY CLEARING AGENCY / RELEASED BY CLEARING AGENCY. NOW IN-TRANSIT FOR DELIVERY
  11/11/2008 1:47 A.M. THIS SHIPMENT IS WAREHOUSED UNTIL IT IS RELEASED BY CLEARING AGENCY
SHANGHAI,
CN
11/10/2008 4:10 P.M. ORIGIN SCAN
CN 11/10/2008 3:18 A.M. BILLING INFORMATION RECEIVED
posted under Tech | 1 Comment »

Ruby on Rails update on Mac OS X Leopard (10.5.5)

November7

Apple meant well when they pre-installed Ruby on Rails and a few gems. But since they didn’t keep up to-date with the fast pace of development at least Rails and a few gems are heavily outdated.

You basically have two options to proceed if you want to get a reasonable modern RoR installation on your Macintosh:

You go the long and hard way: Install XCode and all the developer tools Apple supplies (2+ GB), and follow this excellent tutorial in building everything from scratch and leaving the RoR installation Apple supplied in pristine state.

Take the ’small-footprint-approach’ and tackle possible problems later (IF Apple to decides to update the system as well and IF this causes trouble). This is the route I chose and here is how it goes without any problems or errors:

  • sudo gem update –system
  • sudo gem update rails –include-dependencies

Basically what happens is, the first command updates the Ruby gem system and gems; the second command updates the Rails installation to, currently, 2.1.2. Something you are not getting is an updated SQLITE gem, because the native extensions can’t be built. But if you are working with a remote MySQL server this is no problem.

Also check out these slightly outdated instructions from Apple on this topic: Developing Rails Applications on Mac OS X Leopard.

posted under Tech | No Comments »

GeoKit on Rails 2.1.2 Works Nicely - Test the Installation

October31

GeoKit is a powerful geolocation framework for Ruby on Rails. It works nicely with Rails 2.1.2. Beware, SQLite doesn’t suffice, you need to switch to e.g. MySQL. The following commands in script/console helped quickly validate the install of the plugin:

include GeoKit::Geocoders

=> Object

start = MultiGeocoder.geocode(”Wippertstr. 2, Freiburg, Germany”)

=> #<GeoKit::GeoLoc:0×1fcfc64 @zip=”79115″, @state=”Baden-Württemberg”, @success=true, @provider=”google”, @lng=7.829245, @precision=”address”, @city=”Freiburg”, @country_code=”DE”, @lat=47.97692, @street_address=”Wippertstraße 2″, @full_address=”Wippertstraße 2, 79115 Freiburg, Germany”>

endpoint = MultiGeocoder.geocode(”Tokyo”)

=> #<GeoKit::GeoLoc:0×2049cf8 @zip=nil, @state=”Tokyo”, @success=true, @provider=”google”, @lng=139.682282, @precision=”state”, @city=nil, @country_code=”JP”, @lat=35.678451, @street_address=nil, @full_address=”Tokyo, Japan”>

home.distance_to(endpoint, :units => :miles)

=> 5945.92866816475

posted under Tech | No Comments »
« Older Entries