Skip to content

Standup your own Gemcutter

David Radcliffe edited this page Jan 28, 2014 · 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.

Also, consider checking out Geminabox. It’s a lot simpler than Gemcutter and may suit your organization’s needs better.

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.9.3
  • rubygems 1.3.5
  • postgresql + ruby driver gem (gem install pg)
  • redis
  • 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/rubygems/rubygems.org
cp config/database.yml.example config/database.yml
vim config/database.yml # Fill in your db settings for the production env!
bundle install vendor/bundler_gems
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['MAIL_DOMAIN']='example.com'
ENV['MAIL_PASSWORD']='secret'
ENV['MAIL_USERNAME']='you@example.com'

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 script/server production. Feel free to set up unicorn or your server of choice (we use unicorn 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