• This repository has been archived on 01/Sep/2020
  • Stars
    star
    2,098
  • Rank 21,129 (Top 0.5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 14 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

git deployment made easy

Easy git deployment

Straightforward, Heroku-style, push-based deployment. Your deploys can become as simple as this:

$ git push production master

To get started, install the "git-deploy" gem.

gem install git-deploy

Only the person who is setting up deployment for the first time needs to install the gem. You don't have to add it to your project's Gemfile.

Which app languages/frameworks are supported?

Regardless of the fact that this tool is mostly written in Ruby, git-deploy can be useful for any kind of code that needs deploying on a remote server. The default scripts are suited for Ruby web apps, but can be edited to accommodate other frameworks.

Your deployment is customized with per-project callback scripts which can be written in any language.

The assumption is that you're deploying to a single host to which you connect over SSH using public/private key authentication.

Initial setup

  1. Create a git remote for where you'll push the code on your server. The name of this remote in the examples is "production", but it can be whatever you wish ("online", "website", or other).

    git remote add production "[email protected]:/apps/mynewapp"

    /apps/mynewapp is the directory where you want your code to reside on the remote server. If the directory doesn't exist, the next step creates it.

  2. Run the setup task:

    git deploy setup -r "production"

    This will initialize the remote git repository in the deploy directory (/apps/mynewapp in the above example) and install the remote git hook.

  3. Run the init task:

    git deploy init

    This generates default deploy callback scripts in the deploy/ directory. You should check them in git because they are going to be executed on the server during each deploy.

  4. Push the code.

    git push production master
  5. Login to your server and manually perform necessary one-time administrative operations. This might include:

    • set up the Apache/nginx virtual host for this application;
    • check your config/database.yml and create the production database.

Everyday deployments

If you've set your app correctly, visiting http://example.com in your browser should show it up and running.

Now, subsequent deployments are done simply by pushing to the branch that is currently checked out on the remote:

git push production master

Because the deployments are performed with git, nobody else on the team needs to install the "git-deploy" gem.

On every deploy, the default deploy/after_push script performs the following:

  1. updates git submodules (if there are any);
  2. runs bundle install --deployment if there is a Gemfile;
  3. runs rake db:migrate if new migrations have been added;
  4. clears cached CSS/JS assets in "public/stylesheets" and "public/javascripts";
  5. restarts the web application.

You can customize all this by editing generated scripts in the deploy/ directory of your app.

Deployments are logged to log/deploy.log in your application's directory.

How it works

The git deploy setup command installed a post-receive git hook in the remote repository. This is how your code on the server is kept up to date. This script checks out the latest version of your project from the current branch and runs the following callback scripts:

  • deploy/setup - on first push.
  • deploy/after_push - on subsequent pushes. It in turn executes:
    • deploy/before_restart
    • deploy/restart
    • deploy/after_restart
  • deploy/rollback - executed for git deploy rollback.

All of the callbacks are optional. These scripts are ordinary Unix executables. The ones which get generated for you by git deploy init are written in shell script and Ruby.

Extra commands

  • git deploy hooks - Updates git hooks on the remote repository

  • git deploy log [N=20] - Shows last 20 lines of deploy log on the server

  • git deploy rerun - Re-runs the deploy/after_push callback as if a git push happened

  • git deploy restart - Runs the deploy/restart callback

  • git deploy rollback - Undo a deploy by checking out the previous revision, runs deploy/rollback if exists instead of deploy/after_push

  • git deploy upload <files> - Copy local files to the remote app

More Repositories

1

hub

A command-line tool that makes git easier to use with GitHub.
Go
22,524
star
2

will_paginate

Pagination library for Rails and other Ruby applications
Ruby
5,702
star
3

dotfiles

bash, zsh, git, tmux, personal toolbox
Shell
1,208
star
4

rfc

Pretty RFC indexes and reformats RFC documents for easier discovery and viewing.
JavaScript
935
star
5

poignant-guide

Why's Poignant Guide to Ruby
HTML
732
star
6

instagram

The first Instagram website and lightweight API HTTP client
Ruby
585
star
7

ssl-tools

Ruby tools to help with debugging certificates for SSL connections
Ruby
339
star
8

contacts

Ruby library for consuming Google, Yahoo!, Flickr and Windows Live contact APIs
Ruby
294
star
9

anyenv

rbenv-inspired version manager that can be configured to manage versions of ANYTHING
Go
273
star
10

vimfiles

vim configuration – Ruby, Rails, Markdown, SCSS, CoffeeScript
Vim Script
266
star
11

hanna

More than just a new RDoc template
Ruby
234
star
12

gh-branch

GitHub CLI extension for fuzzy finding, quickly switching between and deleting branches.
Shell
210
star
13

nibbler

A cute HTML scraper / data extraction tool in under 70 lines of code
Ruby
141
star
14

bump-homebrew-formula-action

Automatically bump Homebrew formula after a release
TypeScript
126
star
15

coral

Hacker's toolbelt for Ruby, gems, Bundler, git, and more
Shell
108
star
16

choices

Easy external settings for your app
Ruby
95
star
17

gorgeous

Convert between different data formats: JSON, XML, YAML, Ruby, email, URL-encoded
Ruby
94
star
18

movieapp

Mark movies you watched, liked, or plan to watch, and share with your friends.
Ruby
79
star
19

diveintohtml5

[STALE] Copy of Mark Pilgrim's book "Dive Into HTML5"
HTML
75
star
20

gh-cp

GitHub CLI extension to copy a file from a GitHub repository locally without cloning the repository.
Shell
72
star
21

issuesync

Downloads all issues for the current project to individual `issues/*.md` files
Ruby
67
star
22

twitter-login

Login through Twitter; DEPRECATED in favor of omniauth-twitter.
Ruby
63
star
23

rspec-rails-mocha

Ports functionality of mock_model and stub_model from rspec-rails for developers using Mocha.
Ruby
57
star
24

hub-api-utils

A collection of `hub api` examples
Shell
57
star
25

bluecloth

Markdown processor in Ruby; foked from official SVN repo to fix bugs
Ruby
49
star
26

faraday-stack

[deprecated] Über Faraday stack for consuming APIs (JSON, XML decoding & more)
Ruby
47
star
27

sinatra-boilerplate

Sinatra + Haml Sass Compass Bourbon CoffeeScript
JavaScript
41
star
28

gh-contrib

GitHub CLI extension to render your contribution graph in the terminal
Shell
39
star
29

explain-ruby

Explains Ruby syntax
Ruby
32
star
30

twin

Twitter's twin; a Rack middleware to expose a Twitter-like API from your app
Ruby
30
star
31

user-scripts

User scripts for Greasemonkey/Safari/Fluid; home of Endless Tweets
JavaScript
28
star
32

gh-repo-collab

GitHub CLI extension to manage repository collaborators
Shell
28
star
33

standardista

A nicotine patch for Rails users who want to stop pretending they're writing XHTML
Ruby
23
star
34

tapas-bar

Tiny webapp that I use for watching RubyTapas from my iPad across home network.
Ruby
20
star
35

polyamory

A tool that knows how to run your tests regardless of framework
Ruby
19
star
36

remark

HTML to Markdown converter
Ruby
18
star
37

gh-delete-repo

[Deprecated] GitHub CLI extension for deleting GitHub repositories
Shell
17
star
38

rbenv-user-gems

[DEPRECATED] rbenv plugin for $GEM_HOME and user gems install location
Shell
15
star
39

go-travis

Go-based CLI tool for Travis CI
Go
15
star
40

shrubbery

Nested lists unlike you've ever seen
JavaScript
14
star
41

thor-tasks

GitHub tasks for Thor
14
star
42

gh-license

GitHub CLI extension to add a license to the current project
Shell
14
star
43

blog

The blog
HTML
14
star
44

itunes

Access iTunes with MacRuby through Scripting Bridge
C
13
star
45

facebook

Facebook login; DEPRECATED in favor of omniauth-facebook.
Ruby
13
star
46

textmate-bundles

My fork of a repo that once was "textmate/bundles"
11
star
47

curly

Easier than Curl::Easy
Ruby
10
star
48

async-upload

Example app for asynchronous file upload via hidden iframe with Prototype and PHP
PHP
9
star
49

rbenv-charles-ssl

rbenv plugin to help installing Charles Proxy SSL certificate into all rubies
Shell
9
star
50

cstags

ctags generator for CoffeeScript files
CoffeeScript
9
star
51

puppet-personal

I'm learning Puppet. WIP
Ruby
8
star
52

mingo

Ruby
8
star
53

asbestos

Render JSON from your XML Builder templates
Ruby
7
star
54

twitter-followers

Mini app that processes new followers notifications from Twitter
JavaScript
7
star
55

gh-repo-topic

[Deprecated] GitHub CLI extension to list or add repository topics
Shell
6
star
56

svg2png

Convert SVGs to PNG using headless Chrome
JavaScript
6
star
57

never-forget

The stupid exception tracker. Saves to MongoDB.
Ruby
6
star
58

gh-lint-workflow

A GitHub CLI extension to lint GitHub Actions workflow files [EXPERIMENTAL]
Shell
6
star
59

Lyndon.tmbundle

Execute JavaScript expressions with a single keystroke inside TextMate
6
star
60

railsgirls-movieapp

Example application for Rails Girls workshop
Ruby
5
star
61

stylish.vim

vim plugin to cycle through available color schemes and fonts on your system
Ruby
4
star
62

gh-notifications

Ruby
3
star
63

goreleaser-test

Shell
3
star
64

go-utils

Go
3
star
65

tweets

Grailbird site that powers an individual Twitter Archive, edited for my needs
JavaScript
3
star
66

gh-label

1
star
67

pages-cname-instructions

How to host GitHub Pages site on your own domain
JavaScript
1
star