Skip to content

Instantly share code, notes, and snippets.

View marcoceppi's full-sized avatar
.

Marco Ceppi marcoceppi

.
View GitHub Profile
@marcoceppi
marcoceppi / create-registry.sh
Last active October 11, 2017 19:30 — forked from ajbouh/create-registry.sh
Create a private Docker registry on a fresh Kubernetes Cluster
set -ex
REGISTRY_INGRESS_IP=10.73.177.23
REGISTRY_INGRESS_HOSTNAME=registry.$REGISTRY_INGRESS_IP.xip.io
REQ_CN=10.73.177.126
# if [ ! -e $REGISTRY_INGRESS_HOSTNAME.key ]; then
# echo '{"CN":"'$REGISTRY_INGRESS_HOSTNAME'","hosts":[""],"key":{"algo":"rsa","size":2048}}' | cfssl gencert -config=ca-config.json -ca=ca.pem -ca-key=ca-key.pem -hostname="$REGISTRY_INGRESS_HOSTNAME" - | cfssljson -bare $REGISTRY_INGRESS_HOSTNAME
# fi

Assumptions: the charm name is fluentd

Submitting a layered charm

Register an account on launchpad, if you don't already have one. You'll need the name later in the process.

  1. Create a launchpad branch of the deployable charm
[~/charms/layers/fluentd] $ charm build
@when('leadership.is_leader')
def add_leader_config():
render_master_config()
@when_not('leadership.is_leader')
def add_slave_config():
render_slave_config()
@when('leadership.is_leader')
@marcoceppi
marcoceppi / my-openstack.yaml
Last active October 6, 2015 22:57 — forked from jamesbeedy/stack-up.sh
stack-up.sh
services:
rabbitmq-server:
charm: cs:trusty/rabbitmq-server
options:
management_plugin: 'true'
to:
- lxc:10
ceilometer:
charm: ceilometer
options:

Testing Juju Charms with Vagrant

Notes:

Place the vagrant file in your $CHARM_DIR root. This may move at a later date, but for internal testing, just put it there and stop fighting me on this.

Also fetch the supporting juju-vagrant-setup.sh script - this is the driver behind the vagrant automation until we find a better process to execute the code. Embedding bash inline in a yaml file is supported: but the yaml parser chokes if you have #'s inline. It interprets the rest of the line as a comment regardless of scope. end. of. story.

Instructions on Use:

@marcoceppi
marcoceppi / looking.py
Last active August 29, 2015 13:55 — forked from lazypower/looking.py
def validate_database_relationship():
#Connect to the sentrys and fetch the transmitted details
sent_config = d.sentry.unit['mysql/0'].relation('db', 'owncloud:db')
#Connect to owncloud's sentry and read the configuration PHP file
prod_config = d.sentry.unit['owncloud/0'].file_contents('/var/www/owncloud/config/config.php')
cfg_to_check = {'dbuser': 'user', 'dbpass': 'password', 'dbhost': 'host'}
for cfg_file_key, juju_cfg_key in cfg_to_check.items():
#Search the return string of the config for the transmit values
if prod_config.find("'%s' => '%s'" % (cfg_file_key, sent_config[juju_cfg_key]) == -1:
#!/usr/bin/python3
import amulet
d = amulet.Deployment()
d.add('mysql')
d.add('wordpress', units=3)
d.relate('mysql:db', 'wordpress:db')
d.configure('wordpress', tuning='bare')
@marcoceppi
marcoceppi / install
Created November 3, 2011 14:16 — forked from mmm/install
sun java on ubuntu
#!/bin/bash
juju-log "Adding Canonical Partner repository"
RELEASE_CODE=`lsb_release -sc`
add-apt-repository "deb http://archive.canonical.com/ ${RELEASE_CODE} partner"
apt-get update
apt-get -y install -qq --no-install-recommends debconf-utils
echo "sun-java6-plugin shared/accepted-sun-dlj-v1-1 boolean true" | debconf-set-selections
<html>
<head>
<style type="text/css">
.border{
border: 2px solid #000;
width: 605px;
overflow: hidden;
}
.steps {
border: 1px dashed #c0c0c0;
@marcoceppi
marcoceppi / foo.js
Created April 15, 2011 11:56 — forked from lazypower/foo.js
function EmbedVid(someID)
{
html = $('#embed-template').clone();
html.attr('flashvars','value="file=upload/' + someID + '.flv&amp;image=images/vidThumbs/' + someID + '.jpg"');
html.find('embed').attr('flashvars','file=upload/' + someID + '.flv&amp;image=images/vidThumbs/' + someID + '.jpg"');
// better clear the video holder
$('#video-holder').empty();
$('#video-holder').append(html);
}