Skip to content

Instantly share code, notes, and snippets.

@bobtfish
bobtfish / gist:7403811
Created November 10, 2013 20:51
Get docs for the functions you've got in puppet _AND_ your current module set
require 'puppet'
Puppet[:parser] = 'future'
Puppet[:environment] = 'master'
Puppet[:manifest] = 'manifests/site.pp'
Puppet[:modulepath] = 'modules/:vendor/modules/'
Puppet.settings.initialize_app_defaults({
:logdir => "/dev/null",
:confdir => "/dev/null",
:vardir => "/dev/null",
:rundir => "/dev/null",
@bobtfish
bobtfish / Gemfile
Last active December 23, 2015 04:29
source 'https://rubygems.org'
gem 'puppet-lint', '0.4.0.pre1'
#!/bin/sh
echo $* >> /tmp/foo
cat >> /tmp/foo
spaceinvaders TestApp $ perl -MDevel::Cover ./script/testapp_server.pl
Devel::Cover 1.00: Collecting coverage data for branch, condition, pod, statement, subroutine and time.
Selecting packages matching:
Ignoring packages matching:
/Devel/Cover[./]
^t/
\.t$
^test\.pl$
Ignoring packages in:
/Users/t0m/perl5/perlbrew/perls/perl-5.17.6/lib/site_perl/5.17.6/darwin-2level
require "logstash/filters/base"
require "logstash/namespace"
class LogStash::Filters::MaxID < LogStash::Filters::Base
@@max_id = 1
config_name "max_id"
plugin_status "experimental"
public
@bobtfish
bobtfish / test
Last active December 12, 2015 00:29
#!/usr/bin/perl
use strict;
use warnings;
use LWP;
use HTTP::Cookies;
use Carp ();
$SIG{ALRM} = \&Carp::confess;
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to realize virtual resources User[nleonguid1551fl_adrianuid1800kwilczynskiuid1538cwatsonuid1563fl_russuid1806spikeuid1504abaranoskyuid1540fl_michaeluid1808lorenzouid1520fl_patuid1803jkelseyuid1515mseebachuid1522tomduid1530tomwuid1531mcialowiczuid1541mkouuid1566bfeldbaueruid1549fl_chrisuid1802fl_pauluid1804aparkeruid1506douglasuid1508jchanuid1513waseemtajuid1534szepedauid1547fl_andyuid1801fl_steveuid1807paweluid1523bhickeyuid1507fdilkeuid1509jmacleanuid1568fl_daviduid1809timleagueuid2018stalwaruid1528kamiluid1519jwozniakuid1544fl_peemuid1805], File[nleonguid1551fl_adrianuid1800kwilczynskiuid1538cwatsonuid1563fl_russuid1806spikeuid1504abaranoskyuid1540fl_michaeluid1808lorenzouid1520fl_patuid1803jkelseyuid1515mseebachuid1522tomduid1530tomwuid1531mcialowiczuid1541mkouuid1566bfeldbaueruid1549fl_chrisuid1802fl_pauluid1804aparkeruid1506douglasuid1508jchanuid1513waseemtajuid1534szepedauid1547fl_andyuid1801fl_steveuid1807paweluid1523bhicke

test tl;dr - Given heavy Javascript apps which people keep open for hours (or days) at a time, how do you deploy multiple times a day without screwing the user over or making the developer's life really hard? Discuss!

Reliable continuous deployment for stateless web applications can be done reasonably easily. For example:

  • Have 2 instances (A and B) of your application on each server
  • With A instances in the load balancer, upgrade green instances
  • Add B instances to the load balancer
  • Remove A instances from the load balancer
<?php
session_start();
$m = mysql_connect();
mysql_select_db("test", $m);
if (isset($_POST['logout'])) {
unset($_SESSION['user_id']);
unset($_SESSION['fullname']);
}
@bobtfish
bobtfish / example
Created June 16, 2012 15:48
Message-Passing examples
#!/bin/sh
message-pass \
--input STDIN \
--output STDOUT