Skip to content

Instantly share code, notes, and snippets.

View ObjectIsAdvantag's full-sized avatar

Stève Sfartz ObjectIsAdvantag

View GitHub Profile
1st step : Create a Dockerfile
-------------------------------
> touch Dockerfile
> notepad Dockerfile
'''
# Start from argon (latest long term supported version of node)
# - argon : Full node dev env (640 MB)
# - argon-slim : Full node dev env (200 MB)
# Install + check sails version, 0.11.3 actually
npm install -g sails
sails -v
# Create new app
sails new SailsDemo
# Launch, open a browser http://localhost:1337
cd SailsDemo
{
"Outputs": {
"PublicSlaveDnsAddress": {
"Description": "Public slaves",
"Value": {
"Fn::GetAtt": [
"PublicSlaveLoadBalancer",
"DNSName"
]
}
# Install devd (en version 0.3 à minima)
# Create reverse proxy
# -H option to see headers
# -s for SSL support (DO NOT USE with localtunnel)
> devd -p 5000 https://tunnels.apispark.net:443/ -H
# Launch tunnel (internet reverse proxy)
# - you may need to create an account first...
> npm install -g localtunnel
> lt --port 5000 --subdomain sfartz
# Create a machine
# - Wait for the machine to come up
# - Check virtual box
# - Display the machine ip
CMD> docker-machine create --driver virtualbox <MACHINE>
CMD> docker-machine ip <MACHINE>
CMD> docker-machine inspect <MACHINE>
# Set env to the newly created machine
# Activate machine in the Windows Command Shell, ie sets the docker env
@ObjectIsAdvantag
ObjectIsAdvantag / Mongo Shading
Last active December 2, 2015 21:23
M202 - week 5
> mongo --nodb
> config = { shard0 : { smallfiles : "", noprealloc : "", nopreallocj : ""}, shard1 : { smallfiles : "", noprealloc : "", nopreallocj : "" }, shard2 : { smallfiles : "", noprealloc : "", nopreallocj : ""}};
{
"shard0" : {
"smallfiles" : "",
"noprealloc" : "",
"nopreallocj" : ""
},
"shard1" : {
@ObjectIsAdvantag
ObjectIsAdvantag / gist:4e1cf932ddd326c27592
Last active August 29, 2015 14:19
M202 week5 sample
Here is one possible solution to the Game of Thrones problem we posed. Please note that we are passing a configuration document to ShardingTest. This will ensure the mongods are created using small files and without preallocating data files and journal files. It should eliminate problems with disk space that some students have reported when using ShardingTest.
config = { d0 : { smallfiles : "", noprealloc : "", nopreallocj : ""}, d1 : { smallfiles : "", noprealloc : "", nopreallocj : "" }, d2 : { smallfiles : "", noprealloc : "", nopreallocj : ""}};
cluster = new ShardingTest( { shards : config } );
// shard db
sh.enableSharding("houses");
// shard collections
sh.shardCollection("houses.stark", {dire_wolves_owned:1});
sh.shardCollection("houses.lannister", {debt_owed:1});
sh.shardCollection("houses.targaryen", {followers:1});
@ObjectIsAdvantag
ObjectIsAdvantag / Horseman UI Test
Last active December 2, 2015 21:21
Horseman UI testing sample
/*
* UI testing with Horseman (phantomjs node integration)
*
* Installation
* see http://www.horsemanjs.org/
*
* Run
* node <this-file.js>
*
* Debugging