This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://get.docker.com | bash -x | |
curl -L https://github.com/docker/compose/releases/download/1.6.2/docker-compose-$(uname -s)-$(uname -m) > /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
mkdir -p certs && openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt -subj "/C=US/ST=California/O=ENG/CN=$(hostname -f)" | |
# get hostname -f output from above | |
docker run -d -p 5000:5000 --restart=always --name registry -v $(pwd)/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key registry:2 | |
# To use this registry on all other docker engine | |
# mkdir -p /etc/docker/certs.d/<hostname-f-from-above>:5000 | |
# copy certs/domain.crt /etc/docker/certs.d/<hostname-f-from-above>:5000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir -p certs && openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt -subj "/C=US/ST=California/O=ENG/CN=$(hostname -f)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import cgitb | |
import cStringIO | |
from vnc_api.vnc_api import * | |
class MigrateServices(object): | |
def __init__(self, args=None): | |
self.vnc_lib = VncApi('admin', '<password>', 'admin', '127.0.0.1', 8082) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import cgitb | |
import cStringIO | |
from vnc_api.vnc_api import * | |
class MigrateServices(object): | |
def __init__(self, args=None): | |
self.vnc_lib = VncApi('admin', '<password>', 'admin', '127.0.0.1', 8082) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# e.g pycassaShell -H <db-node-ip> -f db_in_json.py | sed -e '1,/contents:/d' | python -m json.tool | |
from pprint import pprint | |
import json | |
import kazoo.client | |
db_contents = {'cassandra': {}, | |
'zookeeper': {}} | |
cassandra_contents = db_contents['cassandra'] | |
for ks_name in ['config_db_uuid', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allows you to use docker-compose-exec {service} {command} to run a command on the service | |
docker_compose_exec() { | |
docker exec -it $(docker-compose -f compose.yml -p $(basename $PWD) ps | grep $1 | awk '{print $1}') ${@:2} | |
} | |
alias docker-compose-exec=docker_compose_exec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netaddr | |
import kazoo.client | |
from vnc_api import vnc_api | |
| |
lib = vnc_api.VncApi() | |
| |
zk = kazoo.client.KazooClient('localhost:2181') | |
zk.start() | |
| |
def get_zk_node_path(vn_obj, ip_addr): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: python db-json-exim.py --import-from /import-data/db.json | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('UTF8') | |
import logging | |
import argparse | |
import gzip | |
import json | |
import cgitb | |
import gevent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from vnc_api import vnc_api | |
username = os.environ['OS_USERNAME'] | |
password = os.environ['OS_PASSWORD'] | |
tenant_name = os.environ['OS_TENANT_NAME'] | |
lib = vnc_api.VncApi( | |
username=username, password=password, tenant_name=tenant_name) | |
for vn_obj in lib.virtual_networks_list(detail=True): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Example Usage: | |
# ./shell.py "ls /" quit | |
# ./shell.py "ls /project" quit | |
# ./shell.py "ls /project/default-domain:default-project" quit | |
# ./shell.py "ls /project/default-domain:default-project/virtual_networks" quit | |
# ./shell.py "cat /project/default-domain:default-project" quit | |
# ./shell.py "cat -p /project/default-domain:default-project" quit | |
# ./shell.py "cat /project/default-domain:admin/virtual_networks/default-domain:default-project:default-virtual-network" quit |