How to Create Your Own Private Gem Server With Geminabox

Gem In A Box on Dreamhost

Check out the repo @ https://github.com/shukydvir/geminabox-dreamhost

How to run Gem In A Box on Dreamhost shared hosting.

Installation

  1. Create a new domain/subdomain in Dreamhost control panel for the gem server make sure that you checked the Passenger (Ruby/Python apps only) option. You must also specify the location of the ‘public’ subdirectory of the Ruby on Rails (or other Rack-compliant) application at the same time which is just public.

  2. SSH to your server and cd to the folder of the domain/subdomain.

  3. Clone this repo locally or directly to your Dreamhost domain/subdomain you wish to have the gem server.

1
git clone https://github.com/shukydvir/geminabox-dreamhost.git
  1. Update the config.ru file with your username and password for the basic authentication or comment these lines if you don’t wise no authentication at all.
simple Rack::Auth::Basic block
1
2
3
4
use Rack::Auth::Basic do |username, password|
  username = "username"
  password = "password"
end
  1. if you have cloned localy you need to upload the files to the server (choose which method you want rsync, scp, etc…)

  2. run bundle install on the server.

1
bundle install

if that don’t work you need to export the path of the gems on your server should be like this:

1
export PATH=~/.gems/bin:/usr/lib/ruby/gems/1.8/bin:$PATH

and then run bundle install.

  1. you need to restart the passenger in order for the settings to take place.
Bash
1
touch tmp/restart.txt

will get the job done.

Usage

if you did other changes in the code you need to restart the passenger by doing

Bash
1
touch tmp/restart.txt

in order to use this just add this to your Gemfile

GemFile
1
source "http://your.servers.host"

or if you setup the basic auth use this

Gemfile
1
source "http://username:password@your.servers.host"

and you can access your private gems hosted on your own private gem server on Dreamhost.

Resources

  1. Dreamhost Passenger - http://wiki.dreamhost.com/Passenger
  2. Gem In A Box - https://github.com/cwninja/geminabox
  3. Gem In A Box - Http Basic Auth - https://github.com/cwninja/geminabox/wiki/Http-Basic-Auth

Additionl Informaion

You can create a mirror of rubygems.org with this setup just point your data folder to your mirror folder.

you can user the rubygems-mirror gem to do this easily.

I’ll explain how I did that next post so stay tune…

Signup for Dreamhost account.

if you don’t have a Dreamhost shared hosting account you can create one using the Promo Code below:

  1. $30 discount if you pay for 1 year.
  2. $50 discount if you pay for 2 years.

Enjoy

Promo Code: “SHUKYDVIR”

Comments