Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nathanpeck's full-sized avatar
📦
Bin packing containers onto hosts

Nathan Peck nathanpeck

📦
Bin packing containers onto hosts
View GitHub Profile
var store = {
data: {
typing: []
},
addTyper: function(typer) {
this.data.typing.push(typer);
}
};
<div id="content" class="content">
<room-details></room-details>
<messages></messages>
<typing></typing>
</div>
messages = await this.dynamoDB.query({
TableName: this.tableName,
KeyConditionExpression: 'room = :room',
Limit: 20,
ExpressionAttributeValues: {
':room': where.room
},
ExclusiveStartKey: where.message ? where : undefined,
ScanIndexForward: false // Always return newest items first
}).promise();
# A role for the service so it can access the tables
ChatServiceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Principal:
Service: "ecs-tasks.amazonaws.com"
Action: ['sts:AssumeRole']
$ time docker-compose build client
Building client
Step 1/9 : FROM node:9 AS build
---> 814364d36f69
Step 2/9 : WORKDIR /srv
---> Using cache
---> 031927a1a5ab
Step 3/9 : ADD package.json .
---> Using cache
---> 9cd95ef4d4ce
run:
docker-compose up -d
build:
docker-compose build client
docker-compose up --no-deps -d client
test:
docker-compose build client
docker-compose build test
const span = tracer.startSpan('ws');
span.setTag('service.name', 'frontend-ws');
span.setTag('resource.name', 'new message');
// Must call this otherwise asychronous trace spans don't show up under the overall span.
tracer.scopeManager().activate(span);
// Asynchronous code starts here.
// At some point in the future, right before the callback
version: "3"
networks:
chat:
services:
# Launch the Redis used for syncing messages between copies of the client app
redis:
image: redis
networks:
- chat
# This is a Nginx sidecar. This is needed because Consul Connect proxy
# binds to localhost and doesn't accept direct traffic from the public.
# This Nginx container does though and can serve as a proxy to the proxy.
- Name: !Sub ${ServiceName}-nginx
Image: nginx
EntryPoint:
- '/bin/sh'
- '-c'
Command:
- >
const quargo = require('quargo');
const request = require('request');
const aw = require('awaitify-stream');
const byline = require('byline');
const MongoClient = require('mongodb').MongoClient;
var argv = require('minimist')(process.argv.slice(2));
// Read in the certificate authority file.
var ca = [require('fs').readFileSync(process.cwd() + '/connection/rds-ca-beta-2015-root.pem')];