bnoyhnumjzrrrfp2gn3emiy
Charmbox
Charmbox is an extension of the jujubox
container which adds tools for development, testing, and review of Juju Charms.
Usage
Juju Inside Docker
If you already have Docker installed (see below), and you don't want to install
Juju on your host machine, the container can be run directly from Docker Hub:
sudo docker run --rm -ti jujusolutions/charmbox
Once inside the container, you can use quickstart to set up Juju with any provider
except local, and use bundletester to test a charm:
$ubuntu@ab3d:~/$ juju quickstart
$ubuntu@ab3d:~/$ bundletester -t cs:trusty/ubuntu
Note that local provider is not currently available within the container,
but it is possible to use an existing local provider with Charmbox (see below).
Using Charmbox with Existing Juju
If you already have Juju configured, you can use your existing Juju installation,
including any environments, with a few extra arguments to the run command:
sudo docker run --rm -ti --net=host -v $HOME/.juju:/home/ubuntu/.juju jujusolutions/charmbox
Using Charmbox with Existing Juju and Local Provider
If you wish to use local provider, you will need to bootstrap from outside
the container, but all subsequent operations will work normally within the
container:
juju switch local
juju bootstrap
sudo docker run --rm --net=host -v $HOME/.juju:/home/ubuntu/.juju -ti charmbox
Once inside the container, you can use bundletester to test a charm:
$ubuntu@ab3d:~/$ bundletester -t lp:~user/charms/trusty/foo/branch
$ubuntu@ab3d:~/$ exit
Once you are done with the container, make sure you destroy the local provider that
you bootstrapped:
juju destroy-environment local
Using Charmbox with Charms on your Host Machine
If you have charms already checked out on your host machine, you can mount the
Juju repository subdirectory:
sudo docker run --rm -ti -v $JUJU_REPOSITORY/trusty:/home/ubuntu/trusty jujusolutions/charmbox
At this time, you cannot directly mount $JUJU_REPOSITORY inside
the container because it would overwrite /home/ubuntu. Thus, it is
recommended that you mount the trusty or precise subdirectories.
Mounting CWD into charmbox for testing
You can map the current working directory into charmbox for testing a single
charm:
sudo docker run --rm -ti -v $(pwd):/home/ubuntu/trusty/{charm} jujusolutions/charmbox
Building Charmbox from Source
git clone https://github.com/juju-solutions/charmbox.git && cd charmbox
sudo docker build -t charmbox .
sudo docker run --rm -ti charmbox
Installing Docker
Linux
Install Docker using the package manager for your distro, or
get.docker.com.
Docker >= 1.4.1 recommended.
OS X
Docker does not run natively in OS X, so we'll need to use VirtualBox
and docker-machine. This is relatively easy for users of brew:
brew install cask
brew cask install virtualbox
brew install docker
brew install docker-machine
docker-machine create -d virtualbox default
docker-machine start default && eval $(docker-machine env default)
When docker-machine finishes, it will prompt you to export Docker
environment variables. With that done, you're ready to use docker.
docker run -ti jujusolutions/charmbox
Building in Docker Cloud's infrastructure... Starting to clone Cloning into '.'... Cloning done Starting Build KernelVersion: 4.4.0-21-generic Os: linux BuildTime: 2016-04-26T23:43:49.174056600+00:00 ApiVersion: 1.23 Version: 1.11.1 GitCommit: 5604cbe Arch: amd64 GoVersion: go1.5.4 Starting build of index.docker.io/jujusolutions/charmbox:devel... Step 1 : FROM jujusolutions/jujubox:devel ---> 2ab31a91abcf Step 2 : VOLUME ["/home/ubuntu/.local/share/juju", "/home/ubuntu/trusty", "/home/ubuntu/xenial", "/home/ubuntu/layers", "/home/ubuntu/interfaces" ---> Running in ce156fe1356e ---> 4599c9d16e00 Removing intermediate container ce156fe1356e Step 3 : RUN apt-get update -qy ---> Running in 6bc07824e617 Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease Hit:2 http://ppa.launchpad.net/juju/devel/ubuntu xenial InRelease Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [94.5 kB] Hit:4 http://ppa.launchpad.net/juju/stable/ubuntu xenial InRelease Hit:5 http://archive.ubuntu.com/ubuntu xenial-security InRelease Get:6 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [281 kB] Get:7 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [121 kB] Fetched 497 kB in 0s (565 kB/s) Reading package lists... ---> 0a63703267a5 Removing intermediate container 6bc07824e617 Step 4 : RUN apt-get install -qy gcc cython git make ---> Running in 2364484780c8 Reading package lists... Building dependency tree... Reading state information... git is already the newest version (1:2.7.4-0ubuntu1). git set to manually installed. make is already the newest version (4.1-6). make set to manually installed. The following additional packages will be installed: cpp Suggested packages: cpp-doc cython-doc gcc-multilib autoconf automake libtool flex bison gdb gcc-doc The following NEW packages will be installed: cpp cython gcc 0 upgraded, 3 newly installed, 0 to remove and 12 not upgraded. Need to get 1560 kB of archives. After this operation, 7452 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu xenial/main amd64 cpp amd64 4:5.3.1-1ubuntu1 [27.7 kB] Get:2 http://archive.ubuntu.com/ubuntu xenial/universe amd64 cython amd64 0.23.4-0ubuntu5 [1527 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 gcc amd64 4:5.3.1-1ubuntu1 [5244 B] [91mdebconf: unable to initialize frontend: Dialog debconf: (TERM is not set, so the dialog frontend is not usable.) [0m[91mdebconf: falling back to frontend: Readline [0m[91mdebconf: unable to initialize frontend: Readline debconf: (This frontend requires a controlling tty.) [0m[91mdebconf: falling back to frontend: Teletype [0m[91mdpkg-preconfigure: unable to re-open stdin: [0mFetched 1560 kB in 0s (2277 kB/s) Selecting previously unselected package cpp. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 24993 files and directories currently installed.) Preparing to unpack .../cpp_4%3a5.3.1-1ubuntu1_amd64.deb ... Unpacking cpp (4:5.3.1-1ubuntu1) ... Selecting previously unselected package cython. Preparing to unpack .../cython_0.23.4-0ubuntu5_amd64.deb ... Unpacking cython (0.23.4-0ubuntu5) ... Selecting previously unselected package gcc. Preparing to unpack .../gcc_4%3a5.3.1-1ubuntu1_amd64.deb ... Unpacking gcc (4:5.3.1-1ubuntu1) ... Setting up cpp (4:5.3.1-1ubuntu1) ... Setting up cython (0.23.4-0ubuntu5) ... Setting up gcc (4:5.3.1-1ubuntu1) ... ---> f649e399be36 Removing intermediate container 2364484780c8 Step 5 : ADD install-review-tools.sh /install-review-tools.sh ---> 8e8d6ee1511e Removing intermediate container c3bd0d98637e Step 6 : RUN /install-review-tools.sh ---> Running in c25499b7d0dc [91mgpg: keyring `/tmp/tmpcnu0x1zp/secring.gpg' created [0m[91mgpg: keyring `/tmp/tmpcnu0x1zp/pubring.gpg' created [0m[91mgpg: requesting key CB4C41BC from hkp server keyserver.ubuntu.com [0m[91mgpg: /tmp/tmpcnu0x1zp/trustdb.gpg: trustdb created [0m[91mgpg: key CB4C41BC: public key "Launchpad PPA for Tim Van Steenburgh" imported [0m[91mgpg: Total number processed: 1 [0m[91mgpg: imported: 1[0m[91m (RSA: 1) [0mOK Reading package lists... Building dependency tree... Reading state information... make is already the newest version (4.1-6). python-dev is already the newest version (2.7.11-1). rsync is already the newest version (3.1.1-3ubuntu1). rsync set to manually installed. charm-tools is already the newest version (2.1.2-0ubuntu4). python-virtualenv is already the newest version (15.0.1+ds-3). python-virtualenv set to manually installed. python-pip is already the newest version (8.1.1-2ubuntu0.1). python-pip set to manually installed. The following additional packages will be installed: g++ g++-5 libstdc++-5-dev Suggested packages: g++-multilib g++-5-multilib gcc-5-doc libstdc++6-5-dbg libstdc++-5-doc zip The following NEW packages will be installed: build-essential g++ g++-5 libstdc++-5-dev unzip 0 upgraded, 5 newly installed, 0 to remove and 12 not upgraded. Need to get 10.0 MB of archives. After this operation, 39.6 MB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libstdc++-5-dev amd64 5.3.1-14ubuntu2.1 [1427 kB] Get:2 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 g++-5 amd64 5.3.1-14ubuntu2.1 [8433 kB] Get:3 http://archive.ubuntu.com/ubuntu xenial/main amd64 g++ amd64 4:5.3.1-1ubuntu1 [1504 B] Get:4 http://archive.ubuntu.com/ubuntu xenial/main amd64 build-essential amd64 12.1ubuntu2 [4758 B] Get:5 http://archive.ubuntu.com/ubuntu xenial/main amd64 unzip amd64 6.0-20ubuntu1 [158 kB] [91mdebconf: unable to initialize frontend: Dialog debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.) [0m[91mdebconf: falling back to frontend: Readline [0m[91mdebconf: unable to initialize frontend: Readline debconf: (This frontend requires a controlling tty.) [0m[91mdebconf: falling back to frontend: Teletype [0m[91mdpkg-preconfigure: unable to re-open stdin: [0mFetched 10.0 MB in 1s (8477 kB/s) Selecting previously unselected package libstdc++-5-dev:amd64. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 25344 files and directories currently installed.) Preparing to unpack .../libstdc++-5-dev_5.3.1-14ubuntu2.1_amd64.deb ... Unpacking libstdc++-5-dev:amd64 (5.3.1-14ubuntu2.1) ... Selecting previously unselected package g++-5. Preparing to unpack .../g++-5_5.3.1-14ubuntu2.1_amd64.deb ... Unpacking g++-5 (5.3.1-14ubuntu2.1) ... Selecting previously unselected package g++. Preparing to unpack .../g++_4%3a5.3.1-1ubuntu1_amd64.deb ... Unpacking g++ (4:5.3.1-1ubuntu1) ... Selecting previously unselected package build-essential. Preparing to unpack .../build-essential_12.1ubuntu2_amd64.deb ... Unpacking build-essential (12.1ubuntu2) ... Selecting previously unselected package unzip. Preparing to unpack .../unzip_6.0-20ubuntu1_amd64.deb ... Unpacking unzip (6.0-20ubuntu1) ... Processing triggers for mime-support (3.59ubuntu1) ... Setting up libstdc++-5-dev:amd64 (5.3.1-14ubuntu2.1) ... Setting up g++-5 (5.3.1-14ubuntu2.1) ... Setting up g++ (4:5.3.1-1ubuntu1) ... update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode Setting up build-essential (12.1ubuntu2) ... Setting up unzip (6.0-20ubuntu1) ... [91mThe directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. [0m[91mThe directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. [0mCollecting bundletester Downloading bundletester-0.7.1.tar.gz Collecting flake8 Downloading flake8-2.6.0-py2.py3-none-any.whl Requirement already up-to-date: pyyaml in /usr/lib/python2.7/dist-packages Collecting tox Downloading tox-2.3.1-py2.py3-none-any.whl (40kB) Requirement already up-to-date: blessings in /usr/lib/python2.7/dist-packages (from bundletester) Collecting charm-tools (from bundletester) Downloading charm-tools-2.1.3.tar.gz (268kB) Collecting coverage (from bundletester) Downloading coverage-4.1.tar.gz (370kB) Collecting juju-deployer>=0.6.0 (from bundletester) Downloading juju-deployer-0.8.0.tar.gz (67kB) Collecting lazr.authentication (from bundletester) Downloading lazr.authentication-0.1.3.tar.gz Collecting mock (from bundletester) Downloading mock-2.0.0-py2.py3-none-any.whl (56kB) Collecting nose (from bundletester) Downloading nose-1.3.7-py2-none-any.whl (154kB) Collecting requests (from bundletester) Downloading requests-2.10.0-py2.py3-none-any.whl (506kB) Collecting simplejson>=3.8.0 (from bundletester) Downloading simplejson-3.8.2.tar.gz (76kB) Collecting websocket-client (from bundletester) Downloading websocket_client-0.37.0.tar.gz (194kB) Collecting pyflakes!=1.2.0,!=1.2.1,!=1.2.2,<1.3,>=0.8.1 (from flake8) Downloading pyflakes-1.2.3-py2.py3-none-any.whl (209kB) Collecting pycodestyle<2.1,>=2.0 (from flake8) Downloading pycodestyle-2.0.0-py2.py3-none-any.whl (42kB) Collecting mccabe<0.6,>=0.2.1 (from flake8) Downloading mccabe-0.5.0-py2.py3-none-any.whl Collecting py>=1.4.17 (from tox) Downloading py-1.4.31-py2.py3-none-any.whl (81kB) Collecting virtualenv>=1.11.2 (from tox) Downloading virtualenv-15.0.2-py2.py3-none-any.whl (1.8MB) Collecting pluggy<0.4.0,>=0.3.0 (from tox) Downloading pluggy-0.3.1-py2.py3-none-any.whl Requirement already up-to-date: launchpadlib in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting argparse (from charm-tools->bundletester) Downloading argparse-1.4.0-py2.py3-none-any.whl Requirement already up-to-date: cheetah in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Requirement already up-to-date: pycrypto in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting paramiko<2.0.0 (from charm-tools->bundletester) Downloading paramiko-1.17.1-py2.py3-none-any.whl (171kB) Requirement already up-to-date: libcharmstore in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting ruamel.yaml (from charm-tools->bundletester) Downloading ruamel.yaml-0.11.11-cp27-cp27mu-manylinux1_x86_64.whl (503kB) Requirement already up-to-date: pathspec in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Requirement already up-to-date: otherstuf in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting path.py (from charm-tools->bundletester) Downloading path.py-8.2.1-py2.py3-none-any.whl Collecting pip (from charm-tools->bundletester) Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB) Requirement already up-to-date: jujubundlelib in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting colander (from charm-tools->bundletester) Downloading colander-1.3.1-py2.py3-none-any.whl (118kB) Requirement already up-to-date: jsonschema in /usr/lib/python2.7/dist-packages (from charm-tools->bundletester) Collecting jujuclient>=0.18 (from juju-deployer>=0.6.0->bundletester) Downloading jujuclient-0.52.0.tar.gz Requirement already up-to-date: six in /usr/lib/python2.7/dist-packages (from juju-deployer>=0.6.0->bundletester) Collecting httplib2 (from lazr.authentication->bundletester) Downloading httplib2-0.9.2.zip (210kB) Requirement already up-to-date: oauth in /usr/lib/python2.7/dist-packages (from lazr.authentication->bundletester) Collecting setuptools (from lazr.authentication->bundletester) Downloading setuptools-23.1.0-py2.py3-none-any.whl (435kB) Collecting wsgi_intercept (from lazr.authentication->bundletester) Downloading wsgi_intercept-1.2.2.tar.gz Collecting zope.interface (from lazr.authentication->bundletester) Downloading zope.interface-4.2.0.tar.gz (146kB) [91mException: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run requirement_set.prepare_files(finder) File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 448, in _prepare_file req_to_install, finder) File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 387, in _check_skip_installed req_to_install.check_if_exists() File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1011, in check_if_exists self.req.project_name AttributeError: 'Requirement' object has no attribute 'project_name' [0m[91mYou are using pip version 8.1.1, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. [0mRemoving intermediate container c25499b7d0dc The command '/bin/sh -c /install-review-tools.sh' returned a non-zero code: 2