Skip to content

Instantly share code, notes, and snippets.

View philips's full-sized avatar
👨‍💻
at the keebs

Brandon Philips philips

👨‍💻
at the keebs
View GitHub Profile
@philips
philips / gist:7866706
Last active December 30, 2015 18:19

This is a temporary workaround to have a customized etcd configuration.

Create a local state directory

sudo mkdir /media/state/overlays/var/lib/etcd-local
sudo chown etcd:etcd /media/state/overlays/var/lib/etcd-local

Add a local etcd unit file

core@ip-10-80-49-131 ~ $ curl -L 'http://127.0.0.1:4001/v2/keys/coreos.com/coreinit/machines?recursive=true&wait=true&waitIndex=0'
{"action":"set","key":"/coreos.com/coreinit/machines/3eb8c6f3-f0b2-49f1-8ec9-32203f9f6764/addrs","prevValue":"[{},{}]","value":"[{},{}]","expiration":"2013-12-03T02:36:28.832883719Z","ttl":10,"modifiedIndex":1374}
core@ip-10-80-49-131 ~ $ curl -L 'http://127.0.0.1:4001/v2/keys/coreos.com/coreinit/machines?recursive=true&wait=true&waitIndex=1500'
^C
core@ip-10-80-49-131 ~ $ curl -L 'http://127.0.0.1:4001/v2/keys/coreos.com/coreinit/machines?consistent=true&recursive=true&wait=true&waitIndex=1500'
{"action":"get","key":"/coreos.com/coreinit/machines","dir":true,"kvs":[{"key":"/coreos.com/coreinit/machines/3eb8c6f3-f0b2-49f1-8ec9-32203f9f6764","dir":true,"modifiedIndex":4},{"key":"/coreos.com/coreinit/machines/102d82da-40a8-464d-aef3-7ffbd995ce5a","dir":true,"modifiedIndex":12},{"key":"/coreos.com/coreinit/machines/5d39195a-76af-4fa7-86c9-6140faaf0d58","dir":true,"modifiedIndex":18}]

Add a local docker unit file

Create a file called /media/state/units/docker-local.service that has the following contents:

[Unit]
Description=docker local

[Service]
PermissionsStartOnly=true
@philips
philips / gist:7310435
Last active March 17, 2017 21:03
Setting up swap on coreos

Setup a swap file in the stateful partition

Run these commands as root to create a 512 megabyte swap.

fallocate -l 512m /media/state/512MiB.swap
chmod 600 /media/state/512MiB.swap
mkswap /media/state/512MiB.swap
wget http://storage.core-os.net/coreos/amd64-generic/123.0.0/coreos_production_pxe.vmlinuz
wget http://storage.core-os.net/coreos/amd64-generic/123.0.0/coreos_production_pxe_image.cpio.gz

Add a local docker unit file

Create a file called /media/state/units/docker-local.service that has the following contents:

[Unit]
Description=docker local

[Service]
PermissionsStartOnly=true
@philips
philips / gist:6998454
Last active December 25, 2015 15:29
Using a port in the service file name

Create simplehttp@.service

cat > simplehttp@.service
[Unit]
Description=Serves stuff over http

[Service]
ExecStart=/usr/bin/docker run -p %I:8080 b88a40f29dd7
date MMddhhmm[[cc]yy]
Where,
MM : Month (two-digit numeric month)
dd : Day (two-digit numeric day i.e. day of month)
hh : Hour
mm : Minutes (30)
cc : First two digits of the year (10)
yy : Last two digits of the year (2010).
$ gdbus call --system --dest org.freedesktop.systemd1 --object-path /org/freedesktop/systemd1/unit/doesnt_2dexist_2eservice -m org.freedesktop.DBus.Properties.GetAll org.freedesktop.systemd1.Unit
Generates UnitNew and UnitRemove events
signal sender=:1.3 -> dest=(null destination) serial=7945 path=/org/freedesktop/systemd1; interface=org.freedesktop.systemd1.Manager; member=UnitNew
string "doesnt-exist.service"
object path "/org/freedesktop/systemd1/unit/doesnt_2dexist_2eservice"
signal sender=:1.3 -> dest=(null destination) serial=7946 path=/org/freedesktop/systemd1; interface=org.freedesktop.systemd1.Manager; member=UnitRemoved
string "doesnt-exist.service"
object path "/org/freedesktop/systemd1/unit/doesnt_2dexist_2eservice"
@philips
philips / gist:6785381
Created October 1, 2013 21:27
Booting the CoreOS XEN PXE under qemu
#!/bin/bash
XEN=xen-4.1-amd64
KERNEL=vmlinuz.coreos.xen
INITRD=coreos_developer_pxe_image.cpio.gz
COREOS_ARGS="root=squashfs: state=tmpfs:"
XEN_ARGS="console=hvc0 earlyprintk=xen"
CPU=host
# Qemu can't deal with gzip'd kernels