##TUNING##
System: set file descriptors to 32K or 64K
vim /etc/security/limit.conf
http { | |
lua_shared_dict healthchecks 1m; | |
upstream YOURAPP { | |
server 0.0.0.1; # just an invalid address as a place holder | |
balancer_by_lua_block { | |
local balancer = require "ngx.balancer" | |
-- well, usually we calculate the peer's host and port |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <strings.h> | |
/* | |
* Pearson hashing (from Wikipedia) | |
* | |
* Pearson hashing is a hash function designed for fast execution on processors with 8-bit registers. | |
* Given an input consisting of any number of bytes, it produces as output a single byte that is strongly | |
* dependent on every byte of the input. Its implementation requires only a few instructions, plus a |
### autoscale.tf | |
data "template_file" "userdata" { | |
template = "${file("templates/userdata.tpl")}" | |
vars { | |
region = "${var.region}" | |
file_system_id = "${aws_efs_file_system.prod-efs.id}" | |
} | |
} | |
resource "aws_launch_configuration" "mig5-prod-lc" { |
#!/bin/bash | |
grep -r -E '[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}' * |
#!/bin/bash | |
PACKAGE=oracle-jdk-7 | |
PACKAGE_VIRTUAL=oracle-jdk | |
VERSION_MAJOR=7 | |
VERSION_MINOR=60 | |
VERSION="${VERSION_MAJOR}u${VERSION_MINOR}" | |
BUILD=b19 | |
PKG_BASENAME="jdk-$VERSION-linux-x64.tar.gz" |
FROM golang:1.6.2 | |
COPY . /go | |
RUN go get github.com/nats-io/nats | |
RUN go build api-server.go | |
EXPOSE 8080 | |
ENTRYPOINT ["/go/api-server"] |
#!/usr/bin/python | |
# | |
# Usage: packer-config my-template.yaml | packer build - | |
# | |
# Constructs a Packer JSON configuration file from the specified YAML | |
# template file and writes it to STDOUT. | |
# | |
# The YAML template format adds some flexibility and readability by | |
# adding comments and an !include directive, allowing for the | |
# following template syntax: |
package main | |
import ( | |
"github.com/codegangsta/negroni" | |
"github.com/gorilla/mux" | |
) | |
func main() { | |
router := mux.NewRouter() | |
apiV1 := router.PathPrefix("/api/v1").Subrouter() |