Skip to content

Instantly share code, notes, and snippets.

View ianblenke's full-sized avatar
🎯
Focusing

Ian Blenke ianblenke

🎯
Focusing
View GitHub Profile

What

Unit files to deploy an ElasticSearch cluster on CoreOS via Fleet.

Service discovery & registration is done via etcd.

[email protected] provides a dumb discovery service by registering an elasticsearch host if it should be up. [email protected] registers the service only if it is running.

A service & timer unit for elasticsearch curator is provided which does some housekeeping.

@ianblenke
ianblenke / _README.md
Last active August 29, 2015 14:16 — forked from arkadijs/_README.md

Registrator and SkyDNS

We use progrium/registrator and yaronr/skydns (SkyDNS2) to publish information about Docker containers to DNS via A and SRV records. All nodes runs skydns and registrator, and first three nodes are inserted as NS-s into Route53 DNS for services.cluster-name.domain.io. Note, v4 registrator must be used until registrator/124 is resolved.

$ host -t srv mysql-1.services.deis.r53.acp.io deis-6-1.eu.r53.acp.io
Using domain server:
Name: deis-6-1.eu.r53.acp.io
Address: 54.171.239.227#53
Aliases: 
@ianblenke
ianblenke / add-xfleet-conflicts.sh
Created March 10, 2015 18:56
Fix fleet's naive unit count based scheduling of deis application units by resubmitting fleet units with an X-Fleet Conflicts glob
#!/bin/bash -e
tmpdir=/tmp/add-xfleet-conflicts
mkdir -p $tmpdir
fleetctl list-units -fields=unit -no-legend | grep -v -e '@\|deis' | cut -d. -f1-2 | sort | uniq | while read name ; do
max=$(fleetctl list-machines -no-legend | wc -l)
count=$(fleetctl list-units -fields=unit -no-legend | grep -e "^$name" | wc -l)
fleetctl list-units -fields=unit -no-legend | grep -e "^$name" | sort -n | while read service; do
tmpfile=$tmpdir/$service
fleetctl cat $service >| $tmpfile
if ! grep X-Fleet $tmpfile > /dev/null; then
@ianblenke
ianblenke / gist:d1924b1350793c6b8204
Last active September 29, 2015 12:00
Amazon ECS on CoreOS
@ianblenke
ianblenke / rethinkdb.cloud-init
Created March 13, 2015 21:59
Rethink-DB CoreOS cloud-init
#cloud-config
coreos:
units:
- name: rethinkdb-create-fleet-units.service
command: start
content: |
[Unit]
After=docker.service
ConditionFileIsExecutable=/srv/rethinkdb-create-fleet-units.sh
ConditionFileNotEmpty=/srv/[email protected]
@ianblenke
ianblenke / gist:ee9bb6331ac1d47e97ad
Created March 17, 2015 13:20
"systemctl cat etcd" on a CoreOS host
$ systemctl cat etcd
# /usr/lib64/systemd/system/etcd.service
[Unit]
Description=etcd
[Service]
User=etcd
PermissionsStartOnly=true
Environment=ETCD_DATA_DIR=/var/lib/etcd
Environment=ETCD_NAME=%m
@ianblenke
ianblenke / build_docker.sh
Created March 18, 2015 16:49
Buiding docker from source
DOCKER_BUILDTAGS=btrfs_noversion AUTO_GOPATH=1 BINPATH=. make binary
@ianblenke
ianblenke / es_pri_allocate_unassigned.md
Last active November 18, 2021 00:14
elasticsearch trying to allocate a primary shard which is disabled

Allow routing allocations:

curl -XPUT localhost:9200/_cluster/settings -d '{
                "transient" : {
                    "cluster.routing.allocation.enable" : "all"
                }
        }'
sudo btrfs filesys show
sudo btrfs filesys balance start -dusage=1 /var/lib/docker
@ianblenke
ianblenke / gist:b127e483ce08dbaf6410
Created April 16, 2015 15:19
Switch boot2docker from aufs to overlayfs
echo "DOCKER_STORAGE=overlay" >> /var/lib/boot2docker/profile`