Some CoffeeScript (verbosely commented for clarity)
# Override Rails handling of confirmation
$.rails.allowAction = (element) ->
# The message is something like "Are you sure?"
message = element.data('confirm')| namespace :ubuntu do | |
| desc "Setup Environment" | |
| task :setup_env, :roles => :app do | |
| update_apt_get | |
| install_dev_tools | |
| install_git | |
| install_subversion | |
| install_sqlite3 | |
| # Install and setup RVM instead of old Rails stack | |
| #install_rails_stack |
| /*eslint-disable no-alert */ | |
| import React from "react" | |
| import ReactDOM from "react-dom" | |
| import PropTypes from "prop-types" | |
| class Form extends React.Component { | |
| static childContextTypes = { | |
| form: PropTypes.shape({ | |
| submit: PropTypes.func.isRequired, | |
| inputChange: PropTypes.func.isRequired, |
| #!/bin/bash | |
| # <UDF name="ssh_key" Label="Paste in your public SSH key" default="" example="" optional="false" /> | |
| # root ssh keys | |
| mkdir /root/.ssh | |
| echo $SSH_KEY >> /root/.ssh/authorized_keys | |
| chmod 0700 /root/.ssh | |
| # update to latest |
| // First download node, create new folder | |
| // Cd into new folder, npm and git init | |
| // Create heroku app | |
| heroku create | |
| // install babel cli (to do compiling), babel presets (to compile the right features), express (web server) | |
| npm install babel-cli babel-presets-es2015 express | |
| // Create file .babelrs and add json |
| $.fn.extend | |
| myplugin: (options) -> | |
| self = $.fn.myplugin | |
| opts = $.extend {}, self.default_options, options | |
| $(this).each (i, el) -> | |
| self.init el, opts | |
| self.log el if opts.log | |
| $.extend $.fn.myplugin, | |
| default_options: |
| /*! ****************************** | |
| Handlebars helpers | |
| *******************************/ | |
| // debug helper | |
| // usage: {{debug}} or {{debug someValue}} | |
| // from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/) | |
| Handlebars.registerHelper("debug", function(optionalValue) { | |
| console.log("Current Context"); | |
| console.log("===================="); |
Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).
Other application notes:
Salient points for each file:
Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.
Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.
Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.
##Setup your server (this would ideally be done with automated provisioning)
npm install -g forever##Install flightplan
npm install -g flightplannpm install flightplan --save-dev