Merge "[docs] Make heading levels consistent"
[yardstick.git] / docs / testing / user / userguide / 04-installation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International
2    License.
3    http://creativecommons.org/licenses/by/4.0
4    (c) OPNFV, Ericsson AB, Huawei Technologies Co.,Ltd and others.
5
6
7    Convention for heading levels in Yardstick documentation:
8    =======  Heading 0 (reserved for the title in a document)
9    -------  Heading 1
10    ^^^^^^^  Heading 2
11    +++++++  Heading 3
12    '''''''  Heading 4
13
14    Avoid deeper levels because they do not render well.
15
16 ..
17    Convention for heading levels in Yardstick documentation:
18
19    =======  Heading 0 (reserved for the title in a document)
20    -------  Heading 1
21    ~~~~~~~  Heading 2
22    +++++++  Heading 3
23    '''''''  Heading 4
24
25    Avoid deeper levels because they do not render well.
26
27 ======================
28 Yardstick Installation
29 ======================
30
31 Yardstick supports installation by Docker or directly in Ubuntu. The
32 installation procedure for Docker and direct installation are detailed in
33 the sections below.
34
35 To use Yardstick you should have access to an OpenStack environment, with at
36 least Nova, Neutron, Glance, Keystone and Heat installed.
37
38 The steps needed to run Yardstick are:
39
40 1. Install Yardstick.
41 2. Load OpenStack environment variables.
42 3. Create Yardstick flavor.
43 4. Build a guest image and load it into the OpenStack environment.
44 5. Create the test configuration ``.yaml`` file and run the test case/suite.
45
46
47 Prerequisites
48 -------------
49
50 The OPNFV deployment is out of the scope of this document and can be found in
51 `User Guide & Configuration Guide`_. The OPNFV platform is considered as the
52 System Under Test (SUT) in this document.
53
54 Several prerequisites are needed for Yardstick:
55
56 1. A Jumphost to run Yardstick on
57 2. A Docker daemon or a virtual environment installed on the Jumphost
58 3. A public/external network created on the SUT
59 4. Connectivity from the Jumphost to the SUT public/external network
60
61 .. note:: *Jumphost* refers to any server which meets the previous
62    requirements. Normally it is the same server from where the OPNFV
63    deployment has been triggered.
64
65 .. warning:: Connectivity from Jumphost is essential and it is of paramount
66    importance to make sure it is working before even considering to install
67    and run Yardstick. Make also sure you understand how your networking is
68    designed to work.
69
70 .. note:: If your Jumphost is operating behind a company http proxy and/or
71    Firewall, please first consult `Proxy Support`_ section which is towards
72    the end of this document. That section details some tips/tricks which *may*
73    be of help in a proxified environment.
74
75
76 Install Yardstick using Docker (first option) (**recommended**)
77 ---------------------------------------------------------------
78
79 Yardstick has a Docker image. It is recommended to use this Docker image to run
80 Yardstick test.
81
82 Prepare the Yardstick container
83 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84
85 Install docker on your guest system with the following command, if not done
86 yet::
87
88    wget -qO- https://get.docker.com/ | sh
89
90 Pull the Yardstick Docker image (``opnfv/yardstick``) from the public dockerhub
91 registry under the OPNFV account in dockerhub_, with the following docker
92 command::
93
94    sudo -EH docker pull opnfv/yardstick:stable
95
96 After pulling the Docker image, check that it is available with the
97 following docker command::
98
99    [yardsticker@jumphost ~]$ docker images
100    REPOSITORY         TAG       IMAGE ID        CREATED      SIZE
101    opnfv/yardstick    stable    a4501714757a    1 day ago    915.4 MB
102
103 Run the Docker image to get a Yardstick container::
104
105    docker run -itd --privileged -v /var/run/docker.sock:/var/run/docker.sock \
106       -p 8888:5000 --name yardstick opnfv/yardstick:stable
107
108 Description of the parameters used with ``docker run`` command
109
110   +------------------------+--------------------------------------------------+
111   | Parameters             | Detail                                           |
112   +========================+==================================================+
113   | -itd                   |  -i: interactive, Keep STDIN open even if not    |
114   |                        |  attached                                        |
115   |                        +--------------------------------------------------+
116   |                        |  -t: allocate a pseudo-TTY detached mode, in the |
117   |                        |  background                                      |
118   +------------------------+--------------------------------------------------+
119   | --privileged           | If you want to build ``yardstick-image`` in      |
120   |                        | Yardstick container, this parameter is needed    |
121   +------------------------+--------------------------------------------------+
122   | -p 8888:5000           | Redirect the a host port (8888) to a container   |
123   |                        | port (5000)                                      |
124   +------------------------+--------------------------------------------------+
125   | -v /var/run/docker.sock| If you want to use yardstick env                 |
126   | :/var/run/docker.sock  | grafana/influxdb to create a grafana/influxdb    |
127   |                        | container out of Yardstick container             |
128   +------------------------+--------------------------------------------------+
129   | --name yardstick       | The name for this container                      |
130   +------------------------+--------------------------------------------------+
131
132
133 If the host is restarted
134 ^^^^^^^^^^^^^^^^^^^^^^^^
135
136 The yardstick container must be started if the host is rebooted::
137
138     docker start yardstick
139
140 Configure the Yardstick container environment
141 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142
143 There are three ways to configure environments for running Yardstick, explained
144 in the following sections. Before that, access the Yardstick container::
145
146    docker exec -it yardstick /bin/bash
147
148 and then configure Yardstick environments in the Yardstick container.
149
150 Using the CLI command ``env prepare`` (first way) (**recommended**)
151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
152
153 In the Yardstick container, the Yardstick repository is located in the
154 ``/home/opnfv/repos`` directory. Yardstick provides a CLI to prepare OpenStack
155 environment variables and create Yardstick flavor and guest images
156 automatically::
157
158    yardstick env prepare
159
160 .. note:: Since Euphrates release, the above command will not be able to
161   automatically configure the ``/etc/yardstick/openstack.creds`` file. So before
162   running the above command, it is necessary to create the
163   ``/etc/yardstick/openstack.creds`` file and save OpenStack environment
164   variables into it manually. If you have the openstack credential file saved
165   outside the Yardstick Docker container, you can do this easily by mapping the
166   credential file into Yardstick container using::
167
168      '-v /path/to/credential_file:/etc/yardstick/openstack.creds'
169
170   when running the Yardstick container. For details of the required OpenStack
171   environment variables please refer to section `Export OpenStack environment
172   variables`_.
173
174 The ``env prepare`` command may take up to 6-8 minutes to finish building
175 yardstick-image and other environment preparation. Meanwhile if you wish to
176 monitor the env prepare process, you can enter the Yardstick container in a new
177 terminal window and execute the following command::
178
179   tail -f /var/log/yardstick/uwsgi.log
180
181
182 Manually exporting the env variables and initializing OpenStack (second way)
183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
184
185 Export OpenStack environment variables
186 ''''''''''''''''''''''''''''''''''''''
187
188 Before running Yardstick it is necessary to export OpenStack environment
189 variables::
190
191    source openrc
192
193 Environment variables in the ``openrc`` file have to include at least::
194
195    OS_AUTH_URL
196    OS_USERNAME
197    OS_PASSWORD
198    OS_PROJECT_NAME
199    EXTERNAL_NETWORK
200
201 A sample ``openrc`` file may look like this::
202
203   export OS_PASSWORD=console
204   export OS_PROJECT_NAME=admin
205   export OS_AUTH_URL=http://172.16.1.222:35357/v2.0
206   export OS_USERNAME=admin
207   export OS_VOLUME_API_VERSION=2
208   export EXTERNAL_NETWORK=net04_ext
209
210
211 Manual creation of Yardstick flavor and guest images
212 ''''''''''''''''''''''''''''''''''''''''''''''''''''
213
214 Before executing Yardstick test cases, make sure that Yardstick flavor and
215 guest image are available in OpenStack. Detailed steps about creating the
216 Yardstick flavor and building the Yardstick guest image can be found below.
217
218 Most of the sample test cases in Yardstick are using an OpenStack flavor called
219 ``yardstick-flavor`` which deviates from the OpenStack standard ``m1.tiny``
220 flavor by the disk size; instead of 1GB it has 3GB. Other parameters are the
221 same as in ``m1.tiny``.
222
223 Create ``yardstick-flavor``::
224
225    openstack flavor create --disk 3 --vcpus 1 --ram 512 --swap 100 \
226       yardstick-flavor
227
228 Most of the sample test cases in Yardstick are using a guest image called
229 ``yardstick-image`` which deviates from an Ubuntu Cloud Server image
230 containing all the required tools to run test cases supported by Yardstick.
231 Yardstick has a tool for building this custom image. It is necessary to have
232 ``sudo`` rights to use this tool.
233
234 Also you may need install several additional packages to use this tool, by
235 follwing the commands below::
236
237    sudo -EH apt-get update && sudo -EH apt-get install -y qemu-utils kpartx
238
239 This image can be built using the following command in the directory where
240 Yardstick is installed::
241
242    export YARD_IMG_ARCH='amd64'
243    echo "Defaults env_keep += \'YARD_IMG_ARCH\'" | sudo tee --append \
244       /etc/sudoers > /dev/null
245    sudo -EH tools/yardstick-img-modify tools/ubuntu-server-cloudimg-modify.sh
246
247 .. warning:: Before building the guest image inside the Yardstick container,
248   make sure the container is granted with privilege. The script will create files
249   by default in ``/tmp/workspace/yardstick`` and the files will be owned by root.
250
251 The created image can be added to OpenStack using the OpenStack client or via
252 the OpenStack Dashboard::
253
254    openstack image create --disk-format qcow2 --container-format bare \
255       --public --file /tmp/workspace/yardstick/yardstick-image.img \
256        yardstick-image
257
258
259 Some Yardstick test cases use a `Cirros 0.3.5`_ image and/or a `Ubuntu 16.04`_
260 image. Add Cirros and Ubuntu images to OpenStack::
261
262    openstack image create --disk-format qcow2 --container-format bare \
263       --public --file $cirros_image_file cirros-0.3.5
264    openstack image create --disk-format qcow2 --container-format bare \
265       --file $ubuntu_image_file Ubuntu-16.04
266
267
268 Automatic initialization of OpenStack (third way)
269 +++++++++++++++++++++++++++++++++++++++++++++++++
270
271 Similar to the second way, the first step is also to
272 `Export OpenStack environment variables`_. Then the following steps should be
273 done.
274
275 Automatic creation of Yardstick flavor and guest images
276 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
277
278 Yardstick has a script for automatically creating Yardstick flavor and building
279 Yardstick guest images. This script is mainly used for CI and can be also used
280 in the local environment::
281
282    source $YARDSTICK_REPO_DIR/tests/ci/load_images.sh
283
284
285 The Yardstick container GUI
286 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
287
288 In Euphrates release, Yardstick implemented a GUI for Yardstick Docker
289 container. After booting up Yardstick container, you can visit the GUI at
290 ``<container_host_ip>:8888/gui/index.html``.
291
292 For usage of Yardstick GUI, please watch our demo video at
293 `Yardstick GUI demo`_.
294
295 .. note:: The Yardstick GUI is still in development, the GUI layout and
296   features may change.
297
298 Delete the Yardstick container
299 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
300
301 If you want to uninstall Yardstick, just delete the Yardstick container::
302
303    sudo docker stop yardstick && docker rm yardstick
304
305
306
307 Install Yardstick directly in Ubuntu (second option)
308 ----------------------------------------------------
309
310 .. _install-framework:
311
312 Alternatively you can install Yardstick framework directly in Ubuntu or in an
313 Ubuntu Docker image. No matter which way you choose to install Yardstick, the
314 following installation steps are identical.
315
316 If you choose to use the Ubuntu Docker image, you can pull the Ubuntu
317 Docker image from Docker hub::
318
319    sudo -EH docker pull ubuntu:16.04
320
321
322 Install Yardstick
323 ^^^^^^^^^^^^^^^^^
324
325 Prerequisite preparation::
326
327    sudo -EH apt-get update && sudo -EH apt-get install -y \
328       git python-setuptools python-pip
329    sudo -EH easy_install -U setuptools==30.0.0
330    sudo -EH pip install appdirs==1.4.0
331    sudo -EH pip install virtualenv
332
333 Download the source code and install Yardstick from it::
334
335    git clone https://gerrit.opnfv.org/gerrit/yardstick
336    export YARDSTICK_REPO_DIR=~/yardstick
337    cd ~/yardstick
338    sudo -EH ./install.sh
339
340 If the host is ever restarted, nginx and uwsgi need to be restarted::
341
342    service nginx restart
343    uwsgi -i /etc/yardstick/yardstick.ini
344
345 Configure the Yardstick environment (**Todo**)
346 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
347
348 For installing Yardstick directly in Ubuntu, the ``yardstick env`` command is
349 not available. You need to prepare OpenStack environment variables and create
350 Yardstick flavor and guest images manually.
351
352 Uninstall Yardstick
353 ^^^^^^^^^^^^^^^^^^^
354
355 For uninstalling Yardstick, just delete the virtual environment::
356
357    rm -rf ~/yardstick_venv
358
359
360 Install Yardstick directly in OpenSUSE
361 --------------------------------------
362
363 .. _install-framework:
364
365 You can install Yardstick framework directly in OpenSUSE.
366
367
368 Install Yardstick
369 ^^^^^^^^^^^^^^^^^
370
371 Prerequisite preparation::
372
373    sudo -EH zypper -n install -y gcc \
374       wget \
375       git \
376       sshpass \
377       qemu-tools \
378       kpartx \
379       libffi-devel \
380       libopenssl-devel \
381       python \
382       python-devel \
383       python-virtualenv \
384       libxml2-devel \
385       libxslt-devel \
386       python-setuptools-git
387
388 Create a virtual environment::
389
390    virtualenv ~/yardstick_venv
391    export YARDSTICK_VENV=~/yardstick_venv
392    source ~/yardstick_venv/bin/activate
393    sudo -EH easy_install -U setuptools
394
395 Download the source code and install Yardstick from it::
396
397    git clone https://gerrit.opnfv.org/gerrit/yardstick
398    export YARDSTICK_REPO_DIR=~/yardstick
399    cd yardstick
400    sudo -EH python setup.py install
401    sudo -EH pip install -r requirements.txt
402
403 Install missing python modules::
404
405    sudo -EH pip install pyyaml \
406       oslo_utils \
407       oslo_serialization \
408       oslo_config \
409       paramiko \
410       python.heatclient \
411       python.novaclient \
412       python.glanceclient \
413       python.neutronclient \
414       scp \
415       jinja2
416
417
418 Configure the Yardstick environment
419 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
420
421 Source the OpenStack environment variables::
422
423    source DEVSTACK_DIRECTORY/openrc
424
425 Export the Openstack external network. The default installation of Devstack
426 names the external network public::
427
428    export EXTERNAL_NETWORK=public
429    export OS_USERNAME=demo
430
431 Change the API version used by Yardstick to v2.0 (the devstack openrc sets it
432 to v3)::
433
434    export OS_AUTH_URL=http://PUBLIC_IP_ADDRESS:5000/v2.0
435
436
437 Uninstall Yardstick
438 ^^^^^^^^^^^^^^^^^^^
439
440 For unistalling Yardstick, just delete the virtual environment::
441
442    rm -rf ~/yardstick_venv
443
444
445 Verify the installation
446 -----------------------
447
448 It is recommended to verify that Yardstick was installed successfully
449 by executing some simple commands and test samples. Before executing Yardstick
450 test cases make sure ``yardstick-flavor`` and ``yardstick-image`` can be found
451 in OpenStack and the ``openrc`` file is sourced. Below is an example invocation
452 of Yardstick ``help`` command and ``ping.py`` test sample::
453
454    yardstick -h
455    yardstick task start samples/ping.yaml
456
457 .. note:: The above commands could be run in both the Yardstick container and
458   the Ubuntu directly.
459
460 Each testing tool supported by Yardstick has a sample configuration file.
461 These configuration files can be found in the ``samples`` directory.
462
463 Default location for the output is ``/tmp/yardstick.out``.
464
465
466 Automatic installation of Yardstick using ansible
467 -------------------------------------------------
468
469 Automatic installation can be used as an alternative to the manual.
470 Yardstick can be installed on the bare metal and to the container. Yardstick
471 container can be either pulled or built.
472
473 Bare metal installation
474 ^^^^^^^^^^^^^^^^^^^^^^^
475
476 Use ansible script ``install.yaml`` to install Yardstick on Ubuntu server:
477
478 .. code-block:: console
479
480     ansible-playbook -i install-inventory.ini install.yaml \
481     -e YARDSTICK_DIR=<path to Yardstick folder>
482
483 .. note:: By default ``INSTALLATION_MODE`` is ``baremetal``.
484
485 .. note:: By default Ubuntu 16.04 is chosen (xenial). It can be changed to
486    Ubuntu 18.04 (bionic) by passing ``-e OS_RELEASE=bionic`` parameter.
487
488 .. note:: To install Yardstick in virtual environment pass parameter
489    ``-e VIRTUAL_ENVIRONMENT=True``.
490
491 To build Yardstick NSB image pass ``IMG_PROPERTY=nsb`` as input parameter:
492
493 .. code-block:: console
494
495     ansible-playbook -i install-inventory.ini install.yaml \
496     -e IMAGE_PROPERTY=nsb \
497     -e YARDSTICK_DIR=<path to Yardstick folder>
498
499 .. note:: In this ``INSTALLATION_MODE`` mode either Yardstick image or SampleVNF
500    images will be built. Image type is defined by parameter ``IMAGE_PROPERTY``.
501    By default Yardstick image will be built.
502
503 Container installation
504 ^^^^^^^^^^^^^^^^^^^^^^
505
506 Use ansible script ``install.yaml`` to pull or build Yardstick
507 container. To pull Yardstick image and start container run:
508
509 .. code-block:: console
510
511     ansible-playbook -i install-inventory.ini install.yaml \
512     -e YARDSTICK_DIR=<path to Yardstick folder> \
513     -e INSTALLATION_MODE=container_pull
514
515 .. note:: In this ``INSTALLATION_MODE`` mode either Yardstick image or SampleVNF
516    images will be built. Image type is defined by variable ``IMG_PROPERTY`` in
517    file ``ansible/group_vars/all.yml``. By default Yardstick image will be
518    built.
519
520 .. note:: Open question: How to know if Docker image is built on Ubuntu 16.04 and 18.04?
521    Do we need separate tag to be used?
522
523 To build Yardstick image run:
524
525 .. code-block:: console
526
527     ansible-playbook -i install-inventory.ini install.yaml \
528     -e YARDSTICK_DIR=<path to Yardstick folder> \
529     -e INSTALLATION_MODE=container
530
531 .. note:: In this ``INSTALLATION_MODE`` mode neither Yardstick image nor SampleVNF
532    image will be built.
533
534 .. note:: By default Ubuntu 16.04 is chosen (xenial). It can be changed to
535    Ubuntu 18.04 (bionic) by passing ``-e OS_RELEASE=bionic`` parameter.
536
537 Parameters for ``install.yaml``
538 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
539
540 Description of the parameters used with ``install.yaml`` script
541
542   +-------------------------+-------------------------------------------------+
543   | Parameters              | Detail                                          |
544   +=========================+=================================================+
545   | -i install-inventory.ini| Installs package dependency to remote servers   |
546   |                         | Mandatory parameter                             |
547   |                         | By default no remote servers are provided       |
548   |                         | Needed packages will be installed on localhost  |
549   +-------------------------+-------------------------------------------------+
550   | -e YARDSTICK_DIR        | Path to Yardstick folder                        |
551   |                         | Mandatory parameter                             |
552   +-------------------------+-------------------------------------------------+
553   | -e INSTALLATION_MODE    | baremetal: Yardstick is installed to the bare   |
554   |                         | metal                                           |
555   |                         | Default parameter                               |
556   |                         +-------------------------------------------------+
557   |                         | container: Yardstick is installed in container  |
558   |                         | Container is built from Dockerfile              |
559   |                         +-------------------------------------------------+
560   |                         | container_pull: Yardstick is installed in       |
561   |                         | container                                       |
562   |                         | Container is pulled from docker hub             |
563   +-------------------------+-------------------------------------------------+
564   | -e OS_RELEASE           | xenial or bionic: Ubuntu version to be used     |
565   |                         | Default is Ubuntu 16.04 (xenial)                |
566   +-------------------------+-------------------------------------------------+
567   | -e IMAGE_PROPERTY       | normal or nsb: Type of the VM image to be built |
568   |                         | Default image is Yardstick                      |
569   +-------------------------+-------------------------------------------------+
570   | -e VIRTUAL_ENVIRONMENT  | False or True: Whether install in virtualenv    |
571   |                         | Default is False                                |
572   +-------------------------+-------------------------------------------------+
573
574
575 Deploy InfluxDB and Grafana using Docker
576 ----------------------------------------
577
578 Without InfluxDB, Yardstick stores results for running test case in the file
579 ``/tmp/yardstick.out``. However, it's inconvenient to retrieve and display
580 test results. So we will show how to use InfluxDB to store data and use
581 Grafana to display data in the following sections.
582
583 Automatic deployment of InfluxDB and Grafana containers (**recommended**)
584 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
585
586 1. Enter the Yardstick container::
587
588      sudo -EH docker exec -it yardstick /bin/bash
589
590 2. Create InfluxDB container and configure with the following command::
591
592      yardstick env influxdb
593
594 3. Create and configure Grafana container::
595
596      yardstick env grafana
597
598 Then you can run a test case and visit http://host_ip:1948
599 (``admin``/``admin``) to see the results.
600
601 .. note:: Executing ``yardstick env`` command to deploy InfluxDB and Grafana
602   requires Jumphost's docker API version => 1.24. Run the following command to
603   check the docker API version on the Jumphost::
604
605     docker version
606
607
608 Manual deployment of InfluxDB and Grafana containers
609 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
610
611 You can also deploy influxDB and Grafana containers manually on the Jumphost.
612 The following sections show how to do.
613
614 Pull docker images::
615
616    sudo -EH docker pull tutum/influxdb
617    sudo -EH docker pull grafana/grafana
618
619 Run influxDB::
620
621    sudo -EH docker run -d --name influxdb \
622       -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 \
623       tutum/influxdb
624
625 Configure influxDB::
626
627    docker exec -it influxdb influx
628       > CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
629       > CREATE DATABASE yardstick;
630       > use yardstick;
631       > show MEASUREMENTS;
632       > exit
633
634 Run Grafana::
635
636    sudo -EH docker run -d --name grafana -p 1948:3000 grafana/grafana
637
638 Log on to ``http://{YOUR_IP_HERE}:1948`` using ``admin``/``admin`` and configure
639 database resource to be ``{YOUR_IP_HERE}:8086``.
640
641 .. image:: images/Grafana_config.png
642    :width: 800px
643    :alt: Grafana data source configuration
644
645 Configure ``yardstick.conf``::
646
647    sudo -EH docker exec -it yardstick /bin/bash
648    sudo cp etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
649    sudo vi /etc/yardstick/yardstick.conf
650
651 Modify ``yardstick.conf`` to add the ``influxdb`` dispatcher::
652
653    [DEFAULT]
654    debug = True
655    dispatcher = influxdb
656
657    [dispatcher_influxdb]
658    timeout = 5
659    target = http://{YOUR_IP_HERE}:8086
660    db_name = yardstick
661    username = root
662    password = root
663
664 Now Yardstick will store results in InfluxDB when you run a testcase.
665
666 Deploy InfluxDB and Grafana directly in Ubuntu (**Todo**)
667 ---------------------------------------------------------
668
669 Proxy Support
670 -------------
671
672 To configure the Jumphost to access Internet through a proxy its necessary to
673 export several variables to the environment, contained in the following
674 script::
675
676    #!/bin/sh
677    _proxy=<proxy_address>
678    _proxyport=<proxy_port>
679    _ip=$(hostname -I | awk '{print $1}')
680
681    export ftp_proxy=http://$_proxy:$_proxyport
682    export FTP_PROXY=http://$_proxy:$_proxyport
683    export http_proxy=http://$_proxy:$_proxyport
684    export HTTP_PROXY=http://$_proxy:$_proxyport
685    export https_proxy=http://$_proxy:$_proxyport
686    export HTTPS_PROXY=http://$_proxy:$_proxyport
687    export no_proxy=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
688    export NO_PROXY=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
689
690 To enable Internet access from a container using ``docker``, depends on the OS
691 version. On Ubuntu 14.04 LTS, which uses SysVinit, ``/etc/default/docker`` must
692 be modified::
693
694    .......
695    # If you need Docker to use an HTTP proxy, it can also be specified here.
696    export http_proxy="http://<proxy_address>:<proxy_port>/"
697    export https_proxy="https://<proxy_address>:<proxy_port>/"
698
699 Then its necessary to restart the ``docker`` service::
700
701    sudo -EH service docker restart
702
703 In Ubuntu 16.04 LTS, which uses Systemd, its necessary to create a drop-in
704 directory::
705
706    sudo mkdir /etc/systemd/system/docker.service.d
707
708 Then, the proxy configuration will be stored in the following file::
709
710    # cat /etc/systemd/system/docker.service.d/http-proxy.conf
711    [Service]
712    Environment="HTTP_PROXY=https://<proxy_address>:<proxy_port>/"
713    Environment="HTTPS_PROXY=https://<proxy_address>:<proxy_port>/"
714    Environment="NO_PROXY=localhost,127.0.0.1,<localaddress>,<.localdomain>"
715
716 The changes need to be flushed and the ``docker`` service restarted::
717
718    sudo systemctl daemon-reload
719    sudo systemctl restart docker
720
721 Any container is already created won't contain these modifications. If needed,
722 stop and delete the container::
723
724    sudo docker stop yardstick
725    sudo docker rm yardstick
726
727 .. warning:: Be careful, the above ``rm`` command will delete the container
728   completely. Everything on this container will be lost.
729
730 Then follow the previous instructions `Prepare the Yardstick container`_ to
731 rebuild the Yardstick container.
732
733
734 References
735 ----------
736
737 .. _`User Guide & Configuration Guide`: http://docs.opnfv.org/en/latest/release/userguide.introduction.html
738 .. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
739 .. _`Cirros 0.3.5`: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
740 .. _`Ubuntu 16.04`: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
741 .. _`Yardstick GUI demo`: https://www.youtube.com/watch?v=M3qbJDp6QBk