CARVIEW |
technomancy / harker
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
click here to add a description
click here to add a homepage
-
Branches (1)
- master ✓
- Tags (0)
Pledgie Donations
Once activated, we'll place the following badge in your repository's detail box:
Rails deployments via RubyGems. Because a package manager is a terrible thing to waste. — Read more
tree bd6f4fb069c6a408bc5114b8e6cd90330f2bdf4c
parent 7ccee04e781a8a4e724c49be23afc1a4737f5851
name | age | message | |
---|---|---|---|
![]() |
.autotest | Wed Mar 25 16:39:44 -0700 2009 | Initial commit. [technomancy] |
![]() |
.gitignore | Mon Mar 30 14:08:38 -0700 2009 | Update tests to work without installed sample g... [technomancy] |
![]() |
History.txt | Tue Apr 21 20:42:40 -0700 2009 | Update readme; release 0.5.3. [technomancy] |
![]() |
Manifest.txt | Mon Mar 30 16:57:19 -0700 2009 | Fix gemification templates. [technomancy] |
![]() |
README.rdoc | Tue Apr 21 20:42:40 -0700 2009 | Update readme; release 0.5.3. [technomancy] |
![]() |
Rakefile | Tue Apr 21 20:36:37 -0700 2009 | Add some more metadata to rakefile. [technomancy] |
![]() |
bin/ | Thu Mar 26 22:11:24 -0700 2009 | show the filename (basename) of harker, not the... [jmhodges] |
![]() |
harker.gemspec | Wed Apr 01 21:09:17 -0700 2009 | Upgrade to hoe that has rake fix. [technomancy] |
![]() |
lib/ | Tue Apr 21 20:42:40 -0700 2009 | Update readme; release 0.5.3. [technomancy] |
![]() |
test/ | Tue Apr 21 20:09:49 -0700 2009 | Daemonize server in the test suite. [technomancy] |
Harker
Description
Harker means Rails deployments via RubyGems—because a package manager is a terrible thing to waste.
Motivation
This will mean you can use the same infrastructure you already rely on for your dependencies to manage your application itself. It means never having to keep a checkout of your app just for deployment. It also becomes very easy to see what versions are installed on a given box and run multiple instances (of the same or different versions) at the same time on different ports.
Your app code will live in your gem home, but all the files specific to a given instance will live in an instance directory.
In short: you’ve already got a package manager. Why are you handling installation of your deployed apps with a one-off tool?
Setup
Your Rails app will need to be modified a bit to become a gem and work with Harker. But don’t worry, these modifications will improve your app and make it more awesome. Running "harker /path/to/rails/app" will attempt to turn it into a gem that uses Hoe. You may need to perform a bit of tweaking in order to get it to build cleanly since every app is different—see the one in test/sample/ for an example of how this works. In particular, be sure Manifest.txt does not include any files that shouldn’t go in the gem, such as pid or log files.
You don’t have to use Hoe if you want to turn your app into a gem manually or using another library, but it helps.
Usage
Once your app is a gem, install it locally with "rake install_gem", and you should be able to use the bin wrapper to generate a new instance:
$ your_app init ~/apps/your_app_3001
Then edit ~/apps/your_app_3001/database.yml with your database settings. At that point you should be able to bring up your database:
$ your_app migrate ~/apps/your_app_3001
Test it out by dropping into the console:
$ your_app console ~/apps/your_app_3001
Then you can start and stop your application server via Rack:
$ your_app start ~/apps/your_app_3001 --daemon --port=3001 $ your_app stop ~/apps/your_app_3001
The start command takes all the same arguments as script/server. To configure it in a way that doesn’t require command-line arguments, create a config.ru file in your instance directory, and Rails will pick that up with Rack.
If you omit the second argument, it defaults to the current directory.
For deployment, simply publish your gem to a gem server (public or private), install it on the target server, and launch it via the bin wrapper as shown above.
Extensions
Sometimes it becomes necessary to hot-patch a deployed app. Instead of editing the code inside your gem home, (which is Fraught with Peril) you can place .rb files inside your instance directory’s extensions/ directory. These will be loaded immediately after the application is required.
Requirements
- rails (at least 2.3.2)
- a Rails app to use it with
- rubygems
- hoe (technically optional)
Install
- sudo gem install technomancy-harker —source=gems.github.com —source=gems.rubyforge.org
Todo
- rake tasks for remotely installing gem
- make it easy to "rake release" to a private gem repo
- test, test, test. try it out with more rails apps!
License
Copyright © 2009 Phil Hagelberg.
Licensed under the same terms as Ruby.