Skip to content

Instantly share code, notes, and snippets.

View kapilt's full-sized avatar
🌩️
🌩 📦 🔭 📻 🚀 🛰

Kapil Thangavelu kapilt

🌩️
🌩 📦 🔭 📻 🚀 🛰
View GitHub Profile
@kapilt
kapilt / Dont Panic
Created October 11, 2012 16:53
Demo Time! aka Dont Panic
Philip Henslowe: Mr. Fennyman, allow me to explain about the theatre business.
The natural condition is one of insurmountable obstacles on the road to imminent disaster.
Hugh Fennyman: So what do we do?
Philip Henslowe: Nothing. Strangely enough, it all turns out well.
Hugh Fennyman: How?
Philip Henslowe: I don't know. It's a mystery.
@kapilt
kapilt / dockerd-contaiiner.log
Created October 31, 2013 17:55
log from dockerd.
https://github.com/dotcloud/docker/issues/2476
[debug] api.go:997 Calling POST /containers/create
2013/10/31 13:21:53 POST /v1.6/containers/create
[debug] api.go:997 Calling POST /containers/{name:.*}/attach
2013/10/31 13:21:53 POST /v1.6/containers/96fd519109e2/attach?stderr=1&stdin=1&stdout=1&stream=1
[debug] container.go:515 attach: stdin: begin
[debug] container.go:550 attach: stdout: begin
[debug] container.go:588 attach: stderr: begin
[debug] container.go:631 attach: waiting for job 1/3
@kapilt
kapilt / update-address
Last active September 15, 2020 20:29
Workaround for juju bug http://pad.lv/1215579
#!/usr/bin/python
"""
Juju fails to update addresses in relations when those addresses
change. This script can be used to propagate address changes on a
unit to all of its relations and related units.
This is a workaround for http://pad.lv/1215579
You need to transfer this file to all the units with changed addresses
"""
Allow for introspection of topolologies in flights
"""
from jujuctl.db import get_db
from jujuctl.env import get_env
def list_topologies(options):
@kapilt
kapilt / mongo-node.yaml
Created July 23, 2014 14:49
tosca mongo-node-elk
tosca_definitions_version: tosca_simple_1.0.0
description: >
TOSCA simple profile with node.js, mongodb,...
inputs:
capability_types:
tosca.capabilities.MongoEndpoint:
derived_from: tosca.capabilities.DatabaseEndpoint
@kapilt
kapilt / gist:aa3370d8bb2b8f9c7050
Last active August 29, 2015 14:04
openstack uuid
compute/api.py: instance['uuid'] = str(uuid.uuid4())
compute/manager.py: token = str(uuid.uuid4())
compute/manager.py: token = str(uuid.uuid4())
compute/manager.py: token = str(uuid.uuid4())
context.py: return 'req-' + str(uuid.uuid4())
db/sqlalchemy/api.py: values['uuid'] = str(uuid.uuid4())
db/sqlalchemy/api.py: network_ref['uuid'] = str(uuid.uuid4())
db/sqlalchemy/api.py: str(uuid.uuid4()),
network/manager.py: vif.uuid = str(uuid.uuid4())
openstack/common/context.py: return 'req-%s' % str(uuid.uuid4())
Placement
---------
Deployer supports flexible per unit placement policies. A unit placement policy allows for
specifying which machine a unit is placed on, including allowing multiple units to be deployed
to the same machine.
This is expressed in deployer config via the ‘to’ list parameter on a service. Each unit that
needs placement must have its placement specified individually else the default behavior is used,
per the service’s constraints.
api for unit agent request shutdown on self machine (triggered by hook exit value)
api for unit agent to watch for shutdown on machine
-> on receipt
stops further hook exec / blocking on the current one if any
signals ready for shutdown
api for unit agent to signal ready for shutdown
api for machine agent watch for shutdown
-> on shutdown recieved
-> disables unit deployment
svc host fault upgrade size power ip
42fzbcx2ev juju0nezlcysed3o... 0 0 Small Started 10.0.0.20
42fzbcx2ev juju9bd6mjna00h0... 0 4 Small Started 10.0.0.60
42fzbcx2ev juju9ygqoy9qjkdq... 1 1 Small Started 10.0.0.28
42fzbcx2ev jujufrh460g4vyra... 1 0 Small Started 10.0.0.68
42fzbcx2ev jujukhrocaqpux90... 1 3 Small Started 10.0.0.52
42fzbcx2ev jujuzbbtbkk8tdo6... 0 2 Small Started 10.0.0.44
47rntclyak jujugk2ygbnatkhc... 0 0 Small Started 10.0.0.4
51etwr329x juju6329s6bqqao2... 0 0 Small Started 10.0.0.12
51etwr329x jujuuxa3sfxyp12f... 1 1 Small Started 10.0.0.36
@kapilt
kapilt / gist:c65b1dc77f6832c31bff
Created September 10, 2014 13:51
Using pip for an offline install
# Capture all the deps
mkdir dist-cache
pip install -d dist-cache -r requirements.txt
cd ..
tar czvf mypackage-archive.tgz
# Transfer that to a new machine
# On the separate machine in a virtualenv
# Extract tarball and use