Skip to content

Instantly share code, notes, and snippets.

@fluxsaas
Created July 14, 2014 08:51
Show Gist options
  • Save fluxsaas/39718aee54109c6278c3 to your computer and use it in GitHub Desktop.
Save fluxsaas/39718aee54109c6278c3 to your computer and use it in GitHub Desktop.
example flightplan.coffee
# flightplan.js
Flightplan = require("flightplan")
plan = new Flightplan()
release_number = new Date().getTime()
application = 'backbone_stage'
deploy_to = "/var/www/#{application}/current"
releases_dir = "/var/www/#{application}/releases"
# Path to latest release dir.
release_dir = "#{releases_dir}/#{release_number}"
# configuration
plan.briefing
debug: true
destinations:
staging:
host: "example.com"
username: "deploy"
agent: process.env.SSH_AUTH_SOCK
plan.local (local) ->
local.log "Run build"
local.exec "gulp --env staging"
local.log "Copy files to remote hosts"
# gulp builds staging env. to the ./staging dir
filesToCopy = local.exec("git ls-files staging", silent: false)
# rsync files to all the destination's hosts
local.transfer filesToCopy, release_dir
return
# run commands on remote hosts (destinations)
plan.remote (remote) ->
remote.log "Reload application"
# we build to the local staging/public dir, so we need to symlink ./staging.
remote.exec "ln -snf #{release_dir}/staging #{deploy_to}",
user: "deploy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment