Skip to content

Instantly share code, notes, and snippets.

View phuong3030's full-sized avatar

Phương Trần Tuấn phuong3030

  • Hà Nội - Việt Nam
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdn.jsdelivr.net/combine/npm/sanctuary-show@1.0.0/index.min.js,npm/sanctuary-type-identifiers@2.0.1/index.min.js,npm/sanctuary-type-classes@9.0.0/index.min.js,npm/sanctuary-either@1.0.0/index.min.js,npm/sanctuary-maybe@1.0.0/index.min.js,npm/sanctuary-pair@1.0.0/index.min.js,npm/sanctuary-def@0.18.1/index.min.js,npm/sanctuary@0.15.0/index.min.js,npm/concurrify@1.0.3,npm/denque@1.3.0,npm/fluture-sanctuary-types@2.2.0,npm/fluture@8.0.2">
</script>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdn.jsdelivr.net/combine/npm/sanctuary-show@1.0.0/index.min.js,npm/sanctuary-type-identifiers@2.0.1/index.min.js,npm/sanctuary-type-classes@9.0.0/index.min.js,npm/sanctuary-either@1.0.0/index.min.js,npm/sanctuary-maybe@1.0.0/index.min.js,npm/sanctuary-pair@1.0.0/index.min.js,npm/sanctuary-def@0.18.1/index.min.js,npm/sanctuary@0.15.0/index.min.js,npm/fluture@8.0.2,npm/fluture-sanctuary-types@2.2.0">
</script>
</head>
<body>

Docker Swarm with Macvlan, Consul and Autoscaling

TL;DR:

This will get you routable containers with IPs on your existing subnets, advertising to Consul. They will also be scalable and placed across a cluster of Swarm hosts. It's assumed that you are already running Consul, so if not, there are a ton of tutorials out there. It's also assumed you know how to install Docker and various Linux kernels.

Bonus: We add an autoscaling API called Orbiter (https://gianarb.it/blog/orbiter-the-swarm-autoscaler-moves).

I just want to run containers, like now, on my existing infrastructure and networks!

So you have an existing environment. You use Consul for service discovery. Life is good. Containers are now a thing and you want to work them in without having to worry about overlay networking or reverse proxies. You also don't want to add extra latency (as some naysayers could use it as fuel to kill your hopes and dreams). Lastly, you don't have a lot of time to invest in a complex orchestration tool, such a

@phuong3030
phuong3030 / introrx.md
Created December 23, 2017 08:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@phuong3030
phuong3030 / gist:4593d2a6067404cf8a3caafd9fbc86c4
Created July 20, 2016 04:10 — forked from No9/gist:3217890
Google IO 2012 Breaking the JavaScript Speed Limit with V8
Install Java
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo aptitude -y install oracle-java8-installer
java -version
Install ElasticSearch
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.6.0.deb
@phuong3030
phuong3030 / spree-api-rest-examples.md
Created December 16, 2015 02:49 — forked from jcowhigjr/spree-api-rest-examples.md
Spree API REST Examples

Products

index of products 25 first

curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products.json

Show a product

curl -i -H "X-Spree-Token: YOUR_TOKEN_ID" http://0.0.0.0:3000/api/products/706676762.json

Modify a product

curl -i -X PUT -H "X-Spree-Token: YOUR_TOKEN_ID" -d "product[name]=Headphones" http://0.0.0.0:3000/api/products/706676762.json

#
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
# .NET, PHP, Python and Node applications with deep visibility and low
# overhead. For more information, visit www.newrelic.com.
#
# Generated May 01, 2015
#
# This configuration file is custom generated for Self employed_561

How to install PhantomJS on Ubuntu

Version: 1.9.8

Platform: x86_64

First, install or update to the latest system software.

sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev