

|
Valid XHTML v1.0
Author Profile
Top Authors
Log In to set widget preferences
| Author | # |
|---|---|
|
185 |
|
148 |
Anonymous User
|
49 |
|
28 |
Kimberly Hieber
|
27 |
|
23 |
Note: some conversations may be proxied or secured, thereby causing # differences
Subscribe
Partners
Recent
Tags
Log In to set widget preferences
Recent
Log In to set widget preferences
Most Active
Log In to set widget preferences
Popular
Log In to set widget preferences
Below are the steps necessary to get app_sample running (the newest version of the hub). The statements shown here have been tested on either Mac OSX or Windows. If you find anything that diverges from the instructions listed, please add your changes so this stays up to date for everybody else.
Setting Up A Development Environment
If you're on Windows...
All the steps below, under "To do it by hand...", have been automated with a single Windows install .exe file.
Get the file from here: http://kalivo.com/appsteam/files/
Pick the version of the file that goes with the hub release you want to work on (typically, the latest file is right since you'll want the head of the codebase trunk).
After you run this file, you should be in the same place you would have been if you followed the manual steps below.
To do it by hand...
Download the following packages:
subversion (latest stable) : http://subversion.tigris.org/
ruby (1.8.6) : http://www.ruby-lang.org/en/downloads/
NOTE: On the Windows installer, you CAN check "Enable RubyGems". This simply sets the RUBYOPT env variable for you so that Rubygems is always active when Ruby runs.
mysql (5.0 stable) : http://dev.mysql.com/downloads/
Note that, for now, the root passwd for the database needs to be "password12". Ideally this is fixed in the future such that database.yml isn't under version control.
rubygems (latest stable) : http://rubygems.org/read/chapter/3
If you are in OS X:
Take a look at http://hivelogic.com/articles/2005/12/ruby_rails_lighttpd_mysql_tiger
You will need to update it to the version we are using.
When installing readline 5.2, you will need to patch it. Look here:
http://secretdiaryofhan.wordpress.com/2007/12/26/building-readline-52-on-os-x-leopard/
Next, install the necessary ruby gems.
You'll need to use sudo if you're on *nix.
This script, ngen-gems-setup.sh, details things for you. If you have bash, then you can simply run it (it has been tested on Windows+Cygwin and Linux). Otherwise, run the "gem install" commands yourself, with versions, as shown in the script.
The versions shown for each gem are from production systems. You MAY not want the latest possible version of every gem, so you should NOT run "gem update" unless you know what you are doing.
SOME gems may prompt you to choose a particular platform type. Simply choose "mswin32" if you're on Windows, or whatever is proper for your system.
When running the script (or the "gem install" commands in it):
If you're on Linux, you'll probably need packages "ruby-devel" and "mysql-devel" also installed.
If you have trouble with the MySQL gem, check:
http://wiki.rubyonrails.org/rails/pages/Mysql+Connection+Problems
On Linux or OS X, you might need to modify the MySQL install line in the script, which looks like:
"gemInst 2.7 mysql -- ..."
And change the paths if your MySQL install uses different ones.
On OS X, you might have to do ONE of these:
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
-OR-
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
Next install Imagemagick for avatar processing. You need to install Imagemagick before installing the appropriate gem:
Windows:
Go here: http://rubyforge.org/frs/?group_id=12&release_id=20692
Download the RMagick-2.5.0-ImageMagick-6.4.1-5-Q8.zip file. It contains both Imagemagick and Rmagick.
First, run the Imagemagick install .exe.
Note: Make sure to check the "Add to system path" option. The RMagick gem will NOT work (probably won't even load) if the PATH variable isn't right.
Then install the gem with this command:
gem install rmagick-2.5.0-x86-mswin32.gem --local
Note: If the gem fails to install with a 'buffer' error, try a different version of the RMagick-*.zip file.
OS X:
Install darwinports from: http://www.macports.org/install.php
port install tiff -macosx imagemagick +q8 +gs +wmf (again, no space between the - and "macosx")
gem install rmagick
Linux:
This should work, especially on Red Hat distros: sudo yum install ruby-RMagick
If not, use your favorite package manager or head to:
http://www.imagemagick.org/script/binary-releases.php
And run: sudo gem install rmagick
Next install memcached
For Windows:
Download from: http://jehiah.cz/projects/memcached-win32/
Read the instructions on this web page to install it as a Windows service.
For Red Hat-ish Linux: sudo yum install memcached; sudo service start memcached
For other *nix, download the memcached server and run it on your box as a daemon. I do now know how to set this up on a mac:
You'll want it to run on ip 127.0.0.1 and port 11211 (should be the installer defaults anyway)
After getting all your package installations in order, you can grab all the projects from svn:
svn co svn://72.249.82.8/kalivo/trunk/ kalivo
svn co svn://72.249.82.8/service_user/trunk/ service_user
svn co svn://72.249.82.8/service_storage/trunk/ service_storage
svn co svn://72.249.82.8/service_provision/trunk/ service_provision
svn co svn://72.249.82.8/app_sample/trunk/ app_sample
svn co svn://72.249.82.8/service_pubsub/trunk/ service_pubsub
Now create your databases.
For a mac, you can use CocoaMySql (http://cocoamysql.sourceforge.net/).
For windows, you can use the MySQL GUI tools (http://dev.mysql.com/downloads/)
The db (schema) names to create are:
service_provision
service_provision_test
service_user
service_user_test
app_sample
app_sample_test
service_pubsub
service_pubsub_test
Now do some initialization and startup:
The commands to run: ("#{source_root}" is your work dir, where you checked out all the svn projects)
cd #{source_root}/service_provision
rake db:migrate
mongrel_rails start -p 3000 (in background or separate cmd prompt on Windows)
cd #{source_root}/service_user
rake db:migrate
mongrel_rails start -p 3001 (in background or separate cmd prompt on Windows)
cd #{source_root}/service_pubsub
rake db:migrate
mongrel_rails start -p 3004 (in background or separate cmd prompt on Windows)
Notes:
The "mongrel_rails start ..." for the provision service MUST be running FIRST before any other migrations.
The pubsub migrate may not work. You can probably safely ignore it for now, and worry about fixing it up later.
Some conveniences to manage your platform service processes...
If you're on *nix:
You can run this Ruby script (thanks @elarson):
#!/usr/bin/env ruby
commands = [
"cd service_provision && mongrel_rails start -p 3003",
"cd service_user && mongrel_rails start -p 3001",
"cd service_pubsub && mongrel_rails start -p 3004" ]
threads = [?]
for command in commands
threads << Thread.new(command) { |service_command|
system(service_command)
}
end
threads.each { |t| t.join }
OR, use the ngen-svc script.
Notes:
The pubsub service may not start. You can probably safely ignore it for now, and worry about fixing it up later.
Instead of "mongrel_rails start", in each case you can use Webrick by substituting:
ruby script/server -p #{port}
(the "-p nnnn" part stays the same)
If you get an error that looks something like:
#<NameError: uninitialized constant BSGPlatformService::ServiceXML::Zlib>
Put in the top of the file causing the problem this line:
require 'zlib'
If you're on Windows, your ruby doesn't have threading. Blame @matz for that. In this case, you have a few other options:
Start the services independently. In this case, run the commands in lines 3-5 of the sample Ruby script above.
NOTE: The provision service MUST always be first, and MUST be fully running, before any others are started.
OR, create a Windows batch file that does it, and include it here (please!)
OR, if you have Cygwin, there's a bash script called "ngen-svc" that starts up services, and can bounce them, or kill them. [If you don't have Cygwin, I highly recommend it, especially for any command line stuff. -DH]
OR, use the Windows installer .exe mentioned at the top, which creates Windows services for you.
Next you need to install CCTray (Windows) or CCMenu (OSX) or JCCMenu (any OS).
Download and install it:
Windows: http://sourceforge.net/project/showfiles.php?group_id=71179&package_id=83198
Linux-Gnome/OS X/Windows: http://jcctray.sourceforge.net/
You only need CCTray or CCMenu, not all of CruiseControl.
Configure it:
CCTray:
Go to "Build Projects" tab, and add a "build server" with a "custom HTTP URL" like this:
http://ci.ngenplatform.com:3333/XmlStatusReport.aspx
JCCTray:
Server type is "CruiseControl.rb" and URL is "http://ci.ngenplatform:3333/".
CCMenu: Check with Terry.
Basic projects are:
ContentService, Kalivo, KalivoSmoke, PubSubService, ServiceProvision, StorageService, UserService
After each service is running, you can finally start the hub application.
Run these commands:
cd #{source_root}/app_sample
rake db:migrate
mongrel_rails start
Notes
You MUST have mongrel installed for app_sample to work. Webrick won't let you log in.
The "rake db:migrate" isn't needed every time. It's just for when the database needs to be initialized or updated.
As of this writing, the app_sample codebase is broken. The db:migrate or mongrel_rails may not work. Get help from a teammate if this is the case, or, skip down to the "Setting Up A Production Hub" section.
Point your browser to http://localhost:3000/, and be amazed. :)
----
Setting Up A Production Hub
This part assumes you can already run the platform services as listed above in step #2.8.
You must also have checked out the kalivo project from svn, as above in step #2.6.
Now set up the hub, kalivo, with the nGenera theme.
Go into your kalivo source dir.
Apply the nGenera theme:
rake kalivo:config:set THEME=ngenera
rake theme_update_cache theme=ngenera
Next get the latest versions of the production database backup files.
First, ssh to a proper box, one of these:
72.249.21.180
OR 72.249.37.200
OR 72.249.39.81
If you're on Windows, and you use the regular Putty (which stores its profiles in the registry), then you can get the file attached to this page called:
putty-profiles-ngenera.zip
Unzip it, right-click the .reg file, and select "Merge". The next time you start Putty it will show all the nGenera server profiles.
See Marc S or Mike R if you don't have the ssh login.
Run these commands:
cd /var/www/apps/database_backups
ls -l
Make a note of the latest version of each of these file patterns:
app_sample_*
ngenera_*
service_provision_*
service_pubsub_*
service_user_*
Use scp to copy each of the 5 files above to your box.
Import the files.
If the filename ends in .sql, run:
mysql -uroot -ppassword12 < #{file_name}
If the filename ends in .gz, run:
gunzip < #{file_name} | mysql -uroot -ppassword12
Prepare the database files for your local environment.
For the steps listed below, do the service_provision database FIRST.
Make sure the provision service is already started before doing other tables. Other platform services are not needed for this part.
The basic pattern for each database file is:
Cd to the root of the project that depends on the given database. E.g. the "ngenera" database is for the "kalivo" project with the "ngenera" config subdir.
Run: rake db:migrate
If the database is "ngenera" or any hub image, also run: rake kalivo:neuter clr=y
Note: This step may fail the 1st time. If so, run it again, and it should work the 2nd time.
If the database is "service_provision", also run: rake kalivo:neuter
Repeat 1-4 for each database file you imported.
Double-check the data before starting services.
Start the MySQL query browser.
Check the hub (e.g. "ngenera") database as follows.
Make sure the "services" table is either (a) empty, or (b) contains references to "localhost" and not any production URLs. If this is not true, then:
Run the query: truncate services
From the "service_provision" dir, again run: rake kalivo:neuter
Make sure the "users" table has most of its emails prefixed with an "x". Some emails, like the ngenera.com and kalivo.com ones, should be untouched. If this is not true, there is a manual way to fix it, as follows:
Start the kalivo application. See step #8 in the previous section, but change "app_sample" to "kalivo".
Hit http://localhost:3000/account/login_under_duress and login as "tech-support".
Then go to the admin section, under settings, change the root URL to "localhost:3000".
Under transforms, go to the bottom and click "convert to development mode."
Make sure that the users table is correct now (most should be preceded with an 'x').
Start up the remaining platform services. See step #2.8 in the previous section.
Start up the kalivo application. See step #3 in the previous section, but change "app_sample" to "kalivo".
Point your browser to http://localhost:3000/.
|
|
re: Noob Dev Startup Guide
by Marc S. Schriftman on 2008-05-08 05:35 PM read 160 times |
Canonical Gem List for Platform Boxes, as of 5/8/2008:
No current tags
Log In to Reply | Log In to Copy | Tell a Friend |
Trackback URL: http://www.kalivo.com/trackback/978-re-noob-dev-startup-guide
