Skip to content

Instantly share code, notes, and snippets.

View nzoschke's full-sized avatar

Noah Zoschke nzoschke

View GitHub Profile
@nzoschke
nzoschke / lambda-canary.js
Last active March 5, 2016 23:46
Lambda Canary
var http = require('http');
exports.handler = function(event, context) {
// return success before 5m
console.log("setTimeout start");
setTimeout(function(){
console.log('setTimeout 290s finish');
context.succeed('setTimeout 290s finish');
}, 290000);
@nzoschke
nzoschke / Dockerfile
Created June 12, 2016 20:08
Modern Ruby / Rails Dockerfile
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get -yy install build-essential ruby-dev
RUN apt-get -yy install libmysqld-dev libpq-dev libsqlite3-dev
RUN apt-get -yy install nginx nodejs
WORKDIR /app
ENV PORT 5000
@nzoschke
nzoschke / EFS.sh
Last active December 15, 2016 23:02
root@642dc10588ea:/var/www/html# find . -type f | wc -l
11035
root@642dc10588ea:/var/www/html# tar cfv /tmp/oc.tar --one-file-system -C /usr/src/owncloud .
root@642dc10588ea:/var/www/html# du -h /tmp/oc.tar
98M /tmp/oc.tar
root@642dc10588ea:/var/www/html# time tar cfv - --one-file-system -C /usr/src/owncloud . | tar xf - -k
real 0m36.628s

First, check out Discourse and patch it for Heroku. To get the first push to build we need to run migrations before asset precompilation. To get the web dyno to start, we need to configure Puma to stay in the foreground.

## Check out Discourse

$ git clone https://github.com/discourse/discourse.git
$ cd discourse

## Patch Discourse for Heroku
@nzoschke
nzoschke / bios.sh
Last active January 10, 2018 15:48
#!/bin/bash
set -ex
export GIT_DIR=src/$PKG/.git
run -s "Cloning" git clone $URL --branch $REF --single-branch src/$PKG && git reset --hard $SHA
PKGS=$(go list $PKG/...)
run -s "Linting" golint -set_exit_status $PKGS
run -s "Vetting" go vet -x $PKGS
run -s "Building" go build -v $PKGS

Edge CloudFront CLI

Configure and activate an AWS CLI Profile

Configure a new edge profile with your addon AWS credentials:

$ heroku config --app edgeapp
EDGE_AWS_ACCESS_KEY_ID:     AKIA...
EDGE_AWS_SECRET_ACCESS_KEY: JRHH...