Skip to content

Instantly share code, notes, and snippets.

View AdamIsrael's full-sized avatar

Adam Israel AdamIsrael

View GitHub Profile

Keybase proof

I hereby claim:

  • I am adamisrael on github.
  • I am adamisrael (https://keybase.io/adamisrael) on keybase.
  • I have a public key whose fingerprint is 349E 77EC BFC2 2615 EB55 ACD5 5E30 ADF7 9AA5 6F13

To claim this, I am signing this object:

@AdamIsrael
AdamIsrael / README.md
Last active August 29, 2015 14:11
Vagrantfile to route network traffic w/o sshuttle

Juju Vagrant without sshuttle.

sshuttle allows traffic to be routed to the internal network (10.0.3.0) used for the lxc containers inside a Juju Vagrant image. sshuttle does not work with OS X 10.10 (Yosemite). This alternate solution alters your local network routing rules in order to communicate directly with the virtual machine over its vboxnet0 bridge. It's also faster than using sshuttle, because it doesn't need to proxy over an SSH tunnel or teardown/reassemble the TCP packets.

This approach adds and removes the route when a virtual machine is brought up and taken down, and requires sudo at each step. Alternatively, you could add this route at boot or via login script.

Installation

You'll need to have the triggers plugin installed for this to work.

# Notes
I removed my previously-installed charm-tools but didn't clean up so I had to run `brew link` afterwards.
@AdamIsrael
AdamIsrael / gist:7ead3157593f87b98de9
Created March 25, 2015 00:49
Generate yaml for haproxy charm
#!/usr/bin/env python
import json
service = [
{
'service_name': 'demo',
'service_options': ['mode http', 'balance leastconn', 'option httpchk GET / HTTP/1.0'],
'server_options': ['maxconn 100'],
'servers': [
[
@AdamIsrael
AdamIsrael / gist:7ad1a5dd86f395060223
Last active August 29, 2015 14:17
This is the Vagrantfile I use for my day-to-day work for Juju development and testing.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "trusty/juju"
$ juju status --debug
2015-05-22 03:52:09 INFO juju.cmd supercommand.go:37 running juju [1.24-beta4-trusty-amd64 gc]
2015-05-22 03:52:09 DEBUG juju.api api.go:168 trying cached API connection settings - endpoints [localhost:17070 10.0.2.15:17070 10.0.3.1:17070 172.16.250.15:17070]
2015-05-22 03:52:09 INFO juju.api api.go:280 connecting to API addresses: [localhost:17070 10.0.2.15:17070 10.0.3.1:17070 172.16.250.15:17070]
2015-05-22 03:52:09 INFO juju.api apiclient.go:331 dialing "wss://localhost:17070/environment/8bfca804-7bb2-48c7-8316-a355046f7546/api"
2015-05-22 03:52:09 DEBUG juju.api apiclient.go:337 error dialing "wss://localhost:17070/environment/8bfca804-7bb2-48c7-8316-a355046f7546/api", will retry: websocket.Dial wss://localhost:17070/environment/8bfca804-7bb2-48c7-8316-a355046f7546/api: dial tcp 127.0.0.1:17070: connection refused
2015-05-22 03:52:11 INFO juju.api apiclient.go:331 dialing "wss://localhost:17070/environment/8bfca804-7bb2-48c7-8316-a355046f7546/api"
2015-05-22 03:52:11 DEBUG juju.api
@AdamIsrael
AdamIsrael / gist:b97ef47ebecb82219dce
Created May 22, 2015 03:56
juju status -- post-restart
$ juju status
environment: local
machines:
"0":
agent-state: started
agent-version: 1.24-beta3.1
dns-name: localhost
instance-id: localhost
series: trusty
state-server-member-status: has-vote
2015-05-22 03:39:36 INFO juju.cmd supercommand.go:37 running jujud [1.24-beta3.1-trusty-amd64 gc]
2015-05-22 03:39:36 DEBUG juju.agent agent.go:425 read agent config, format "1.18"
2015-05-22 03:39:36 INFO juju.cmd.jujud machine.go:384 machine agent machine-0 start (1.24-beta3.1-trusty-amd64 [gc])
2015-05-22 03:39:36 DEBUG juju.wrench wrench.go:112 couldn't read wrench directory: stat /var/lib/juju/wrench: no such file or directory
2015-05-22 03:39:36 INFO juju.cmd.jujud upgrade.go:87 no upgrade steps required or upgrade steps for 1.24-beta3.1 have already been run.
2015-05-22 03:39:36 INFO juju.network network.go:194 setting prefer-ipv6 to false
2015-05-22 03:39:36 INFO juju.worker runner.go:261 start "api"
2015-05-22 03:39:36 INFO juju.worker runner.go:261 start "statestarter"
2015-05-22 03:39:36 INFO juju.api apiclient.go:331 dialing "wss://localhost:17070/environment/8bfca804-7bb2-48c7-8316-a355046f7546/api"
2015-05-22 03:39:36 INFO juju.worker runner.go:261 start "termination"

!WIP!

This is a work-in-progress bug report.

Steps to recreate

Open new terminal and run:

debug-wait.sh

In another terminal and run:

@AdamIsrael
AdamIsrael / ingest_charm.py
Last active April 17, 2019 21:14
Ingest a charm into gitlab and perform some common review queue steps
#!/usr/bin/env python
"""
Setup notes:
Git needs to be configured on the machine doing the ingestion.
git config --global user.name "Administrator"
git config --global user.email "admin@example.com"
In Gitlab: