Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Sane set of utility methods to provision remote servers over SSH and SCP

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 doorway.gemspec
README.md

Doorway

Sane set of utility methods to provision remote servers over SSH and SCP.

Installation

Add this line to your application's Gemfile:

gem 'doorway'

And then execute:

$ bundle

Or install it yourself as:

$ gem install doorway

Usage

doorway = Doorway.connect(:root, "10.0.1.20", :ssh_key => "~/.keys/somekey.pem")
doorway.exec "ls -la"

# -or-

Doorway.connect(:deployer, "10.0.1.20", :ssh_key => "~/.keys/deployer.pem") do |conn|

    # Raw command execution

    conn.exec    "whoami"
    conn.exec_as :root, "REALLY_GEM_UPDATE_SYSTEM=y gem update --system"

    # Script execution

    conn.exec_script <<-EOS.strip_heredoc

        #!/bin/bash
        apt-get install -y some-package

    EOS

    conn.exec_script_as :git, "scripts/add-public-ip"

    # Remote files

    conn.remote_file "/etc/nginx/nginx.conf", "nginx/nginx.conf"
    conn.remote_file "/etc/init.d/nginx", "nginx/nginx.init.d"
    conn.append_from "/etc/nginx/nginx.conf", "nginx/include"

    # ERB templates 

    conn.remote_file "/etc/nginx/conf.d/site.conf",
        :template => "nginx/vhost.conf.erb",
        :server   => "www.example.org",
        :root     => "/var/www/example"

    conn.append_from "/etc/sudoers.d/my_sudoers",
        :template => "sudoers/god.erb",
        :user     => "fcoury",
        :allow    => "/var/bin/all_your_base"

    # Download a file to server

    conn.get "https://webbynode_packages.s3.amazonaws.com/icecream-8.30.tar.gz", "/usr/local/src"

    # Ubuntu specific package management

    conn.add_ppa "chris-lea/node.js"
    conn.install "nodejs"

    # Advanced commands

    conn.sed "/home/git/repo/.git/config", 
        /remote "github"/, 'remote "bitbucket"'
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.