Skip to content

Instantly share code, notes, and snippets.

View christinedraper's full-sized avatar

Christine Draper christinedraper

  • CognitiveScale Inc
  • United States
View GitHub Profile
@christinedraper
christinedraper / default.rb
Last active August 29, 2015 14:20
Default attributes for deploy_revision gist
default['myapp']['user'] = 'automation' # must have access to git repo
default['myapp']['path'] = '/home/automation/myapp' # where to install app - make sure this directory exists (or create in recipe)
default['myapp']['name'] = 'myapp' # name must match that in package.json
default['myapp']['repo_url'] = "bitbucket.org:mycompany/myapp.git"
default['myapp']['npm_registry'] = 'https://registry.nodejitsu.com'
@christinedraper
christinedraper / deploy.rb
Last active August 29, 2015 14:20
Using deploy_revision resource to deploy nodejs from git
path = node['myapp']['path']
install_options = []
install_options << "--registry=#{node['myapp']['npm_registry']}" if (node['myapp']['npm_registry'])
# option is to prevent failure as pkgs are unauthenticated
package 'git' do
action :install
options "--allow-unauthenticated"
end
@christinedraper
christinedraper / ai-autoscaling.template
Created March 5, 2015 19:29
Simple CloudFormation template, generated topology.json and generated Chef provisioning recipes
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"elbappserverelb": {
"Type": "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties": {
"AvailabilityZones": [
"us-west-2c",
"us-west-2b",
"us-west-2a"
@christinedraper
christinedraper / gist:81efddfde26ebb2573ac
Created February 2, 2015 19:17
ELB with two listeners using chef-provisioning
require 'chef/provisioning'
with_driver "aws"
with_data_center 'us-west-1' do
machine 'bowser' do
machine_options :bootstrap_options => {
:key_name => 'test2-aws'
}
end
@christinedraper
christinedraper / app-attributes-default.rb
Last active May 19, 2022 12:21
Chef derived attribute
default["app"]["name"] = "app"
# Attribute to show the problem
default["app"]["install_dir"] = "/home/#{node["app"]["name"]}"
# Attribute used in delayed evaluation approach
default["app"]["install_dir2"] = "/home/%{name}"
# Attribute used in conditional assignment approach
# default["app"]["install_dir3"] = "/home/#{node["app"]["name"]}"
@christinedraper
christinedraper / model.js
Created September 4, 2014 18:03
Backbone model with nested collections
define([
'underscore','backbone','logging'
], function(_, Backbone, logging) {
var RootModel =
Backbone.Model.extend({
initialize : function(attributes, options) {
Backbone.Model.prototype.initialize.apply(this, arguments);