Skip to content

Standup your own Gemcutter

qrush edited this page Aug 7, 2010 · 10 revisions

Here’s what you need to do to get Gemcutter running on your own box somewhere, AS A PRODUCTION APPLICATION. Most of these steps aren’t necessary to hack on the project! Check out the Contribution Guidelines for how to get started developing new features or fixing bugs for the project.

This guide does not use Capistrano, it’s just getting a copy up and running. Please check config/deploy.rb and modify as you see fit if you want to use it.

Dependencies

You’ll need the following packages to get up and running:

Packages

  • ruby 1.8.7
  • rubygems 1.3.5
  • postgresql + ruby driver gem (gem install postgresql)
  • memcached
  • gem bundler (gem install bundler)
  • some mail server (postfix, etc)

Instructions

1) Clone the repo and get the app setup:

git clone git://github.com/qrush/gemcutter
cp config/database.yml.example config/database.yml
vim config/database.yml # Fill in your db settings for the production env!
gem bundle
rake db:create db:migrate

2) You’ve got two choices from here, use S3 to store your gems or the local filesystem. If you’re using S3, you’re all set once you fill in your credentials (next step). Otherwise, edit line 2 of lib/vault.rb to make sure only Vault::FS gets included. You’ll also want to make sure Hostess.local in app/metal/hostess.rb is set to true. (Any patches to make this easier for those standing up their own Gemcutter will be accepted!)

3) Set up config/secret.rb with some app settings.

ENV['S3_KEY']='your s3 account key' 
ENV['S3_SECRET']='your s3 account secret'
ENV['HOPTOAD_KEY']='your hoptoad'
ENV['MAIL_DOMAIN']='example.com'
ENV['MAIL_PASSWORD']='secret'
ENV['MAIL_USERNAME']='[email protected]'

4) Almost there! If you want to prime the site with some gems, you can use rake gemcutter:import:process path/to/some/gems. Point that rake task to a directory with .gem files and they’ll be shoved into the site and ready for download.

5) Run the site with rackup -E production. Feel free to set up Passenger or your server of choice (we use Passenger on the live site).

Background Processes

Gemcutter uses Delayed::Job for processing downloads and gem pushes. On the production site, we use Monit to make sure the DJ worker stays alive, you may want to do the same. Starting a worker is simple:

script/delayed_job -e production start

If you want to provide the legacy index for gem mirror to work, set up this rake task on a cronjob. On production, it’s run nightly.

rake cron RAILS_ENV=production

Clone this wiki locally