Until Jason can get the time to put up a proper tutorial: http://forum.slicehost.com/comments.php?DiscussionID=296
These initial notes were compiled by Michael Mahemoff (http://softwareas.com) based on a successful install of a second (actually third) instance on the same slice in mid-June, 2007. Using Deprec 1.7.1 and cap 1.4.1.
Another set of notes can be found here: multiple_rails_apps_on_one_slice
cd /path/to/railsapp deprec --apply-to . --name projectname --domain projectname.com
Edit config/deploy.rb as in generic document - essentially means uncommenting a few lines. The one change you do need to make is the apache port, to avoid conflicting with your other app, e.g.:
set :apache_proxy_port, 9000
You still need to do this, as your domain is different. Assuming you retain the same username (e.g. deploy), all you need to do is:
(Should this come before or after the deploy? The other document doesn’t make it clear. I believe you could probably do it either way.)
* Skip to the next step if you are using Deprec 1.8 or later as the following bug has been fixed: If you are using a Deprec version earlier than 1.8, you need to work around bug with scm_setup task (Slicehost Form, Trac), you’ll probably need to use a workaround here (this applies to general deprec setup too). For instance, if you have root, go edit /usr/local/lib/ruby/gems/1.8/gems/deprec-1.2.3/lib/deprec/recipes/svn.rb, and in the :svn_create_repos task:
svn_repos = "#{deploy_to}/repos"
(The forum post above uses svn_repos ||=, but I found that didn’t work as apparently svn_repos is being set somewhere before that.)
* Add SVN details as usual to config/deploy.rb as usual (though I believe the :repository setting will be ignored due to the above).
role :scm, domain # Next to other roles ... set :svn_root, "/var/www/apps/appname/svn" # Shouldnt be used but setup_scm is bugg set :repository, "svn+ssh://deploy@domain.com/var/www/apps/appname/svn/appname/repos/trunk"
* cap setup_scm * Now cd into to the newly created project workspace
I found cap didn’t quite handle this correctly.
* ssh into the server and manually edit /usr/local/apache2/conf/httpd.conf}. You want it to end with something like:
Include conf/apps/app1.conf Include conf/apps/app2.conf NameVirtualHost *:80 You'll probably find too many NameVirtualHost lines, which won't cause a problem, but delete them for neatness. Moreover, you might need to manually add app2.conf because the setup task seems to trip up here and not actually generate it.
That should be all you need to set up. If you look in [path_to]/apache2/conf/apps/app2.conf, you should see the correct ports for the BalancerMember, e.g. 10000 and 10001.
{ shouldn’t BalancerMember this be whatever you set here ⇒ [ set :apache_proxy_port, 9000 ] e.g. 9000, 9001?}
Back in your local machine’s project:
* cap deploy_with_migration
I’m not 100% certain the order above is correct - hopefully someone will correct any problems. Meantime, you may need to shuffle the order and/or repeat certain tasks. Sorry :).
Since public/index.html will easily run as a static file, with no Ruby, I recommend changing it and seeing if you can see the change. If so, your problem is possibly in the mongrel port setup.
The default setting means each application gets separate logs in /usr/local/apache2/logs/, as well as your app logs in /var/www/apps/appname/current/log.