2138217985fd7544f92e561091074ac6d20e3a74
[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
467 -----------------------------------
468
469 Automatic installation can be used as an alternative to the manual by
470 providing parameters for ansible script ``install.yaml`` in a ``nsb_setup.sh``
471 file. Yardstick can be installed on the bare metal and to the container. Yardstick
472 container can be either pulled or built.
473
474 Bare metal installation
475 ^^^^^^^^^^^^^^^^^^^^^^^
476
477 Modify ``nsb_setup.sh`` file ``install.yaml`` parameters to install Yardstick
478 on Ubuntu server:
479
480 .. code-block:: console
481
482     ansible-playbook -i install-inventory.ini install.yaml \
483     -e IMAGE_PROPERTY='none' \
484     -e YARDSTICK_DIR=<path to Yardstick folder>
485
486 .. note:: By default ``INSTALLATION_MODE`` is ``baremetal``.
487
488 .. note:: No modification in ``install-inventory.ini`` is needed for Yardstick
489    installation.
490
491 .. note:: To install Yardstick in virtual environment pass parameter
492    ``-e VIRTUAL_ENVIRONMENT=True``.
493
494 Container installation
495 ^^^^^^^^^^^^^^^^^^^^^^
496
497 Modify ``install.yaml`` parameters in ``nsb_setup.sh`` file  to pull or build
498 Yardstick container. To pull Yardstick image and start container run:
499
500 .. code-block:: console
501
502     ansible-playbook -i install-inventory.ini install.yaml \
503     -e IMAGE_PROPERTY='none' \
504     -e INSTALLATION_MODE=container_pull
505
506 .. note:: Yardstick docker image is available for both Ubuntu 16.04 and Ubuntu
507    18.04. By default Ubuntu 16.04 based docker image is used. To use
508    Ubuntu 18.04 based docker image pass ``-i opnfv/yardstick-ubuntu-18.04``
509    parameter to ``nsb_setup.sh``.
510
511 To build Yardstick image modify Dockerfile as per comments in it and run:
512
513 .. code-block:: console
514
515     cd yardstick
516     docker build -f docker/Dockerfile -t opnfv/yardstick:<tag> .
517
518 .. note:: Yardstick docker image based on Ubuntu 16.04 will be built.
519    Pass ``-f docker/Dockerfile_ubuntu18`` to build Yardstick docker image based
520    on Ubuntu 18.04.
521
522 .. note:: Add ``--build-arg http_proxy=http://<proxy_host>:<proxy_port>`` to
523    build docker image if server is behind the proxy.
524
525 Parameters for ``install.yaml``
526 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
527
528 Description of the parameters used with ``install.yaml``:
529
530   +-------------------------+-------------------------------------------------+
531   | Parameters              | Detail                                          |
532   +=========================+=================================================+
533   | -i install-inventory.ini|| Installs package dependency to remote servers  |
534   |                         || and localhost                                  |
535   |                         || Mandatory parameter                            |
536   |                         || By default no remote servers are provided      |
537   +-------------------------+-------------------------------------------------+
538   | -e YARDSTICK_DIR        || Path to Yardstick folder                       |
539   |                         || Mandatory parameter for Yardstick bare metal   |
540   |                         || installation                                   |
541   +-------------------------+-------------------------------------------------+
542   | -e INSTALLATION_MODE    || baremetal: Yardstick is installed to the bare  |
543   |                         |  metal                                          |
544   |                         || Default parameter                              |
545   |                         +-------------------------------------------------+
546   |                         || container: Yardstick is installed in container |
547   |                         || Container is built from Dockerfile             |
548   |                         +-------------------------------------------------+
549   |                         || container_pull: Yardstick is installed in      |
550   |                         || container                                      |
551   |                         || Container is pulled from docker hub            |
552   +-------------------------+-------------------------------------------------+
553   | -e OS_RELEASE           || xenial or bionic: Ubuntu version to be used for|
554   |                         || VM image (nsb or normal)                       |
555   |                         || Default is Ubuntu 16.04, xenial                |
556   +-------------------------+-------------------------------------------------+
557   | -e IMAGE_PROPERTY       || nsb: Build Yardstick NSB VM image              |
558   |                         || Used to run Yardstick NSB tests on sample VNF  |
559   |                         || Default parameter                              |
560   |                         +-------------------------------------------------+
561   |                         || normal: Build VM image to run ping test in     |
562   |                         || OpenStack                                      |
563   |                         +-------------------------------------------------+
564   |                         || none: don't build a VM image.                  |
565   +-------------------------+-------------------------------------------------+
566   | -e VIRTUAL_ENVIRONMENT  || False or True: Whether install in virtualenv   |
567   |                         || Default is False                               |
568   +-------------------------+-------------------------------------------------+
569   | -e YARD_IMAGE_ARCH      || CPU architecture on servers                    |
570   |                         || Default is 'amd64'                             |
571   +-------------------------+-------------------------------------------------+
572
573
574 Deploy InfluxDB and Grafana using Docker
575 ----------------------------------------
576
577 Without InfluxDB, Yardstick stores results for running test case in the file
578 ``/tmp/yardstick.out``. However, it's inconvenient to retrieve and display
579 test results. So we will show how to use InfluxDB to store data and use
580 Grafana to display data in the following sections.
581
582 Automatic deployment of InfluxDB and Grafana containers (**recommended**)
583 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
584
585 1. Enter the Yardstick container::
586
587      sudo -EH docker exec -it yardstick /bin/bash
588
589 2. Create InfluxDB container and configure with the following command::
590
591      yardstick env influxdb
592
593 3. Create and configure Grafana container::
594
595      yardstick env grafana
596
597 Then you can run a test case and visit http://host_ip:1948
598 (``admin``/``admin``) to see the results.
599
600 .. note:: Executing ``yardstick env`` command to deploy InfluxDB and Grafana
601   requires Jumphost's docker API version => 1.24. Run the following command to
602   check the docker API version on the Jumphost::
603
604     docker version
605
606
607 Manual deployment of InfluxDB and Grafana containers
608 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
609
610 You can also deploy influxDB and Grafana containers manually on the Jumphost.
611 The following sections show how to do.
612
613 Pull docker images::
614
615    sudo -EH docker pull tutum/influxdb
616    sudo -EH docker pull grafana/grafana
617
618 Run influxDB::
619
620    sudo -EH docker run -d --name influxdb \
621       -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 \
622       tutum/influxdb
623
624 Configure influxDB::
625
626    docker exec -it influxdb influx
627       > CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
628       > CREATE DATABASE yardstick;
629       > use yardstick;
630       > show MEASUREMENTS;
631       > exit
632
633 Run Grafana::
634
635    sudo -EH docker run -d --name grafana -p 1948:3000 grafana/grafana
636
637 Log on to ``http://{YOUR_IP_HERE}:1948`` using ``admin``/``admin`` and configure
638 database resource to be ``{YOUR_IP_HERE}:8086``.
639
640 .. image:: images/Grafana_config.png
641    :width: 800px
642    :alt: Grafana data source configuration
643
644 Configure ``yardstick.conf``::
645
646    sudo -EH docker exec -it yardstick /bin/bash
647    sudo cp etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
648    sudo vi /etc/yardstick/yardstick.conf
649
650 Modify ``yardstick.conf`` to add the ``influxdb`` dispatcher::
651
652    [DEFAULT]
653    debug = True
654    dispatcher = influxdb
655
656    [dispatcher_influxdb]
657    timeout = 5
658    target = http://{YOUR_IP_HERE}:8086
659    db_name = yardstick
660    username = root
661    password = root
662
663 Now Yardstick will store results in InfluxDB when you run a testcase.
664
665 Deploy InfluxDB and Grafana directly in Ubuntu (**Todo**)
666 ---------------------------------------------------------
667
668 Proxy Support
669 -------------
670
671 To configure the Jumphost to access Internet through a proxy its necessary to
672 export several variables to the environment, contained in the following
673 script::
674
675    #!/bin/sh
676    _proxy=<proxy_address>
677    _proxyport=<proxy_port>
678    _ip=$(hostname -I | awk '{print $1}')
679
680    export ftp_proxy=http://$_proxy:$_proxyport
681    export FTP_PROXY=http://$_proxy:$_proxyport
682    export http_proxy=http://$_proxy:$_proxyport
683    export HTTP_PROXY=http://$_proxy:$_proxyport
684    export https_proxy=http://$_proxy:$_proxyport
685    export HTTPS_PROXY=http://$_proxy:$_proxyport
686    export no_proxy=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
687    export NO_PROXY=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
688
689 To enable Internet access from a container using ``docker``, depends on the OS
690 version. On Ubuntu 14.04 LTS, which uses SysVinit, ``/etc/default/docker`` must
691 be modified::
692
693    .......
694    # If you need Docker to use an HTTP proxy, it can also be specified here.
695    export http_proxy="http://<proxy_address>:<proxy_port>/"
696    export https_proxy="https://<proxy_address>:<proxy_port>/"
697
698 Then its necessary to restart the ``docker`` service::
699
700    sudo -EH service docker restart
701
702 In Ubuntu 16.04 LTS, which uses Systemd, its necessary to create a drop-in
703 directory::
704
705    sudo mkdir /etc/systemd/system/docker.service.d
706
707 Then, the proxy configuration will be stored in the following file::
708
709    # cat /etc/systemd/system/docker.service.d/http-proxy.conf
710    [Service]
711    Environment="HTTP_PROXY=https://<proxy_address>:<proxy_port>/"
712    Environment="HTTPS_PROXY=https://<proxy_address>:<proxy_port>/"
713    Environment="NO_PROXY=localhost,127.0.0.1,<localaddress>,<.localdomain>"
714
715 The changes need to be flushed and the ``docker`` service restarted::
716
717    sudo systemctl daemon-reload
718    sudo systemctl restart docker
719
720 Any container is already created won't contain these modifications. If needed,
721 stop and delete the container::
722
723    sudo docker stop yardstick
724    sudo docker rm yardstick
725
726 .. warning:: Be careful, the above ``rm`` command will delete the container
727   completely. Everything on this container will be lost.
728
729 Then follow the previous instructions `Prepare the Yardstick container`_ to
730 rebuild the Yardstick container.
731
732
733 References
734 ----------
735
736 .. _`User Guide & Configuration Guide`: http://docs.opnfv.org/en/latest/release/userguide.introduction.html
737 .. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
738 .. _`Cirros 0.3.5`: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
739 .. _`Ubuntu 16.04`: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
740 .. _`Yardstick GUI demo`: https://www.youtube.com/watch?v=M3qbJDp6QBk