LDV Tools in Docker » History » Version 2
Ilja Zakharov, 04/14/2015 07:18 PM
1 | 1 | Ilja Zakharov | h1. LDV Tools in Docker |
---|---|---|---|
2 | 2 | Ilja Zakharov | |
3 | h2. Description |
||
4 | |||
5 | This file describes steps to deploy ldv-tools software verification system |
||
6 | from master branch of ldv-tools repository with help of docker. More details |
||
7 | about system usage are available in corresponding tutorials stored in the |
||
8 | ldv-tools repo. |
||
9 | |||
10 | This package should contain english and russian tutorials and two docker images: |
||
11 | |||
12 | * debianldv.tar - image with ldv installed ldv console tools and web interface; |
||
13 | * mysql.tar - image with a mysql-server, database for verification results and |
||
14 | script for its initialization. |
||
15 | |||
16 | h2. Deployment |
||
17 | |||
18 | # Install Docker on your machine according to official tutorial. Provided below version may help if your docker version does not support these images. Images were built with Docker having following version: |
||
19 | <pre> |
||
20 | $ sudo docker version |
||
21 | Client version: 1.5.0 |
||
22 | Client API version: 1.17 |
||
23 | Go version (client): go1.4.1 |
||
24 | Git commit (client): a8a31ef |
||
25 | OS/Arch (client): linux/amd64 |
||
26 | Server version: 1.5.0 |
||
27 | Server API version: 1.17 |
||
28 | Go version (server): go1.4.1 |
||
29 | Git commit (server): a8a31ef |
||
30 | </pre> |
||
31 | # Load your images to Docker on the host machine: |
||
32 | <pre> |
||
33 | $ sudo docker load -i debianldv.tar |
||
34 | $ sudo docker load -i mysql.tar |
||
35 | </pre> |
||
36 | After loading you will have two available images on your host: |
||
37 | <pre> |
||
38 | $ sudo docker images |
||
39 | ldv_tools/debianldv latest ff073a36d5be 23 hours ago 2.716 GB |
||
40 | ldv_tools/mysql latest 4607ef975bea 3 days ago 260.8 MB |
||
41 | </pre> |
||
42 | |||
43 | h2. Run containers |
||
44 | |||
45 | Warning! Before running containers make sure that nobody uses ports listed |
||
46 | below: |
||
47 | |||
48 | * 3306 - usually it is claimed by mysql-server; |
||
49 | * 8999 - largely nobody uses it. |
||
50 | |||
51 | h3. Run container with mysql-server. |
||
52 | |||
53 | # Run ldv_tools/mysql container in a daemon mode on your host machine: |
||
54 | <pre> |
||
55 | $ sudo docker run -p 3306:3306 -d ldv_tools/mysql |
||
56 | </pre> |
||
57 | # Now you can connect from your host to the mysql-server in a container. Verification results will be stored in the database "ldvbase" which can be managed by user "ldvuser" with no password: |
||
58 | <pre> |
||
59 | $ mysql -u ldvuser --protocol=TCP |
||
60 | </pre> |
||
61 | # Next it is required to access database from other container, so it is necessary to obtain mysql container''s IP address first. Perform on host: |
||
62 | <pre> |
||
63 | $ sudo docker ps |
||
64 | </pre> |
||
65 | Remember the ID of mysql container and run command to get its IP address: |
||
66 | <pre> |
||
67 | $ docker inspect --format=''{{.NetworkSettings.IPAddress}}'' <MYSQL cont. ID> |
||
68 | </pre> |
||
69 | # There is no any other required actions to perform with the container, just keep it alive. The other instructions are concerned with the main ldv image and its container. |
||
70 | |||
71 | h3. Run container with ldv-tools |
||
72 | |||
73 | # Prepare host directory with Linux sources to share with the container in a read and write mode (you can choose your own path instead of /host/work): |
||
74 | <pre> |
||
75 | $ mkdir /host/work |
||
76 | $ cp linux-3.17-rc1.tar.xz /host/work |
||
77 | $ cd /host/work |
||
78 | </pre> |
||
79 | # Run container with ldv-tools (option "--privileged=true is required for control croups mounting, since docker restricts it inside a container by default): |
||
80 | <pre> |
||
81 | $ sudo docker run -i -t -v "/host/work:/work:rw" --privileged=true -p 8999:8999 ldv_tools/debianldv /bin/bash |
||
82 | </pre> |
||
83 | # Run inside a container command: |
||
84 | <pre> |
||
85 | # recursive_cg_mounter |
||
86 | </pre> |
||
87 | # You may need to start apache2 inside a container explicitly: |
||
88 | <pre> |
||
89 | # service apache2 start |
||
90 | </pre> |
||
91 | |||
92 | h2. Run verification |
||
93 | |||
94 | # Now you can perform verification inside ldv container in an interactive mode. Results will be stored in finished/ dir in a pax archive. The most frequent problem is that host systems have disabled swap accounting. You can use LDV without swap account at your own risk. More information is available in ldv-tools repository in the files INSTALL, TUTORIAL, README and others. Repository is not included in the containers to save disk space. Set LDV_WORK_WITHOUT_SWAP_ACCOUNT environment variable for that. There is an example: |
||
95 | <pre> |
||
96 | # RCV_MEMLIMIT=5Gb RCV_TIMELIMIT=100 ldv-manager envs=linux-3.17-rc1.tar.xz kernel_driver=1 "drivers=drivers/net/usb/cdc-phonet.ko" "rule_models=32_7a" |
||
97 | </pre> |
||
98 | |||
99 | h2. Explore results |
||
100 | |||
101 | # Upload results from debianldv container to container with mysql (remember that this IP address we already obtained few steps above): |
||
102 | <pre> |
||
103 | # LDVDB=ldvbase LDVDBHOST=<MYSQL container IP> LDVUSER=ldvuser ldv-upload-2 finished/yours.pax |
||
104 | </pre> |
||
105 | # Now you can analyze your results in a browser from your host machine or even connecting from a remote host. Just type the address: |
||
106 | <pre> |
||
107 | http://localhost:8999/stats/index/profilename/default/name/ldvbase/user/ldvuser/host/<MYSQL container IP>/ |
||
108 | </pre> |
||
109 | # To share your results use host name or host IP instead of localhost. |
||
110 | |||
111 | h2. Finish work |
||
112 | |||
113 | # To terminate containers use just "exit" in a container running interactive mode and commands "sudo docker ps" and "sudo docker kill <id>" for containers started in a daemon mode. |
||
114 | # Do not forget to dump your mysql base from corresponding container if you are planning its further usage, since information in destroyed containers is flushed. |