Skip to content

Instantly share code, notes, and snippets.

View ianblenke's full-sized avatar
🎯
Focusing

Ian Blenke ianblenke

🎯
Focusing
View GitHub Profile
@ianblenke
ianblenke / nxlog.conf
Created February 20, 2015 22:59
nxlog directly to elasticsearch
## This is a sample configuration file. See the nxlog reference manual about the
## configuration options. It should be installed locally and is also available
## online at http://nxlog.org/nxlog-docs/en/nxlog-reference-manual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
@ianblenke
ianblenke / gist:8aac408c3096a5256998
Created February 13, 2015 21:07
Find the CoreOS etcd leader
docker pull realguess/jq > /dev/null 2>&1 ; curl -sL http://127.0.0.1:7001/v2/admin/machines | docker run -i realguess/jq jq 'map(select(.state == "leader")) | .[].clientURL'
@ianblenke
ianblenke / upgrade-coreos.md
Last active July 7, 2021 03:49
How to upgrade CoreOS manually

Before upgrading, make sure you are allowing insecure registry access, or your newer docker won't be able to talk to the Deis registry:

sudo bash -c 'mkdir -p /etc/systemd/system/docker.service.d/; cat <<EOF > /etc/systemd/system/docker.service.d/50-insecure-registry.conf
[Service]
Environment="DOCKER_OPTS=--insecure-registry 10.0.0.0/8 --insecure-registry 172.16.0.0/12 --insecure-registry 192.168.0.0/16"
EOF
'
sudo bash -c 'mkdir -p /etc/systemd/system/docker.service.d/; cat <<EOF > /etc/systemd/system/docker.service.d/50-insecure-registry.conf
[Service]
Environment="DOCKER_OPTS=--insecure-registry 10.0.0.0/8 --insecure-registry 172.16.0.0/12 --insecure-registry 192.168.0.0/16"
EOF
'
@ianblenke
ianblenke / add-xfleet-conflicts.sh
Last active August 29, 2015 14:14
Add an X-Fleet Conflicts to all deis deployed units
#!/bin/bash -e
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)
if [ $count -gt $max ]; then
echo "Skipping $name, there are $count deployed units on $max fleet machines"
else
echo "Processing $name"
fleetctl list-units -fields=unit -no-legend | grep -e "^$name" | while read service; do
others=$(echo $service | cut -d. -f1-2)
@ianblenke
ianblenke / sinatra-docker.sh
Last active August 29, 2015 14:14
A quick and dirty sinatra project docker demo
#!/bin/bash
# A quick and dirty sinatra project docker demo
mkdir projects
cd projects
gem install hazel
hazel my_app
cd my_app
bundle pack
bundle install --path vendor/bundle --local
@ianblenke
ianblenke / docker-machine.sh
Last active August 29, 2015 14:14
Preparing the DOCKER environment variables for fig to use, as pulled from a docker-machine config
if which docker-machine > /dev/null 2>&1; then
export DOCKER_HOST=""
alias d="docker $(docker-machine config $(docker-machine ls -q | head -1))"
declare -a lines=( $(docker-machine config $(docker-machine ls -q | head -1)) )
for (( i = 0; i < ${#lines[*]}; ++ i )) ; do
line="${lines[$i]}"
if [ "$line" = "--tls" ]; then
export DOCKER_TLS_VERIFY=true
@ianblenke
ianblenke / docker-machine_vmware.sh
Last active September 16, 2015 17:25
Steps needed to run docker-machine with vmwarefusion
#!/bin/bash
BUCKET=$(whoami)-docker-machine
# Build a boot2docker.iso for vmware (optional)
# git clone https://github.com/ianblenke/boot2docker
# cd boot2docker
# docker build -t boot2docker . && docker run --rm boot2docker > boot2docker.iso
# aws s3 cp boot2docker.iso s3://$BUCKET/boot2docker.iso --acl 'public-read'
# URL=https://s3.amazonaws.com/$BUCKET/boot2docker.iso
@ianblenke
ianblenke / ntp.cloud-init
Created January 21, 2015 23:48
An NTP cloud-init for coreos
#cloud-config
coreos:
units:
- name: settimezone.service
command: start
content: |
[Unit]
Description=Set the timezone
@ianblenke
ianblenke / blackhole.cloud-init
Last active August 29, 2015 14:13
sudo coreos-cloudinit --from-file=blackhole.cloud-init
#cloud-config
coreos:
units:
- name: blackhole-create-fleet-units.service
command: start
content: |
[Unit]
After=docker.service
ConditionFileIsExecutable=/srv/blackhole-create-fleet-units.sh
ConditionFileNotEmpty=/srv/[email protected]