Difference between revisions of "Code"
(→Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9) |
|||
Line 19: | Line 19: | ||
=== Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9 === | === Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9 === | ||
+ | |||
+ | this is largely based on chapter 27 of AWDwR, 2nd ed. | ||
follow the macports installation instructions here: http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts | follow the macports installation instructions here: http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts | ||
Line 44: | Line 46: | ||
− | + | in httpd.conf, uncomment | |
+ | Include conf/extra/httpd-vhosts.conf | ||
+ | and add | ||
+ | <Proxy balancer://mongrel_cluster> | ||
+ | BalancerMember http://127.0.0.1:8000 | ||
+ | # put as many members here as you have mongrels | ||
+ | </Proxy> | ||
+ | |||
− | |||
− | + | in conf/extra/httpd-vhosts.conf | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | RewriteEngine On | + | <VirtualHost *:80> |
− | RewriteRule ^/$ /index.html [QSA] | + | ServerName merced.ent.msu.edu |
− | RewriteRule ^([^.]+)$ $1.html [QSA] | + | ServerAdmin webmaster@dummy-host.example.com |
− | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | + | DocumentRoot /Users/krishna/dev/mx/trunk/public |
− | RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] | + | ErrorLog logs/dummy-host.example.com-error_log |
+ | CustomLog logs/dummy-host.example.com-access_log common | ||
+ | |||
+ | <Directory "/Users/krishna/dev/mx/trunk/public"> | ||
+ | Options FollowSymLinks | ||
+ | AllowOverride None | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </Directory> | ||
+ | |||
+ | RewriteEngine On | ||
+ | RewriteRule ^/$ /index.html [QSA] | ||
+ | RewriteRule ^([^.]+)$ $1.html [QSA] | ||
+ | RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | ||
+ | RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] | ||
+ | |||
+ | </VirtualHost> | ||
Revision as of 10:21, 20 March 2007
Contents |
A whiteboard for Code snippets, notes, etc. that might otherwise be lost or might be useful down the road, etc.
Console!
ruby script/console <environment>
Add a number of empty lots
$person_id = 2 $proj_id = 51 @proj = Proj.find(51) r = 0 while r < 800 do l = Lot.new(:otu_id => 8222, :key_specimens => 999, :rarity => "", :source_quality => "", :notes => 'Auto-created for ETOH move.') l.save! r += 1 end
Krishna's notes on setting up MySQL/Mongrel/Apache2 on OS 10.3.9
this is largely based on chapter 27 of AWDwR, 2nd ed.
follow the macports installation instructions here: http://trac.macosforge.org/projects/macports/wiki/InstallingMacPorts except i set $PATH in /etc/profile with
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
then
sudo port selfupdate
sudo port install gperf
(ran into errors with "gperf: invalid option -- m" before doing this)
sudo port install rb-termios
(crashed installing ruby, but not needed)
sudo port install autoconf
(ran into old version issue before doing this)
sudo port install apache2
add the "APACHE2=-YES-" line to /etc/hostconfig as instructed added following to /etc/profile
PATH="/opt/local/apache2/bin:$PATH"
copied httpd.conf.example to httpd.conf added proxy section:
in httpd.conf, uncomment
Include conf/extra/httpd-vhosts.conf
and add
<Proxy balancer://mongrel_cluster> BalancerMember http://127.0.0.1:8000 # put as many members here as you have mongrels </Proxy>
in conf/extra/httpd-vhosts.conf
<VirtualHost *:80> ServerName merced.ent.msu.edu ServerAdmin webmaster@dummy-host.example.com DocumentRoot /Users/krishna/dev/mx/trunk/public ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common <Directory "/Users/krishna/dev/mx/trunk/public"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> RewriteEngine On RewriteRule ^/$ /index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] </VirtualHost>
presuming rails and rake are installed, do:
sudo gem install --include-dependencies termios sudo gem install --include-dependencies capistrano sudo gem install --include-dependencies mongrel sudo gem install --include-dependencies mongrel_cluster
Note: if capistrano hangs, try reinstalling ruby as described here: http://weblog.jamisbuck.org/2005/9/24/switchtower-on-osx
if you get 'command not found' errors, try setting the ssh env as in: http://forum.textdrive.com/viewtopic.php?id=12629
sudo mongrel_rails cluster::start -C /Library/Rails/mx/current/config/mongrel_cluster.yml