Skip to content

Instantly share code, notes, and snippets.

View adamgoucher's full-sized avatar

adam goucher adamgoucher

View GitHub Profile
@adamgoucher
adamgoucher / laravel-and-aws.md
Created February 29, 2016 05:31
Laravel and AWS

Laravel and AWS

Who /actually/ owns physical hardware for their businesses anymore? Not us. We're all-in with AWS, and with a little bit of planning you can too. This session focuses on the how we have deployed our Laravel apps[s] into the AWS ecosystem over the last 18 months with the twin goals of having things fault tolerant (or at least recoverable), and not having to manage a server or service a little as possible.

More specifically, this session is subdivided into the following areas;

  • Managing your AWS account
  • Provisioning something to run Laravel on
  • Getting Laravel onto it
  • Letting users interact with it
  • Scaling across servers [and eventually availability zones]
@adamgoucher
adamgoucher / not-so-sexy.md
Created February 29, 2016 04:27
AWS: Automating The Not-so-sexy Parts

AWS: Automating The Not-so-sexy Parts

We all know how fun and 'easy' it is to spin up environments, or even migrate our entire business into AWS. But after the initial thrill is over, comes the eventual realization that you have just traded the headache of physical hardware for something else. Something that isn't visible and almost unlimited financial risk. This talk is about that not-so-sexy part of an AWS implementation; management of it.

  • [Bare Minimum] Account Security
  • IAM Roles
  • Billing
  • Monitoring
  • Service windows
@adamgoucher
adamgoucher / gist:b81aed9ea907eb418c1a
Created January 30, 2016 20:09
ec2 startup log with encrypted boot volume
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.13.0-44-generic (buildd@lamiak) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #73-Ubuntu SMP Tue Dec 16 00:22:43 UTC 2014 (Ubuntu 3.13.0-44.73-generic 3.13.11-ckt12)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-3.13.0-44-generic root=UUID=ae649ac3-2a1a-438f-8c02-10e03ec86be5 ro console=tty1 console=ttyS0
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Centaur CentaurHauls
[ 0.000000] e820: BIOS-provided physical RAM map:
@adamgoucher
adamgoucher / index.js
Last active August 23, 2019 06:27
An AWS Lambda function which monitors CloudTrail logs created in the us-east-1 region for CreateHostedZone events and makes the corresponding private zone if they were public. The problem is that this can have a lag of up to 15 minutes.
var aws = require('aws-sdk');
var zlib = require('zlib');
var async = require('async');
var EVENT_SOURCE_TO_TRACK = /route53.amazonaws.com/;
var EVENT_NAME_TO_TRACK = /CreateHostedZone/;
var s3 = new aws.S3();
var route53 = new aws.Route53();
@adamgoucher
adamgoucher / gist:067f033bad234e4e6a84
Last active October 9, 2015 16:37
machinations necessary to host your own codedeploy package in a local reprepro instance as it requires the Priority field in the control filenow it. (the 'source' attribute on package type isnt supported on ubuntu which is the aws-samples way of doing this.)
Get the latest install script
Adam-Gouchers-MacBook:machinations adam$ aws s3 cp s3://aws-codedeploy-us-west-2/latest/VERSION . --region us-west-2
download: s3://aws-codedeploy-us-west-2/latest/VERSION to ./VERSION
Adam-Gouchers-MacBook:machinations adam$
understand the current version
Adam-Gouchers-MacBook:machinations adam$ cat VERSION
{"rpm":"releases/codedeploy-agent-1.0-1.751.noarch.rpm","deb":"releases/codedeploy-agent_1.0-1.751_all.deb"}
@adamgoucher
adamgoucher / deploy.sh
Created August 4, 2015 23:22
quick scripts to deploy and then wait for completion of a build in aws codedeploy.
if [ -f codedeploy.id ]; then
rm codedeploy.id
fi
aws deploy create-deployment \
--application-name MY_APPLICATION \
--deployment-group-name humans \
--s3-location bucket=MY_BUCKET,bundleType=zip,key=MY_APPLICATION\/$revision.zip \
--output text \
--region us-west-2 > codedeploy.id
@adamgoucher
adamgoucher / .etc.default.puppet
Created July 31, 2015 01:53
So puppet lets you assign agents to 'environments', but that is done at the agent level. But of course you cannot manage the agent config until it has connected to the server to gets its node config blah blah blah catch 22. so i'm going to modify /etc/default/puppet to look like this in my custom ami in order to be able to pass in the environmen…
# Defaults for puppet - sourced by /etc/init.d/puppet
# Enable puppet agent service?
# Setting this to "yes" allows the puppet agent service to run.
# Setting this to "no" keeps the puppet agent service from running.
START=yes
for x in $(facter ec2_userdata); do
case $x in
puppet_environment*)
@adamgoucher
adamgoucher / gist:aade0b8719149cbfcf22
Created May 8, 2015 23:54
JQueryDatePicker helper class for webedriver
from selenium import webdriver
class NoSuchDayException(Exception):
""" Custom exception for trying to select an invalid day of the month
Rather than try and be clever around which days are valid in a month, we trust that
the widget is populating things correctly and just blow up if you request the 4th day
of the month for instance.
"""
pass
class role::sms_gateway_development {
include profile::laravel3
class {'profile::sms_gateway':
application_environment => 'development'
}
}
class role::sms_gateway_testing {
include profile::laravel3
class {'profile::sms_gateway':
@adamgoucher
adamgoucher / radgridhackiness.cs
Created June 3, 2014 14:51
radgrid hackiness
protected void RGsummary_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridPagerItem)
{
//setting the page sizes
RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
BLL.RadGridFunctions.PopulatePageSizeCombo(PageSizeCombo, RGsummary.MasterTableView.ClientID);
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
//Localization...