Updated docker README and a docker-init tweak.
- Legacy-Id: 10500
This commit is contained in:
parent
66411ea795
commit
bfdacef1c0
|
@ -1,74 +1,77 @@
|
||||||
|
|
||||||
====================================================
|
==============================================================================
|
||||||
Datatracker Development in a Docker Container (beta)
|
Datatracker Development in a Docker Container (beta)
|
||||||
====================================================
|
==============================================================================
|
||||||
|
|
||||||
|
|
||||||
Intro
|
Intro
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Docker_ is a set of tools which lets you package software together with its
|
Docker_ is a toolkit which lets you package software together with its
|
||||||
dependencies in lightweight containers, and run it in isolated virtual environments.
|
dependencies in lightweight containers, and run it in isolated virtual
|
||||||
|
environments.
|
||||||
|
|
||||||
During and just after IETF-94 I've spent quite a bit of time setting up a docker
|
During and just after IETF-94 I've spent quite a bit of time setting up a
|
||||||
image which provides the dependencies needed to run the datatracker, and it's now
|
docker image which provides the dependencies needed to run the datatracker,
|
||||||
available for beta testing. Hopefully this should make it substantially easier to
|
and it's now available for beta testing. Hopefully this should make it
|
||||||
get started with datatracker development.
|
substantially easier to get started with datatracker development.
|
||||||
|
|
||||||
Steps
|
Steps
|
||||||
=====
|
=====
|
||||||
|
|
||||||
1. Set up Docker on your preferred platform. Official installers
|
1. Set up Docker on your preferred platform. Official installers exist for
|
||||||
exist for many Linux flavours, OS X, Windows and Cloud services.
|
many Linux flavours, OS X, Windows and Cloud services. Here's the full `List
|
||||||
|
of Installation Instructions`_.
|
||||||
|
|
||||||
Docker containers require the services of an underlying Linux API,
|
Docker containers require the services of an underlying Linux API, which
|
||||||
which means that on OS X and Windows, these have to be provided
|
means that on OS X and Windows, these have to be provided by a virtual
|
||||||
by a virtual machine which runs a minimal Linux image. The virtual
|
machine which runs a minimal Linux image. The virtual machine used on
|
||||||
machine used is commonly VirtualBox, although at least one
|
non-Linux platforms is commonly VirtualBox. On Linux kernels with version
|
||||||
unofficial VM image and controller (boot2docker_) also supports
|
3.8 or later, no virtual machine is needed, as the docker images can be
|
||||||
Parallels, XenServer and VMWare.
|
fully supported with the native kernel services.
|
||||||
|
|
||||||
The primary installers available is the unofficial boot2docker_ and
|
Please follow the Docker installations all the way through to successfully
|
||||||
the official `Docker Engine`_. I've tried both, and at this time,
|
running the ``hello-world`` example in a terminal window ( ``$ docker run
|
||||||
November 2015, boot2docker has worked much better for me than
|
hello-world``).
|
||||||
Docker Engine. YMMV.
|
|
||||||
|
|
||||||
Boot2docker can self-upgrade and provides up-to-date docker server
|
|
||||||
and clients. Run update after you install::
|
|
||||||
|
|
||||||
~ $ boot2docker upgrade
|
|
||||||
|
|
||||||
2. Check out your datatracker branch as usual, in a suitable directory.
|
2. Check out your datatracker branch as usual, in a suitable directory.
|
||||||
We'll assume ``~/src/dt/`` here, and assume you are ``'coder'``::
|
We'll assume ``~/src/dt/`` here, and assume you are ``'coder'``::
|
||||||
|
|
||||||
~/src/dt/ $ svn co https://svn.tools.ietf.org/svn/tools/ietfdb/personal/coder/6.8.2.dev0
|
~/src/dt/ $ svn co https://svn.tools.ietf.org/svn/tools/ietfdb/personal/coder/6.8.2.dev0
|
||||||
|
|
||||||
3. In the checked-out working copy, you'll find a ``data/`` directory
|
3. In the checked-out working copy, you'll find a ``docker/`` directory and a
|
||||||
at the top level. Fetch down a pre-built copy of the datatracker
|
``data/`` directory at the top level. We're first going to set up a copy of
|
||||||
database, place it in this directory, unpack it, and fix permissions::
|
the MySQL database files under the ``data/`` directory.
|
||||||
|
|
||||||
~/src/dt/6.8.2.dev0/data/ $ wget https://www.ietf.org/lib/dt/sprint/ietf_utf8.bin.tar.bz2 .
|
There is a command in the ``docker/`` directory, ``setupdb`` which will do
|
||||||
|
this for you, or you can do it manually.
|
||||||
|
|
||||||
|
Either run::
|
||||||
|
|
||||||
|
~/src/dt/6.8.2.dev0/ $ docker/setupdb
|
||||||
|
|
||||||
|
or do this step-by-step: fetch down a pre-built copy of the datatracker
|
||||||
|
database, place it in the ``data`` directory, unpack it, and fix
|
||||||
|
permissions::
|
||||||
|
|
||||||
|
~/src/dt/6.8.2.dev0/ $ cd data
|
||||||
|
~/src/dt/6.8.2.dev0/data/ $ wget https://www.ietf.org/lib/dt/sprint/ietf_utf8.bin.tar.bz2
|
||||||
~/src/dt/6.8.2.dev0/data/ $ tar xjf ietf_utf8.bin.tar.bz2
|
~/src/dt/6.8.2.dev0/data/ $ tar xjf ietf_utf8.bin.tar.bz2
|
||||||
~/src/dt/6.8.2.dev0/data/ $ chmod -R go+rwX mysql
|
~/src/dt/6.8.2.dev0/data/ $ chmod -R go+rwX mysql
|
||||||
|
|
||||||
4. In the checked-out working copy, you'll also find a ``docker/``
|
|
||||||
directory at the top level. It contains a Dockerfile which can
|
|
||||||
be used to build a docker image, but that doesn't concern us at
|
|
||||||
the moment. We will be using a wrapper script, ``'run'``, to
|
|
||||||
run a pre-built docker image fetched from the docker hub::
|
|
||||||
|
|
||||||
~/src/dt/6.8.2.dev0/docker/ $ ./run
|
4. In the ``docker/`` directory you'll also find a wrapper script named
|
||||||
|
``'run'``. We will be using the wrapper to run a pre-built docker image
|
||||||
|
fetched from the docker hub::
|
||||||
|
|
||||||
This will pull down the latest docker datatracker image, start it
|
~/src/dt/6.8.2.dev0/ $ docker/run
|
||||||
up with appropriate settings, map the internal ``/var/lib/mysql/``
|
|
||||||
directory to the external ``data/mysql/`` directory where we placed
|
|
||||||
the database, set up a python virtualenv for you, install some
|
|
||||||
dependencies, and drop you in a bash shell where you can run the
|
|
||||||
datatracker.
|
|
||||||
|
|
||||||
5. Make sure that all requirements are installed::
|
This will pull down the latest docker ietf/datatracker-environment image,
|
||||||
|
start it up with appropriate settings, map the internal ``/var/lib/mysql/``
|
||||||
(virtual) $ cd ~/src/dt/6.8.2.dev0
|
directory to the external ``data/mysql/`` directory where we placed the
|
||||||
(virtual) $ pip install -r requirements.txt
|
database, set up a python virtualenv for you, install some dependencies,
|
||||||
|
and drop you in a bash shell where you can run the datatracker.
|
||||||
|
|
||||||
6. You are now ready to run the tests::
|
6. You are now ready to run the tests::
|
||||||
|
|
||||||
|
@ -78,21 +81,18 @@ Steps
|
||||||
|
|
||||||
(virtual) $ ietf/manage.py runserver 0.0.0.0:8000
|
(virtual) $ ietf/manage.py runserver 0.0.0.0:8000
|
||||||
|
|
||||||
Note the IP address ``0.0.0.0`` used to make the dev server bind
|
Note the IP address ``0.0.0.0`` used to make the dev server bind to all
|
||||||
to all addresses. The internal port 8000 has been mapped to port
|
addresses. The internal port 8000 has been mapped to port 8000 externally,
|
||||||
8000 externally, too. In order to find the IP address of the
|
too. In order to find the IP address of the VirtualBox, run ``'$
|
||||||
VirtualBox, run ``'$ boot2docker ip'`` or equivalent *outside* the
|
docker-machine ip'`` *outside* the virtual environment::
|
||||||
virtual environment::
|
|
||||||
|
|
||||||
~/src/dt/6.8.2.dev0/ $ boot2docker ip
|
~/src/dt/6.8.2.dev0/ $ docker-machine ip
|
||||||
192.168.59.103
|
192.168.59.103
|
||||||
|
|
||||||
~/src/dt/6.8.2.dev0/ $ open http://192.168.59.103:8000/
|
~/src/dt/6.8.2.dev0/ $ open http://192.168.59.103:8000/
|
||||||
|
|
||||||
|
|
||||||
.. _Docker: https://www.docker.com/
|
.. _Docker: https://www.docker.com/
|
||||||
.. _`Docker Engine`: https://docs.docker.com/engine/installation/
|
.. _`List of Installation Instructions`: https://docs.docker.com/v1.8/installation/
|
||||||
.. _boot2docker: http://boot2docker.io/
|
|
||||||
.. _VirtualBox: https://www.virtualbox.org/
|
.. _VirtualBox: https://www.virtualbox.org/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -100,4 +100,4 @@ cd /home/$USER/$CWD || cd /home/$USER/
|
||||||
|
|
||||||
echo "Done!"
|
echo "Done!"
|
||||||
|
|
||||||
su $USER "$@"
|
su $USER
|
||||||
|
|
Loading…
Reference in a new issue