This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Loading event'); | |
var aws = require('aws-sdk'); | |
exports.handler = function(event, context) { | |
var ecsService = 'sample-webapp'; | |
var ecsCluster = 'sample-cluster'; | |
var ecsRegion = 'us-west-2'; | |
var maxCount = 2; | |
var ecs = new aws.ECS({region: ecsRegion}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
Ohai.plugin(:Nameservers) do | |
provides "network/nameservers" | |
depends "network" | |
collect_data do | |
Ohai::Log.debug('Parsing resolv.conf for nameservers.') | |
nameservers = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Bring ECS Agent config and start consul | |
DC=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone/ | rev | cut -c 2- | rev) | |
ADVERTISE_IP=$(curl -s http://169.254.169.254/latest/meta-data/local-ipv4) | |
ECS_CLUSTER='example' | |
yum install -y aws-cli | |
aws s3 cp s3://ops-yotpo/docker/ecs/ecs.config /etc/ecs/ecs.config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Templates are updated to be compatible with nomad > 0.7.1 | |
[agent] | |
interval = "10s" | |
round_interval = true | |
metric_batch_size = 1000 | |
metric_buffer_limit = 10000 | |
collection_jitter = "0s" | |
flush_interval = "10s" | |
flush_jitter = "3s" | |
precision = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import boto3 | |
import logging | |
import argparse | |
from pprint import pformat,pprint | |
parser = argparse.ArgumentParser(description='Cross reference existing ec2 reservations to current instances.') | |
parser.add_argument('--log', default="WARN", help='Change log level (default: WARN)') | |
parser.add_argument('--region', default='us-east-1', help='AWS Region to connect to') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"ec2:DescribeInstances", | |
"ec2:DescribeTags" | |
], | |
"Resource": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script is intendent to install both Consul and Nomad clients | |
# on Ubuntu 16.04 Xenial managed by SystemD | |
# including docker and DnsMasq for *.service.consul DNS resolving | |
# | |
# Script assume that instance is running in AWS and have "ec2:DescribeInstances" permissions in IAM Role | |
set -x | |
export TERM=xterm-256color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script is intendent to install both Consul and Nomad servers | |
# on Ubuntu 16.04 Xenial managed by SystemD | |
# including DnsMasq for *.service.consul DNS resolving | |
set -i | |
export TERM=xterm-256color | |
export DEBIAN_FRONTEND=noninteractive | |
export DATACENTER_NAME="example" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log_format json escape=json | |
'{ "msec": "$msec", ' | |
'"remote_addr": "$remote_addr", ' | |
'"request_method": "$request_method", ' | |
'"request_uri": "$request_uri", ' | |
'"status": "$status", ' | |
'"body_bytes_sent": "$body_bytes_sent", ' | |
'"http_referer": "$http_referer", ' | |
'"http_user_agent": "$http_user_agent", ' | |
'"request_time": "$request_time" , ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resque.workers.each do |w| | |
w.unregister_worker if w.heartbeat.nil? | |
end |