11
2- ====================================================
3- Datatracker Development in a Docker Container (beta)
4- ====================================================
2+ ==============================================================================
3+ Datatracker Development in a Docker Container (beta)
4+ ==============================================================================
5+
56
67Intro
78=====
89
9- Docker _ is a set of tools which lets you package software together with its
10- dependencies in lightweight containers, and run it in isolated virtual environments.
10+ Docker _ is a toolkit which lets you package software together with its
11+ dependencies in lightweight containers, and run it in isolated virtual
12+ environments.
1113
12- During and just after IETF-94 I've spent quite a bit of time setting up a docker
13- image which provides the dependencies needed to run the datatracker, and it's now
14- available for beta testing. Hopefully this should make it substantially easier to
15- get started with datatracker development.
14+ During and just after IETF-94 I've spent quite a bit of time setting up a
15+ docker image which provides the dependencies needed to run the datatracker,
16+ and it's now available for beta testing. Hopefully this should make it
17+ substantially easier to get started with datatracker development.
1618
1719Steps
1820=====
1921
20- 1. Set up Docker on your preferred platform. Official installers
21- exist for many Linux flavours, OS X, Windows and Cloud services.
22-
23- Docker containers require the services of an underlying Linux API,
24- which means that on OS X and Windows, these have to be provided
25- by a virtual machine which runs a minimal Linux image. The virtual
26- machine used is commonly VirtualBox, although at least one
27- unofficial VM image and controller (boot2docker _) also supports
28- Parallels, XenServer and VMWare.
22+ 1. Set up Docker on your preferred platform. Official installers exist for
23+ many Linux flavours, OS X, Windows and Cloud services. Here's the full `List
24+ of Installation Instructions `_.
2925
30- The primary installers available is the unofficial boot2docker _ and
31- the official `Docker Engine `_. I've tried both, and at this time,
32- November 2015, boot2docker has worked much better for me than
33- Docker Engine. YMMV.
26+ Docker containers require the services of an underlying Linux API, which
27+ means that on OS X and Windows, these have to be provided by a virtual
28+ machine which runs a minimal Linux image. The virtual machine used on
29+ non-Linux platforms is commonly VirtualBox. On Linux kernels with version
30+ 3.8 or later, no virtual machine is needed, as the docker images can be
31+ fully supported with the native kernel services.
3432
35- Boot2docker can self-upgrade and provides up-to-date docker server
36- and clients. Run update after you install::
33+ Please follow the Docker installations all the way through to successfully
34+ running the ``hello-world `` example in a terminal window ( ``$ docker run
35+ hello-world ``).
3736
38- ~ $ boot2docker upgrade
3937
40382. Check out your datatracker branch as usual, in a suitable directory.
4139 We'll assume ``~/src/dt/ `` here, and assume you are ``'coder' ``::
4240
4341 ~/src/dt/ $ svn co https://svn.tools.ietf.org/svn/tools/ietfdb/personal/coder/6.8.2.dev0
4442
45- 3. In the checked-out working copy, you'll find a ``data/ `` directory
46- at the top level. Fetch down a pre-built copy of the datatracker
47- database, place it in this directory, unpack it, and fix permissions::
43+ 3. In the checked-out working copy, you'll find a ``docker/ `` directory and a
44+ ``data/ `` directory at the top level. We're first going to set up a copy of
45+ the MySQL database files under the ``data/ `` directory.
46+
47+ There is a command in the ``docker/ `` directory, ``setupdb `` which will do
48+ this for you, or you can do it manually.
49+
50+ Either run::
4851
49- ~/src/dt/6.8.2.dev0/data/ $ wget https://www.ietf.org/lib/dt/sprint/ietf_utf8.bin.tar.bz2 .
52+ ~/src/dt/6.8.2.dev0/ $ docker/setupdb
53+
54+ or do this step-by-step: fetch down a pre-built copy of the datatracker
55+ database, place it in the ``data `` directory, unpack it, and fix
56+ permissions::
57+
58+ ~/src/dt/6.8.2.dev0/ $ cd data
59+ ~/src/dt/6.8.2.dev0/data/ $ wget https://www.ietf.org/lib/dt/sprint/ietf_utf8.bin.tar.bz2
5060 ~/src/dt/6.8.2.dev0/data/ $ tar xjf ietf_utf8.bin.tar.bz2
5161 ~/src/dt/6.8.2.dev0/data/ $ chmod -R go+rwX mysql
5262
53- 4. In the checked-out working copy, you'll also find a ``docker/ ``
54- directory at the top level. It contains a Dockerfile which can
55- be used to build a docker image, but that doesn't concern us at
56- the moment. We will be using a wrapper script, ``'run' ``, to
57- run a pre-built docker image fetched from the docker hub::
5863
59- ~/src/dt/6.8.2.dev0/docker/ $ ./run
64+ 4. In the ``docker/ `` directory you'll also find a wrapper script named
65+ ``'run' ``. We will be using the wrapper to run a pre-built docker image
66+ fetched from the docker hub::
6067
61- This will pull down the latest docker datatracker image, start it
62- up with appropriate settings, map the internal ``/var/lib/mysql/ ``
63- directory to the external ``data/mysql/ `` directory where we placed
64- the database, set up a python virtualenv for you, install some
65- dependencies, and drop you in a bash shell where you can run the
66- datatracker.
68+ ~/src/dt/6.8.2.dev0/ $ docker/run
6769
68- 5. Make sure that all requirements are installed::
69-
70- (virtual) $ cd ~/src/dt/6.8.2.dev0
71- (virtual) $ pip install -r requirements.txt
70+ This will pull down the latest docker ietf/datatracker-environment image,
71+ start it up with appropriate settings, map the internal ``/var/lib/mysql/ ``
72+ directory to the external ``data/mysql/ `` directory where we placed the
73+ database, set up a python virtualenv for you, install some dependencies,
74+ and drop you in a bash shell where you can run the datatracker.
7275
73766. You are now ready to run the tests::
7477
@@ -78,21 +81,18 @@ Steps
7881
7982 (virtual) $ ietf/manage.py runserver 0.0.0.0:8000
8083
81- Note the IP address ``0.0.0.0`` used to make the dev server bind
82- to all addresses. The internal port 8000 has been mapped to port
83- 8000 externally, too. In order to find the IP address of the
84- VirtualBox, run ``'$ boot2docker ip'`` or equivalent *outside* the
85- virtual environment::
84+ Note the IP address ``0.0.0.0`` used to make the dev server bind to all
85+ addresses. The internal port 8000 has been mapped to port 8000 externally,
86+ too. In order to find the IP address of the VirtualBox, run ``'$
87+ docker-machine ip'`` *outside* the virtual environment::
8688
87- ~/src/dt/6.8.2.dev0/ $ boot2docker ip
89+ ~/src/dt/6.8.2.dev0/ $ docker-machine ip
8890 192.168.59.103
8991
9092 ~/src/dt/6.8.2.dev0/ $ open http://192.168.59.103:8000/
9193
92-
9394.. _Docker : https://www.docker.com/
94- .. _`Docker Engine` : https://docs.docker.com/engine/installation/
95- .. _boot2docker : http://boot2docker.io/
95+ .. _`List of Installation Instructions` : https://docs.docker.com/v1.8/installation/
9696.. _VirtualBox : https://www.virtualbox.org/
9797
9898
0 commit comments