Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
jamesbeedy / .bashrc
Last active January 19, 2017 16:52
.bashrc bit for .juju_context.py
#!/bin/bash
# ~/.bashrc or ~/.profile
function show_juju_env {
local currentEnv
currentEnv=`~/.juju_context.py`
printf "%s" "$currentEnv"
}
export PS1="[\[\e[38;5;70m\]\$(show_juju_env)\[\e[0m\]] ${PS1}";
@jamesbeedy
jamesbeedy / simple_juju_action.py
Last active January 18, 2017 20:17
simple_juju_action.py
#!/usr/bin/env python3.5
# This code runs a custom action called update-app
# on all units of app-web and app-worker applications
# Must have the following environment vars available
# - JUJU_USER
# - JUJU_PASSWORD
# - CONTROLLER_ENDPOINT
# - MODEL_UUID
# - GIT_COMMIT
@jamesbeedy
jamesbeedy / etc_security_limits.conf
Created February 3, 2017 19:30
lxd_production_security_limits.conf
* soft nofile 1048576
* hard nofile 1048576
root soft nofile 1048576
root soft nofile 1048576
* soft memlock unlimited
* hard memlock unlimited
@jamesbeedy
jamesbeedy / etc_sysctl.conf
Created February 3, 2017 19:30
lxd_production_sysctl.conf
fs.inotify.max_queued_events=1048576
fs.inotify.max_user_watches=1048576
vm.max_map_count=262144
fs.file-max = 999999999
fs.inotify.max_user_instances = 999999999
@jamesbeedy
jamesbeedy / confd-custom.service
Created February 14, 2017 17:45
confd-custom.service
[Unit]
Description=Confd Configuration Util
[Service]
User=root
Group=root
ExecStart=/usr/bin/confd -backend env -onetime
[Install]
WantedBy=multi-user.target
#!/bin/bash
#
# This script will create xenial and trusty lxd images that will be used by the
# lxd provider in juju 2.1+ It is for use with the lxd provider for local
# development and preinstalls a common set of production packages.
#
# This is important, as between them, basenode and layer-basic install ~111
# packages, before we even get to any packages installed by your charm.
#
# It also installs some helpful development tools, and pre-downloads some
services:
haproxy:
series: xenial
charm: cs:haproxy-40
num_units: 1
options:
ssl_key: |
...mykey...
ssl_cert: |
...mycert...
@jamesbeedy
jamesbeedy / haproxy-config.yaml
Created March 13, 2017 18:17
haproxy-charm-config
haproxy:
charm: haproxy
constraints: cpu-cores=1 mem={{standard_ram}}
num_units: {{standard_units}}
expose: True
options:
enable_monitoring: true
ssl_cert: include-base64://{{local_dir}}/staging.review.jujucharms.com.crt
ssl_key: include-base64://{{local_dir}}/staging.review.jujucharms.com.key
services: |
@jamesbeedy
jamesbeedy / newrelic-plugin-agent.cfg
Last active March 20, 2017 17:49
newrelic-plugin-agent template for elasticsearch integration charm
%YAML 1.2
---
Application:
license_key: {{license_key}}
wake_interval: 60
elasticsearch:
name: {{cluster_name}}
host: localhost
port: 9200
@jamesbeedy
jamesbeedy / Vagrantfile
Created May 2, 2017 14:34
vagrant libvirtd + lxdbr0
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "opensuse/openSUSE-42.1-x86_64"
config.vm.provider :libvirt do |libvirt|
libvirt.driver = "qemu"
end