Skip to content

Instantly share code, notes, and snippets.

@grubernaut
grubernaut / README.md
Last active September 27, 2020 17:57
Blue Green Deploys with Terraform

Terraform Blue-Green Deploy example

Note: Use Terraform Modules as functions!!!

This will allow you to create a "networking" module, and use those outputs to populate the security groups, access zones, and subnet id's for your other modules.

Using autoscaling groups with a fixed size will protect you from AWs bugs or instance outages. This way an instance that dies, will be replaced so you always maintain the expected amount of instances for that service.

Workflow:

Boostrapping Salt on Linux EC2 with Cloud-Init

Salt is a great tool for remote execution and configuration management, however you will still need to bootstrap the daemon when spinning up a new node. One option is to create and save a custom AMI, but this creates another resource to maintain and document.

A better method for Linux machines uses Canonical's CloudInit to run a bootstrap script during an EC2 Instance initialization. Cloud-init takes the user_data string passed into a new AWS instance and runs it in a manner similar to rc.local. The bootstrap script needs to:

  1. Install Salt with dependencies
  2. Point the minion to the master
@ioc32
ioc32 / gist:9e64a9948333fd9b126f
Created January 6, 2015 20:08
Heka issue1235
[hekad]
maxprocs = 2
base_dir = "/tmp/cache"
pid_file = "/tmp/hekad.pid"
share_dir = "/usr/share/heka"
[log1]
type = "LogstreamerInput"
log_directory = "/var/log/"
file_match = 'yum\.log'
@hillar
hillar / flatten_json.lua
Last active August 29, 2015 14:11
heka :: flatten json before injecting message
require "cjson"
local util = require("util")
-- https://github.com/mozilla-services/lua_sandbox/blob/master/modules/util.lua
local message = {
Type = "IGNORE",
Fields = {}
}
@inthecloud247
inthecloud247 / docker_advisory_board_notes_28_october_2014
Created December 4, 2014 22:35
Docker Advisory Board First Meeting Notes 28 October 2014
Docker Governance Advisory Board First Meeting
Notes 28 October 2014
Interim Chair: Van Lindberg (VL)
Attendees/Acronyms table:
@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@bryantrobbins
bryantrobbins / Jenkins Slave Dockerfile
Last active September 14, 2020 00:01
Docker jenkins and nexus example
FROM ubuntu:12.04
MAINTAINER Bryan Robbins <bryantrobbins@gmail.com>
# Get latest packages
RUN apt-get update && apt-get clean
# Needed for Jenkins
RUN apt-get install --no-install-recommends openjdk-7-jdk -y
# Needed for Jenkins jobs
@czarneckid
czarneckid / Zero downtime deploys with gunicorn.markdown
Last active August 31, 2016 17:42
Zero downtime deploys with gunicorn

Zero downtime deploys with gunicorn

Below are the actual files we use in one of our latest applications at Agora Games to achieve zero downtime deploys with gunicorn. 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).

Salient points for each file:

  • gunicorn.py: The pre_fork function looks for gunicorn's old PID file in the proper file and sends the proper QUIT signal to the old process once the new process is running.
  • sv-gunicorn-run.jinja: This is the runit template we use in our Salt-managed infrastructure for handling the application process management. You could just as easily convert this to a non-templatized version.
@ceejbot
ceejbot / proposal.md
Last active November 25, 2015 21:13
monitoring proposal

Go here for the latest + some code.

numbat

An alerting engine for a metrics & monitoring system.

This is the same approach I wanted in my initial spike, only instead of writing a custom collector & using an existing alerting engine (riemann), I'm proposing using an existing collector (hekad) and writing the alerting engine.

The system

@pauldix
pauldix / gist:156c5f7a0549ef88e02d
Last active August 29, 2015 14:01
Shard spaces, retention policies, and downsampling
// define these shard spaces
shardSpaces = [
{name: "raw", retention: "4h"},
{name: "week", retention: "7d"},
{name: "month", retention: "30d"},
{name: "year", retention: "365d"},
{name: "keep", retention: "inf"}
]
// apply these rules for mapping data to shard spaces