Skip to content

Instantly share code, notes, and snippets.

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

Kapil Thangavelu kapilt

🌩️
🌩 📦 🔭 📻 🚀 🛰
View GitHub Profile
"""
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
@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
#!/usr/bin/env python
import argparse
import sys
import logging
from boto.ec2 import regions, connect_to_region
def main():
#!/bin/bash
sudo apt-get install python-virtualenv
virtualenv tosca-dev
source tosca-dev/bin/activate
git clone https://github.com/stackforge/heat-translator.git
# Edit access
git clone git@github.com:juju/juju-tosca.git
#!/usr/bin/python
"""
Simple usage to log into a container via ssh
$ lxc-host -s -n container_name
Simple usage to query the addresses of a container
$ lxc-host -n container_name
kube:
series: trusty
services:
kubernetes-master:
charm: kubernetes-master
flannel:
charm: flannel
num_units: 2
options:
container_type: docker