Skip to content

Instantly share code, notes, and snippets.

View tvalletta's full-sized avatar

Thomas A. Valletta tvalletta

View GitHub Profile
{
"image": "redis:3.2-alpine",
"ports": ["6379:6379"]
}
{
"image": "mongo:3.2",
"ports": ["27017:27017"],
"volumes": ["${KUDE_CONFIG_HOME}/mongo/data:/data/db"]
}
@tvalletta
tvalletta / aws-codebuild-cross-account-image-push.yml
Created February 17, 2017 15:14
AWS CodeBuild buildspec.yml example for building a docker image and pushing it to a AWS ECS docker repo in another AWS account
version: 0.1
# REQUIRED ENVIRONMENT VARIABLES
# AWS_KEY - AWS Access Key ID
# AWS_SEC - AWS Secret Access Key
# AWS_REG - AWS Default Region (e.g. us-west-2)
# AWS_OUT - AWS Output Format (e.g. json)
# AWS_PROF - AWS Profile name (e.g. central-account)
# IMAGE_REPO_NAME - Name of the image repo (e.g. my-app)
# IMAGE_TAG - Tag for the image (e.g. latest)
@tvalletta
tvalletta / mongo-promise.js
Created June 15, 2016 14:26
Mongo connection using promises
'use strict';
const mongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017/test';
mongoClient.connect(url)
.then(conn => {
return conn.collection('restaurants')
.find().limit(10).toArray()
.then(out => console.log(out))
@tvalletta
tvalletta / mongo-bluebird-disposer.js
Last active March 14, 2018 23:42
Mongo connection using bluebird promisify and connection disposer
'use strict';
const Promise = require('bluebird');
const mongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017/test';
Promise.using(getMongoConnection(url), conn => {
return conn.collection('restaurants')
.find().limit(10).toArray()
.then(out => console.log(out));