Skip to content

Instantly share code, notes, and snippets.

View cardmagic's full-sized avatar

Lucas Carlson cardmagic

View GitHub Profile
$ brew install go etcdctl
$ git clone https://github.com/coreos/fleet.git
$ cd fleet
$ ./build
$ mv bin/fleetctl /usr/local/bin/
$ git clone https://github.com/CenturyLinkLabs/coreos-vagrant
$ cd coreos-vagrant/cluster
$ vagrant up --provision
$ fleetctl list-machines
MACHINE IP METADATA
09fd0a88... 10.0.2.15 -
77763947... 10.0.2.15 -
f31c383c... 10.0.2.15 -
$ sudo gem install bundler fig2coreos
$ cat fig.yml
web:
image: ctlc/wordpress
ports:
- 80:80
environment:
DB_USER: root
DB_PASSWORD: qa1N76pWAri9
$ fleetctl start db.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
db.1.service loaded active running Run db_1 9c008961.../10.0.2.15
$ fleetctl start web.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
$ fleetctl start db-discovery.1.service
$ fleetctl start web-discovery.1.service
$ fleetctl list-units
UNIT LOAD ACTIVE SUB DESC MACHINE
db-discovery.1.service loaded active running Announce db_1 9c008961.../10.0.2.15
db.1.service loaded active running Run db_1 9c008961.../10.0.2.15
web-discovery.1.service loaded active running Announce web_1 9c008961.../10.0.2.15
web.1.service loaded active running Run web_1 9c008961.../10.0.2.15
$ cd ~/coreos-vagrant/cluster/
# find out which box is hosting your port 80
$ etcdctl get /services/web/web_1
{ "host": "core-03", "port": 80, "version": "52c7248a14" }
$ vagrant share core-03 --http 80
==> core-03: Detecting network information for machine...
core-03: Local machine address: 192.168.65.2
core-03: Local HTTP port: 80
$ SERF_ID=$(docker run -d --name serf_1 -p 7946 -p 7373 ctlc/serf /run.sh)
$ wget https://dl.bintray.com/mitchellh/serf/0.5.0_linux_amd64.zip
$ unzip 0.5.0_linux_amd64.zip
$ sudo mv serf /usr/bin/
$ serf agent &
$ serf members
packer-virtualbox 10.0.2.15:7946 alive
$ serf join $(docker port $SERF_ID 7946)
Successfully joined cluster by contacting 1 nodes.
$ serf members
packer-virtualbox 10.0.2.15:7946 alive
b62e43c286c8 172.17.0.76:7946 alive serf-agent