diff --git a/docs/aws-cost-study/aws-cost-study-new.org b/docs/aws-cost-study/aws-cost-study-new.org new file mode 100644 index 0000000..0bf22d6 --- /dev/null +++ b/docs/aws-cost-study/aws-cost-study-new.org @@ -0,0 +1,192 @@ +#+Title: Analysis of AWS cost for Virtual labs hosting +#+Author: Ashay Maheshwari +#+Date: June 28, 2016 + +* Introduction ++ This document represents the broken structure of AWS cost for the + month of May,2 016. Values obtained are estimated to be correct with + error fraction of + or - Rs 10,000. ++ All instances mentioned here are On-Demand instances and are charged on per-hour basis. ++ $1 = Rs70 (Approximated) ++ 1 month = 30 days + +* Motivation +This document is to educate about our billings in AWS. It gives an idea of where are we spending and hence to explore docker to reduce +the cost by half. With Docker, we can have scalability with constant price. + +* AWS instance cost +** AWS Rate chart (Then June 29, 2016) ++ Table given below show the AWS pricing for instance type used by VLEAD. ++ It represents the cost of an instance type, if up for 24 hours upto 30 days (24 hours * 30). + ++ Table A.1 +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| Type | No. of Core | Amount of RAM (in GB) | Rate in ($/hour/per-instance) | Cost for 30 days(in Rs per instance) | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| t2.micro | 1 | 1 | 0.013 | 655.2 | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| t2.small | 1 | 2 | 0.026 | 1310.4 | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| t2.medium | 2 | 4 | 0.052 | 2620.80 | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| t2.large | 2 | 8 | 0.136 | 6854.4 | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| +| m3.large | 2 | 7.5 | 0.154 | 7761.6 | +|-----------+-------------+-----------------------+-------------------------------+--------------------------------------| + +** Type and number of instances currently running(For the month of June) + ++ Table A.2, given below represents the number of instances of specific type, which are currently running in VLEAD AWS architecture. + ++ Table A.2 +|-----------+------------------| +| Type | No. of Instances | +|-----------+------------------| +| t2.micro | 86 | +|-----------+------------------| +| t2.small | 13 | +|-----------+------------------| +| t2.medium | 1 | +|-----------+------------------| +| t2.large | 2 | +|-----------+------------------| +| | | +|-----------+------------------| +| TOTAL | 102 | +|-----------+------------------| + +** AWS bill for instances(May, 2016) ++ AWS pricing for On-Demand instances is on the basis of $X/hour. ++ As soon as an instance is launched, it is charged for first hour. With the start of minute number 61, we are charged for second hour. ++ Table given below reflects the hour based run time of each type of instance, cost per month in $ and Rs. ++ Say that you launched 5 t2.micro instances and ran them of 5 hours each. Then you will be billed for 25 hours. + ++ Table A.3 +|------------------+-------------------------------------+----------------------+------------------------| +| Type of Instance | instance uptime(in hours per month) | Cost (in $per month) | Cost (in Rs per month) | +|------------------+-------------------------------------+----------------------+------------------------| +| t2.micro | 54,746 | 711.8 | 49,770.00 | +|------------------+-------------------------------------+----------------------+------------------------| +| t2.small | 7,341 | 191.03 | 13,372.10 | +|------------------+-------------------------------------+----------------------+------------------------| +| t2.medium | 704 | 37.33 | 2,613.10 | +|------------------+-------------------------------------+----------------------+------------------------| +| t2.large | 591 | 80.38 | 5,626.60 | +|------------------+-------------------------------------+----------------------+------------------------| +| m3.large | 746 | 150.12 | 10,508.40 | +|------------------+-------------------------------------+----------------------+------------------------| +| | | | | +|------------------+-------------------------------------+----------------------+------------------------| +| TOTAL COST | - | 1170.66 | 81,890.10 | +|------------------+-------------------------------------+----------------------+------------------------| + + +** Stopped instances ++ We have some stopped instances, for which costs are negligible (generally Storage cost) + ++ Table A.4 +|------------------+-----------+--------------+---------| +| No. of Instances | Type | Region | Remarks | +|------------------+-----------+--------------+---------| +| 1 | m3.large | N.California | - | +|------------------+-----------+--------------+---------| +| 1 | t2.medium | N.California | - | +|------------------+-----------+--------------+---------| +| 2 | m3.large | Sao. Paulo | - | +|------------------+-----------+--------------+---------| + +* AWS Storage cost +** AWS Rate chart for Storage(then June 29, 2016) +Following table shows the pricing for type of Storage and Snapshot data used by VLEAD. + ++ Table A.5 +|-----------------+--------------------------| +| Storage Type | Rate (in $ per GB-month) | +|-----------------+--------------------------| +| SNAPSHOT DATA | 0.1299999911 | +|-----------------+--------------------------| +| SSD DATA | 0.1899999996 | +|-----------------+--------------------------| +| Magnetic Disk | 0.0499999997 | +|-----------------+--------------------------| + +** AWS bill for Storage (For the month of May 2016) ++ Rate for every Storage type is different as mentioned in Table A.5 ++ Charges are applied on the basis of per GB-month + ++ Table A.6 +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| Region | Snapshot data (GB used per month) | General Purpse SSD (GB used per month) | Magnetic Disk (GB used per month) | Cost (in $ per month) | Cost (in Rs per month) | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| Sao Poulo | 54.040 | 417.639 | - | 86.38 | 6046.600 | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| US East | 41.429 | 494.253 | 1,604.189 | 133.65 | 9355.500 | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| US West | 42.490 | 91.042 | 226.389 | 34 | 2380 | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| | | | | | | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| +| TOTAL | - | - | - | 254.03 | 17,782.10 | +|-----------+-----------------------------------+----------------------------------------+-----------------------------------+-----------------------+------------------------| + +* Graphs +Following graphs gives a visible statistics for values shown in tables. ++ Cost share between Storage and EC2 instance :: + This graphs shows that our major cost is from EC2 instances. + [[./storage-vs-instances.png]] + + ++ Number of instances of each type :: + This graphs gives the number of each type of instances currently running in our AWS architecture. Major amount of those instances + are t2.micro, which is the cheapest of all. + [[./no-of-instances.png]] + + ++ Number of hours of each instance we pay for :: + #+BEGIN_SRC formula + Total No. of hours an instance type was up * rate of instance type in $/hour + #+END_SRC + + Graph given below share the number of hours an instance type is running for a month. + [[./no-of-hours.png]] + + + Graph given below share the hour-cost relationship of each instance type + [[./hour-cost-graph.png]] + ++ Cost spent on each instance type :: + This graph show the share of cost spent on each instance type. + [[./cost-spent-share.png]] + + +* Estimated price for Docker ++ We can containerize our VM based AWS architecture using Docker and OpenVz. ++ Assuming that we take 32 GB of AWS instance :: + + Table A.7 + |---------------+------------------+------------------+------------------------+-------------------------| + | Instance type | CORE/RAM (in GB) | Rate (in $/hour) | Cost for 1 day (in Rs) | Cost for 30 days(in Rs) | + |---------------+------------------+------------------+------------------------+-------------------------| + | m4.2xlarge | 8/32 | $0.559 | 939.12 | 28,173.600 | + |---------------+------------------+------------------+------------------------+-------------------------| + | m4.xlarge | 4/16 | $0.279 | 468.72 | 14,061.600 | + |---------------+------------------+------------------+------------------------+-------------------------| + ++ Expected cost for containerization :: + This can be the cost required for VM to run containers and Storage used. Probably Storage cost will remain + stable. For 32 GB VM used, monthly estimated cost - + #+BEGIN_SRC cost + $ Total Cost = Cost of VM for 30 days + Cost of Storage used + $ Total Cost = 28,173.600 + 17,781 = 45,954.60 + #+END_SRC + + + Current Cost of AWS using VM = Rs.99680 + + Approxmiate cost with Docker = Rs.45,954.60 + + [[./current-vs-approximate-cost.png]] + +* Conclusion +With Docker already explored, and cost benefits mentioned in the document are exciting, we should try to consider docker for production purposes and shift our current architecture to docker. + + + + + + diff --git a/docs/aws-cost-study/aws-cost-study.org b/docs/aws-cost-study/aws-cost-study.org new file mode 100644 index 0000000..d62ea25 --- /dev/null +++ b/docs/aws-cost-study/aws-cost-study.org @@ -0,0 +1,134 @@ +#+Title: Billing study for AWS Architecture +#+Author: Ashay Maheshwari +#+Date: June 28, 2016 + +* Introduction ++ This document represents the broken structure of AWS cost for a month. Values obtained are estimated to be correct with error fraction of + or - Rs 10,000. ++ All instances mentioned here are On-Demand instances and are charged on per-hour basis. ++ $1 = Rs70 (Approximated) ++ 1 month = 30 days + +* AWS Running Instances +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ +| No. of Instances | Type | No. of Core/RAM | Rate($/hour) | Cost for 30 days(in Rs) | Total Cost(in Rs) | Region | Remarks | +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ +| 86 | t2.micro | 1/1 | 0.013 | 655.2 | 56,347.200 | N.Virginia | - | +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ +| 13 | t2.small | 1/2 | 0.026 | 1310.4 | 17,035.200 | N.Virginia | - | +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ +| 1 | t2.medium | 2/4 | 0.052 | 2620.8 | 2,620.800 | N.Virginia | reverse proxy | +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ +| 2 | t2.large | 2/8 | 0.136 | 6854.4 | 13708.8 | N.California | - | +|------------------+-----------+-----------------+--------------+-------------------------+-------------------+--------------+---------------+ + +** Inference + ++ Total cost for running instances =Rs 89,710.2= ++ We have =101 running instance= ++ =62.81 %= cost is from t2.micro instances which is the cheapest of all VMs ++ We are paying for =132 GB RAM= ((86 * 1) + (13 * 2) + (1 * 4) + (2 * 8)) + +* Region wise Storage(EBS) Prices ++ Rate Snapshot data per GB-month (in $) = 0.1299999911 ++ Rate SSD data per GB- month ( in $) = 0.1899999996 ++ Magnetic Disk per GB-month (in $) = 0.0499999997 + +|-----------+---------------+--------------------+---------------+-----------+------------| +| Region | Snapshot data | General Purpse SSD | Magnetic Disk | Cost in $ | Cost in Rs | +|-----------+---------------+--------------------+---------------+-----------+------------| +| Sao Poulo | 54.040 | 417.639 | - | 86.38 | 6046.600 | +|-----------+---------------+--------------------+---------------+-----------+------------| +| US East | 41.429 | 494.253 | 1,604.189 | 133.65 | 9355.500 | +|-----------+---------------+--------------------+---------------+-----------+------------| +| US West | 42.490 | 91.042 | 226.389 | 34 | 2380 | +|-----------+---------------+--------------------+---------------+-----------+------------| + +** Inference ++ Grand total for Storage disks =Rs 17,781= + +* Instance type based division + +|------------------+-------------------------------------------+-----------+------------| +| Type of Instance | Time for which instance were up(in hours) | Cost in $ | Cost in Rs | +|------------------+-------------------------------------------+-----------+------------| +| m3.large | 746 | 150.12 | 10,508.400 | +|------------------+-------------------------------------------+-----------+------------| +| t2.micro | 54,746 | 711.8 | 49,770.00 | +|------------------+-------------------------------------------+-----------+------------| +| t2.small | 7,341 | 191.03 | 13,372.100 | +|------------------+-------------------------------------------+-----------+------------| +| t2.medium | 704 | 37.33 | 2,613.1 | +|------------------+-------------------------------------------+-----------+------------| +| t2.large | 591 | 80.38 | 5,626.600 | +|------------------+-------------------------------------------+-----------+------------| + +** Inference ++ Total Cost for Instances =Rs 81889= ++ Total Cost for Storage =Rs.17,781= ++ Total Bill paid for June =Rs.102596.200= + + + +* Stopped instances + +|------------------+-----------+--------------+---------| +| No. of Instances | Type | Region | Remarks | +|------------------+-----------+--------------+---------| +| 1 | m3.large | N.California | - | +|------------------+-----------+--------------+---------| +| 1 | t2.medium | N.California | - | +|------------------+-----------+--------------+---------| +| 2 | m3.large | Sao. Paulo | - | +|------------------+-----------+--------------+---------| + + +* Graphs +Following graphs gives a visible statistics for values shown in tables. ++ Cost share between Storage and EC2 instance :: + This graphs shows that our major cost is from EC2 instances. + [[./storage-vs-instances.png]] + ++ Number of instances of each type :: + This graphs gives the number of each type of instances currently running in our AWS architecture. Major amount of those instances + are t2.micro, which is the cheapest of all. + [[./no-of-instances.png]] + ++ Number of hours of each instance we pay for :: + #+BEGIN_SRC formula + Total No. of hours an instance type was up * rate of instance type in $/hour + #+END_SRC + + Graph given below share the number of hours an instance type is running for a month. + [[./no-of-hours.png]] + + + Graph given below share the hour-cost relationship of each instance type + [[./hour-cost-graph.png]] + ++ Cost spent on each instance type :: + This graph show the share of cost spent on each instance type. + [[./cost-spent-share.png]] + +* Estimated price for Docker ++ We can containerize our VM based AWS architecture using Docker and OpenVz. ++ Assuming that we take 32 GB of AWS machine :: + |---------------+------------------+----------------+--------------------------+-------------------------| + | Instance type | CORE/RAM (in GB) | Rate in $/hour | Cost for 24 hours(in Rs) | Cost for 30 days(in Rs) | + |---------------+------------------+----------------+--------------------------+-------------------------| + | m4.2xlarge | 8/32 | $0.559 | 939.12 | 28,173.600 | + |---------------+------------------+----------------+--------------------------+-------------------------| + | m4.xlarge | 4/16 | $0.279 | 468.72 | 14,061.600 | + |---------------+------------------+----------------+--------------------------+-------------------------| + ++ Expected cost for containerization :: + This can be the cost required for VM to run containers and Storage used. Probably Storage cost will remain + stable. For 32 GB VM used, monthly estimated cost - + #+BEGIN_SRC cost + $ Total Cost = Cost of VM for 30 days + Cost of Storage used + $ Total Cost = 28,173.600 + 17,781 = 45,954.60 + #+END_SRC + + + Current Cost of AWS using VM = Rs.99680 + + Approxmiate cost with Docker = Rs.45,954.60 + + [[./current-vs-approximate-cost.png]] + + diff --git a/docs/aws-cost-study/cost-spent-share.png b/docs/aws-cost-study/cost-spent-share.png new file mode 100644 index 0000000..c49fcb6 Binary files /dev/null and b/docs/aws-cost-study/cost-spent-share.png differ diff --git a/docs/aws-cost-study/current-vs-approximate-cost.png b/docs/aws-cost-study/current-vs-approximate-cost.png new file mode 100644 index 0000000..a36f5e3 Binary files /dev/null and b/docs/aws-cost-study/current-vs-approximate-cost.png differ diff --git a/docs/aws-cost-study/hour-cost-graph.png b/docs/aws-cost-study/hour-cost-graph.png new file mode 100644 index 0000000..65e4867 Binary files /dev/null and b/docs/aws-cost-study/hour-cost-graph.png differ diff --git a/docs/aws-cost-study/no-of-hours.png b/docs/aws-cost-study/no-of-hours.png new file mode 100644 index 0000000..0642134 Binary files /dev/null and b/docs/aws-cost-study/no-of-hours.png differ diff --git a/docs/aws-cost-study/no-of-instances.png b/docs/aws-cost-study/no-of-instances.png new file mode 100644 index 0000000..af99a73 Binary files /dev/null and b/docs/aws-cost-study/no-of-instances.png differ diff --git a/docs/aws-cost-study/storage-vs-instances.png b/docs/aws-cost-study/storage-vs-instances.png new file mode 100644 index 0000000..06fed05 Binary files /dev/null and b/docs/aws-cost-study/storage-vs-instances.png differ diff --git a/docs/docker-book.org b/docs/docker-book.org new file mode 100755 index 0000000..1c5ddf8 --- /dev/null +++ b/docs/docker-book.org @@ -0,0 +1,1010 @@ +#+Title:Docker 1.11.2 +#+Author: Meghana Bandaru +#+Date: June 9, 2016 +* Introduction + This document aims at detailing Docker with everything tested and confirmed. +* Motivation + To get indepth knowledge of Docker along with all its features so that + we can shift VLEAD's current architecture of hosting labs in Virtual Machines to + Docker Containers +* Introduction to Docker + Docker is an open-source technology that that allows you to build, run, test, + and deploy distributed applications inside software containers. It allows you + to package a piece of software in a standardized unit for software development, + containing everything the software needs to run: code, runtime, system tools, + system libraries, etc. Docker enables you to quickly, reliably, and + consistently deploy applications regardless of environment. + You can refer it [[https://www.docker.com/what-docker#/copy1][here.]] +* Benefits of Docker + + Rapid application deployment :: + Containers include the minimal runtime requirements of the application, + reducing their size and allowing them to be deployed quickly. + + + Portability across machines :: + An application and all its dependencies can be bundled into a single + container that is independent from the host version of Linux kernel, + platform distribution, or deployment model. This container can be + transferred to another machine that runs Docker, and executed there + without compatibility issues. + + + Version control :: + You can track successive versions of a container, inspect differences, or roll-back to previous + versions. That means your container can be easily rolled back when required. + + + Sharing :: + You can use a remote repository to share your container with others. + + + Lightweight and minimal overhead :: + Docker images are typically very small, which facilitates rapid delivery + and reduces the time to deploy new application containers. + + + Simplified maintenance :: + Docker reduces effort and risk of problems with application dependencies. +* Docker Architecture + + Docker uses a client-server architecture + + The Docker client talks to the Docker daemon, which does the heavy lifting + of building, running, and distributing your Docker containers + + [[./images/architecture.png]] +* Getting started with Docker +** Docker images and containers + + Docker Image :: + + A Docker image is a read-only template. + + For example, an image could contain an Ubuntu operating system with Apache + and your web application installed. + + Images are used to create Docker containers. + + Docker images are the build component of Docker. + + Docker Container :: + + A container is a runtime instance of a docker image. + + Each container is launched from a Docker image. + + Docker containers can be run, started, stopped, moved, and deleted. + + Docker containers are the run component of Docker. + + To use a programming metaphor, if an image is a class, then acontainer is + an instance of a class(a runtime object). +*** How does Docker images work? + + Each image consists of a series of layers. + + Docker makes use of union file systems to combine these layers into a + single image.One of the reasons Docker is so lightweight is because of these + layers. + + When you change a Docker image-for example, update an application to a new + version, a new layer gets built. + + Thus, rather than replacing the whole image or entirely rebuilding, only + that layer is added or updated. + + Now you don't need to distribute a whole new image, just the update, + making distributing Docker images faster and simpler. +*** How does Docker containers work? + + A container consists of an operating system, user-added files and + meta-data. + + The image which we used to create the container tells Docker what that container + holds, what process to run when the container is launched, and a variety + of other configuration data. + + The Docker image is read-only. When Docker runs a container from an image, it + adds a read-write layer on top of the image in which your application can then run. + + [[./images/docker-layer.jpg]] + +** How to Install docker on Ubuntu 14.04 ? + Installation Instructions on Ubuntu: ++ Update your droplet :: + #+BEGIN_SRC command + $ sudo apt-get update + $ sudo apt-get -y upgrade + #+END_SRC ++ Make sure aufs support is available :: + #+BEGIN_SRC command + $ sudo apt-get install linux-image-extra-`uname -r` + #+END_SRC ++ Add docker repository key to apt-key for package verification :: + #+BEGIN_SRC command + $ sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + #+END_SRC ++ Add the docker repository to Apt sources :: + #+BEGIN_SRC command + $ echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list + #+END_SRC ++ Update the repository with the new addition :: + #+BEGIN_SRC command + $ sudo apt-get update + #+END_SRC ++ Finally, download and install docker :: + #+BEGIN_SRC command + $ sudo apt-get install docker-engine + #+END_SRC ++ Check if docker is installed :: + #+BEGIN_SRC command + $ docker version + #+END_SRC + If you get the following output, then Docker is successfully installed + #+BEGIN_SRC command + Client: + Version: 1.11.2 + API version: 1.23 + Go version: go1.5.4 + Git commit: b9f10c9 + Built: Wed Jun 1 21:47:50 2016 + OS/Arch: linux/amd64 + + Server: + Version: 1.11.2 + API version: 1.23 + Go version: go1.5.4 + Git commit: b9f10c9 + Built: Wed Jun 1 21:47:50 2016 + OS/Arch: linux/amd64 + #+END_SRC + +** Launch your first container + Launch or execute a command in container using =docker run= command. This + command will launch a container from an image, execute your command + display output on terminal, stop container and exit out. + + #+BEGIN_SRC command + docker run-->create container->run-container-->execute command-->show + output-->exit from container-->stop container + #+END_SRC + + #+BEGIN_SRC command + $ sudo docker run [options] [image] [command] [args] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ sudo docker run ubuntu:14.04 echo "Hello Docker" + $ Hello Docker + #+END_SRC + If the ubuntu:14.04 image is not present locally it will download it, will + create a container and then will execute the command =echo=. After this it + will exit the container and the container is stopped. + +** Create/Start/Stop/Restart/Destroy your container + A container is a runtime instance of a docker image. + + Create a new container :: + #+BEGIN_SRC command + $ docker create [OPTIONS] IMAGE [COMMAND] [ARG...] + #+END_SRC + For example: + #+BEGIN_SRC command + $ docker create -it ubuntu:14.04 echo "Hello World" + #+END_SRC + + =docker create= command can be used to set up a container configuration ahead of time so + that it is ready to start when you need it. + + Creates a writeable container layer over the specified image. + + A container created does not start on it's own and is to be started. + + Start a container :: + #+BEGIN_SRC command + $ docker start [OPTIONS] CONTAINER [CONTAINER...] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker start e76ccff0a41a + e76ccff0a41a + #+END_SRC + + To stop one or more containers :: + #+BEGIN_SRC command + $ docker stop [OPTIONS] CONTAINER [CONTAINER...] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker stop e76ccff0a41a + e76ccff0a41a + #+END_SRC ++ To restart one or more container :: + #+BEGIN_SRC command + $ docker restart [OPTIONS] CONTAINER [CONTAINER...] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker restart e76ccff0a41a + e76ccff0a41a + #+END_SRC + + Destroy a container :: + #+BEGIN_SRC command + $ docker rm [OPTIONS] CONTAINER [CONTAINER...] + #+END_SRC + + You can destroy one or more containers at a time + + You cannot delete a container which is currently running. So first stop the + container and then delete it. + #+BEGIN_SRC command + $ docker stop e76ccff0a41a + e76ccff0a41a + $ docker rm e76ccff0a41a + e76ccff0a41a + #+END_SRC +** Naming a container + + If you do not specify the name of the container docker will automatically + assume any random name. + + To give name to a container: + #+BEGIN_SRC command + $ docker run [options] -name + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -it -name lab1_cse01 ubuntu:14.04 bash + root@8c2fc6ba883b:~# + #+END_SRC + + You can always rename your container + #+BEGIN_SRC command + $ docker rename [OPTIONS] OLD_NAME NEW_NAME + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker rename lab1_cae01 lab2_cse02 + #+END_SRC +** Giving a hostname to container + + To give host name to container you must use =-h= flag with the =docker run= command: + #+BEGIN_SRC command + $ docker run -h [options] [image] [command] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -h new_ctnd -it ubuntu:14.04 bash + root@new_cntd:~# + #+END_SRC +** List containers + =docker ps= command is used to list containers in host machine. Depending on + the flags provided, it displays information of stopped or running containers. + #+BEGIN_SRC command + $ docker ps [options] + #+END_SRC + + + List the containers which are currently running :: + #+BEGIN_SRC command + $ docker ps + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 07c5614d5a40 ubuntu:14.04 "bash" About a minute ago Up About a minute evil_fermi + e76ccff0a41a ubuntu:14.04 "bash" 4 days ago Up 12 minutes stoic_bhabha + #+END_SRC + + + List all the containers(both running and stopped) :: + #+BEGIN_SRC command + $ docker ps -a + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 07c5614d5a40 ubuntu:14.04 "bash" 5 minutes ago Up 5 minutes evil_fermi + e76ccff0a41a ubuntu:14.04 "bash" 4 days ago Up 15 minutes stoic_bhabha + ca251b8c44d8 ubuntu:14.04 "bash" 4 days ago Exited (0) 4 days ago sad_wright + 58d28030aa5e ubuntu:14.04 "bash" 4 days ago Exited (0) 4 days ago jolly_raman + 34ab6efd089f lab/problem-solving:01 "bash" 5 days ago Exited (0) 4 days ago insane_yalow + 4164528c53c3 ubuntu:14.04 "bash" 5 days ago Exited (0) 4 days ago pensive_hypatia + ec164228902a ubuntu:14.04 "bash" 5 days ago Exited (0) 21 hours ago tiny_aryabhata + 8c2fc6ba883b ubuntu:14.04 "bash" 5 days ago Exited (0) 30 hours ago new-name + #+END_SRC + OR + #+BEGIN_SRC command + $ docker ps -as + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE + 07c5614d5a40 ubuntu:14.04 "bash" 6 minutes ago Up 6 minutes evil_fermi 0 B (virtual 188 MB) + e76ccff0a41a ubuntu:14.04 "bash" 4 days ago Up 17 minutes stoic_bhabha 164 B (virtual 188 MB) + ca251b8c44d8 ubuntu:14.04 "bash" 4 days ago Exited (0) 4 days ago sad_wright 203.8 kB (virtual 188.2 MB) + 58d28030aa5e ubuntu:14.04 "bash" 4 days ago Exited (0) 4 days ago jolly_raman 63.87 MB (virtual 251.8 MB) + 34ab6efd089f lab/problem-solving:01 "bash" 5 days ago Exited (0) 4 days ago insane_yalow 1.385 MB (virtual 788.7 MB) + 4164528c53c3 ubuntu:14.04 "bash" 5 days ago Exited (0) 4 days ago pensive_hypatia 153.1 MB (virtual 341.1 MB) + ec164228902a ubuntu:14.04 "bash" 5 days ago Exited (0) 21 hours ago tiny_aryabhata 1.25 GB (virtual 1.438 GB) + 8c2fc6ba883b ubuntu:14.04 "bash" 5 days ago Exited (0) 30 hours ago new-name 0 B (virtual 188 MB) + #+END_SRC + + flag =a= to view all containers + + flag =s= to view size of containers +** List images + List all the images currently sitting in your local repository/system + #+BEGIN_SRC command + $ docker images + REPOSITORY TAG IMAGE ID CREATED SIZE + labs/speech-recog latest 1e85be4efa89 5 days ago 341.1 MB + lab/problem-solving 01 be7d953b67e6 5 days ago 787.3 MB + meghanab/myapp 1.0 08570d8b4a10 13 days ago 267.3 MB + meghana/new_image1 0.1 2934249749c9 2 weeks ago 252.9 MB + meghana/new_user 1 b5900443b2d7 2 weeks ago 188.3 MB + centos 7 904d6c400333 3 weeks ago 196.8 MB + ubuntu 14.04 8f1bd21bd25c 4 weeks ago 188 MB + #+END_SRC +** List processes running inside a container + + Display the running processes of a container :: + #+BEGIN_SRC command + $ docker top [container] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker top ec164228902a + UID PID PPID C STIME TTY TIME CMD + root 5207 5192 0 20:32 pts/9 00:00:00 bash + #+END_SRC +** Running your container in detached mode + + To run a container in the background as soon as it is created you have to + specify =-d= flag along with the =docker run= command + #+BEGIN_SRC command + $ docker run -d [image] [command] + #+END_SRC + + This will run the command in the background and will automatically shuts down + the container after its execution + For Example: + #+BEGIN_SRC command + $ docker run -d ubuntu:14.04 bash + 698de53f5f4b151122e18b51d4abb813b4e1dff10e30472791dd5ec336fb4b10 + $ + #+END_SRC +** Execute a command inside a container from host machine + + You can execute a command inside a container from the host machine + provided the container is in running state. Otherwise you have to start + the container first and then use the following command + #+BEGIN_SRC command + $ docker exec [OPTIONS] CONTAINER COMMAND [ARG...] + #+END_SRC + For example: + #+BEGIN_SRC command + root@meghana / $ docker ps + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + e76ccff0a41a ubuntu:14.04 "bash" 2 days ago Up About an hour stoic_bhabha + + root@meghana / $ docker exec e76ccff0a41a ping 127.0.0.1 -c 5 + PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. + 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.050 ms + 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.053 ms + 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.055 ms + 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.033 ms + 64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.054 ms + + --- 127.0.0.1 ping statistics --- + 5 packets transmitted, 5 received, 0% packet loss, time 3997ms + rtt min/avg/max/mdev = 0.033/0.049/0.055/0.008 ms + #+END_SRC + + You can use various flags with this command + #+BEGIN_SRC command + -d Detached mode: run command in the background + -i Keep STDIN open even if not attached + -t Allocate a pseudo Terminal + #+END_SRC +** Get inside a container + To get terminal access to container you need to fire some commands. This may be + required to install packages and configure them inside your container. + + Case 1 :: + If you want to enter into a container as soon as you create it: + #+BEGIN_SRC command + $ docker run -it : bash + #+END_SRC + + =-i= flag to connect STDIN on the container + + =-t= flag to get a pseudo terminal + For Example: + #+BEGIN_SRC command + $ docker run -it ubuntua:14.04 bash + root@ec164228902a:~# + #+END_SRC + + + Case 2 :: + If you fire =bash= command inside a container, it runs forever, until + manually stopped. By giving =-d= flag to =docker run= a container executes + and runs in detached mode, with no interaction with user. So to get inside a + container which is running in detached mode: + + Method 1 :: + + Using exec command + #+BEGIN_SRC comand + $ docker exec -it bash + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker exec -it ec164228902a bash + root@ec164228902a:~# + #+END_SRC + + To come out of the container without stopping it :: + #+BEGIN_SRC command + CTRL+P CTRL+Q + #+END_SRC + OR + #+BEGIN_SRC command + # exit + #+END_SRC + For example you are inside the container =ec164228902a=: + #+BEGIN_SRC command + root@ec164228902a:~# exit + root@meghana ~ $ + root@meghana ~ $ docker ps + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 07c5614d5a40 ubuntu:14.04 "bash" 21 minutes ago Up 21 minutes evil_fermi + ec164228902a ubuntu:14.04 "bash" 4 days ago Up 32 minutes stoic_bhabha + #+END_SRC + + Method 2 :: + + Using Attach command + #+BEGIN_SRC command + $ docker attach + #+END_SRC + + You might need to hit Enter to bring up the prompt. + For Example: + #+BEGIN_SRC command + $ docker attach ec164228902 + $ + root@ec164228902:~# + #+END_SRC + + To come out of the container without stopping it :: + #+BEGIN_SRC command + CTRL+P+Q + #+END_SRC +** Auto restart Containers + If your host machine shuts down, all container will be stopped. Once your + restart your machine, all container should automatically start. To add such + behavior to all your containers, you need to add a flag =--restart= in + =docker run= command. + #+BEGIN_SRC command + $ docker run [options] --restart=always [image] [command] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -d -it --restart=always meghanab/app1:0.1 bash + #+END_SRC + + We need to specify whether you want to auto-start your container at the + time of its creation itself. +** Resource allocation options for Docker containers + + Using the =-m= flag with =docker run= command we can limit the memory(RAM) + usage of the containers + #+BEGIN_SRC command + $ docker run -m [] [options] [image] [command] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -d -it -m 300M ubuntu:14.04 bash + WARNING: Your kernel does not support swap limit capabilities, memory limited without swap. + b172827cb899f36e35e0fa587e6f30793f0ed37befe76a1e77b2f9cacc8c905a + $ docker stats --no-stream=true + CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS + b172827cb899 0.00% 712.7 kB / =314.6 MB= 0.23% 4.064 kB / 648 B 114.7 kB / 0 B 0 + ec164228902a 0.00% 4.375 MB / 4.064 GB 0.11% 12.37 kB / 648 B 4.071 MB / 0 B 0 + #+END_SRC + + Thus here we are able to limit the RAM to 300MB + + While for the other container it is 4GB as we didn't mention anything during + its creation, so it takes 4GB(host system RAM) by default. + + Here the =-d= flag lets the container run in detached mode +* Advanced operations in Docker +** Create an image from your container + One can commit a container and can create its image. Thus we can save the state + a container. This image can be used to launch new container with all the + packages installed hence replicating the state of the container. This helps + in creating a reusable image for launching multiple containers with + customized applications of your need. + #+BEGIN_SRC command + $ docker commit : + #For Example: + $ docker commit ec164228902 meghanab/myapp:1.0 + sha256:4069d3511b08f810c6b725f64360f10148a46a8e5f66a111304585e33af1e912 + #+END_SRC +** Dockerfile + Dockerfiles are scripts containing a successive series of instructions, + directions, and commands which are to be executed to form a new docker + image. Each command executed translates to a new layer forming the end + product. They basically replace the process of doing everything manually and + repeatedly. When a Dockerfile is finished executing, you end up + + having formed an image, which then you use to start (i.e. create) a new + container.It is more effective and easier way compared to =docker commit= + + Writing Dockerfile :: + + Docker file instructions: + + =FROM=: for specifying the base image + + =RUN=: for specifying commands to execute + #+BEGIN_SRC command + $ vim Dockerfile + #Example of a Docker File + FROM ubuntu:14.04 + RUN apt-get install -y vim + RUN apt-get insatll -y curl + #+END_SRC + OR + #+BEGIN_SRC command + #Just another way of Docker File + $ vim Dockefile + FROM ubuntu:14.04 + RUN apt-get update && apt-get install -y vim \ + curl + #+END_SRC + + The second method of dockerfile is more preferable as in first case for each run + command an intermediate container gets created and destroyed where as in + second method only one intermediate container will get created and destroyed + + Thus Second method is more preferable. + + Building a image from our Docker File :: + #+BEGIN_SRC command + $ docker build -t [repository]:[tag] [path] + #+END_SRC + + Now you can use this image =[repository]:[tag]= to create containers + For Example: + #+BEGIN_SRC command + $ docker build -t meghanab/new_app:1.0 . + #+END_SRC + + =-t= for specifying the image tag + + =.= to specify the path of Dockerfile. In this case it is the current directory + + Launching a container from our new image :: + #+BEGIN_SRC command + $ docker run [options] [repository]:[tag] [command] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -it -d meghanab/new_app:1.0 bash + root@e76ccff0a41a:~# + #+END_SRC + + Thus a new container will be created and started with vim and curl + pre-installed. Similarly we can install other packages. +*** Some more info on Dockerfile + + CMD Instruction :: + + Defines a default command that will execute when the container is + created/started whose base image is built using dockerfile + + Will not perform any action when the image is being created + + Can only be specified once in a dockerfile + + Can be overriden at run time + For Example: + #+BEGIN_SRC command + FROM ubuntu:14.04 + RUN apt-get update && apt-get install -y vim \ + curl + CMD ping 127.0.0.1 -c 10 + #+END_SRC + + ENTRYPOINT instruction :: + + Defines the command that will run when the container is executed + + Differnt from =CMD= instruction as =ENTRYPOINT= instruction will accept + arguments at run time + #+BEGIN_SRC command + ENTRYPOINT ["executable", "param1", "param2"] + #+END_SRC + For Example: + #+BEGIN_SRC command + FROM ubuntu:14.04 + RUN apt-get update && apt-get install -y vim \ + curl + ENTRYPOINT ["ping"] + #+END_SRC + + Only the last =ENTRYPOINT= instruction in the Dockerfile will have an effect. + + The =ENTRYPOINT= instruction is given in exec form which will take + parameters in json format as it has to accept args at run time + + =CMD= instruction can also be given in exec format + + You can give only one command in the =ENTRYPOINT= instruction + #+BEGIN_SRC command + $ docker run : 127.0.0.1 + #+END_SRC + + EXPOSE instruction :: + The =EXPOSE= command is used to associate a specified port to enable networking + between the running process inside the container and the outside world + (i.e. the host). + For Example: + #+BEGIN_SRC command + # Usage: EXPOSE [port] + EXPOSE 8080EXPOSE + #+END_SRC + + ADD instruction :: + The =ADD= instruction copies new files, directories or remote file URLs + from and adds them to the filesystem of the container at the path + . + #+BEGIN_SRC command + $ ADD ... + OR + $ ADD ["",... ""] (this form is required for paths containing whitespace) + #+END_SRC +** Run a container as a server + + We can run a container as long as you don't kill the process with PID 1 + + If a process with PID 1 is killed inside a container then the container will + automatically stop. + + In the =docker run [options] [image] [command]=, the command which you give + will become the process with PID 1 + + If we give "bash" as command then the container will not stop until we + manually kill bash process in that container. +*** Steps to set up a container as a server + + Create and run a container :: + #+BEGIN_SRC command + $ docker run [options] [image] [command] + #+END_SRC + + So let us give bash command + #+BEGIN_SRC command + $ docker run -i -t ubuntu:14.04 bash + #+END_SRC + + This command will create a new container and will take us inside the + container + + Now if you fire =ps -ax= you can see the bash process with PID 1 + #+BEGIN_SRC command + PID TTY STAT TIME COMMAND + 1 ? Ss+ 0:00 bash + 51 ? R+ 0:00 ps -ax + #+END_SRC + + So now if you fire =exit= you will kill the process bash and you will come out of the container and the + container stops, which is not desired. + + If you want to come out of the container and keep it running in background,then fire :: + #+BEGIN_SRC command + CTRL+P+Q + #+END_SRC + + If the host system is rebooted then this container is stopped. So to avoid + this we have to give =--restart=always= flag at the time of creating + container. This is discussed above in the 'Auto restart containers' section. +** To view the Docker containers resource usage statistics + #+BEGIN_SRC command + $ docker stats --no-stream=true + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker stats --no-stream=true + CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS + 07c5614d5a40 0.00% 544.8 kB / 4.064 GB 0.01% 5.245 kB / 648 B 0 B / 0 B 0 + e76ccff0a41a 0.00% 532.5 kB / 4.064 GB 0.01% 6.214 kB / 648 B 0 B / 0 B 0 + #+END_SRC +** Docker Data Volumes + + Data volumes are designed to persist data. + + These are independent of the container's life cycle i.e even though + containers are deleted volumes persist. + + Volumes are initialized when a container is created. + + Data volumes can be shared and reused among containers. + + Changes to a data volume will not be included when you update an image. + [[./images/volumes.png]] +*** Create Volume + + To create a new volume + #+BEGIN_SRC command + $ docker volume create [OPTIONS] + #+END_SRC + + You can create a volume and then configure the container to use it. + For Example: + #+BEGIN_SRC command + $ docker volume create --name hello + $ docker run -d -v hello:/world + #+END_SRC + + Here the mount is created inside the container's /world directory. +*** Mount Host Directory + To mount a directory from host to your container + #+BEGIN_SRC command + $ docker run [options] -v /:/ [image] [command] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker run -it -v /home/meghana/project:/test ubuntu:14.04 bash + #+END_SRC + + This command mounts the host directory, /home/meghana/project, into the + container at /test + + All the files in /home/meghana/project can accessed from /test inside the + container +*** Inspect + + To get information about one or more volumes + #+BEGIN_SRC command + $ docker volume inspect [OPTIONS] VOLUME [VOLUME...] + #+END_SRC + For example: + #+BEGIN_SRC command + $ docker volume create --name volume_1 + #+END_SRC + #+BEGIN_SRC command + docker volume inspect volume_1 + [ + { + "Name": "volume_1", + "Driver": "local", + "Mountpoint": "/var/lib/docker/volumes/volume_1/_data", + "Labels": {} + } + ] + #+END_SRC +*** Delete Volume + + To delete one or more volumes + #+BEGIN_SRC command + $ docker volume rm [OPTIONS] VOLUME [VOLUME...] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker volume rm volume_1 + volume_1 + #+END_SRC + + You cannot remove a volume which is currently used by a container. +*** List Volumes + + To list all the volumes present + #+BEGIN_SRC command + $ docker volume ls [OPTIONS] + #+END_SRC + #+BEGIN_SRC command + $ docker volume ls + DRIVER VOLUME NAME + local volume_1 + local volume_2 + #+END_SRC +*** Note: + + We cannot add or copy a file of memory more than the free memory + available in a container + + We can check free memory inside a container as follows: + #+BEGIN_SRC command + $ docker exec df -h + #+END_SRC + #+BEGIN_SRC command + $ docker exec ec164228902a df -h + Filesystem Size Used Avail Use% Mounted on + none 37G 28G 7.2G 80% / + tmpfs 1.9G 0 1.9G 0% /dev + tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup + /dev/sda9 37G 28G 7.2G 80% /etc/hosts + shm 64M 0 64M 0% /dev/shm + #+END_SRC + + According to this we cannot copy a file of more than 7.2G into the + container. + + But you can access that file from your machine by using the 'Mount host + directory' feature of Docker data volumes. + + Save the file in your some where in your host directory and mount that as + mentioned in the above section(Mount Host Directory). +** Taking backup of Docker Containers and images +*** Backup Docker Images + + Save the Docker Image :: + #+BEGIN_SRC command + $ docker save -o + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker save -o bkb_image1.tar image1 + #+END_SRC + + This tar file will be stored in your current directory. + + Thus you can save your images and backup them. + + Load the backup image :: + #+BEGIN_SRC command + $ docker load -i + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker load -i bkb_image1.tarx + #+END_SRC + + If you run =docker images= you can see your image +*** Backup Docker Containers + + Export docker containers :: + #+BEGIN_SRC command + $ docker export -o + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker export -o bkb_cntd1.tar 07c5614d5a40 + #+END_SRC + + Exports the contents of a container's filesystem as a tar archive. + + The =docker export= command does not export the contents of volumes + associated with the container. + + Import docker containers :: + #+BEGIN_SRC command + $ docker import + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker import bkb_cntd1.tar + #+END_SRC + + This command will create a new image and then using that image you have + to create your container. +* Docker Hub +** what is a Docker hub? + The Docker Hub is a public registry maintained by Docker, Inc. It contains + images you can download and use to build containers. It also provides + authentication, work group structure, workflow tools like webhooks and build + triggers, and privacy tools like private repositories for storing images you + don't want to share publicly. + You can refer [[https://docs.docker.com/docker-hub/][here]] +** How to use Docker hub? +*** Account creation and login + + create a Docker ID(You can do this through [[https://hub.docker.com/][Docker Hub]]) + + Once you have a Docker ID, log into your account from the command line + #+BEGIN_SRC command + $ docker login + Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. + Username: + Password: + Login Succeeded + #+END_SRC + + Once you have logged in from the command line, you can commit and push to + interact with your repos on Docker Hub. +*** Search for images + You can search the Docker Hub registry via its search interface or by using the + command line interface: + #+BEGIN_SRC command + $ docker search [image] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker search ubuntu:14.04 + NAME DESCRIPTION STARS OFFICIAL AUTOMATED + chef/ubuntu-14.04 An Ubuntu 14.04 Docker Image with Chef Con... 19 + saltstack/ubuntu-14.04-minimal 7 [OK] + saltstack/ubuntu-14.04 5 [OK] + brook/ubuntu-14.04.3-baidupcs https://github.com/GangZhuo/BaiduPCS ... 3 [OK] + breezeight/test-kitchen-ubuntu-14.04 Ubunti 14.04 with chef omnibus installed 1 [OK] + simphonyproject/ubuntu-14.04-remote Ubuntu 14.04 with Remote Access Support 1 [OK] + fernandoacorreia/ubuntu-14.04-oracle-java-1.7 Docker image with Ubuntu 14.04 and Oracle ... 1 [OK] + mostalive/ubuntu-14.04-oracle-jdk8 1 [OK] + linuxmalaysia/docker-ubuntu-14.04-harden Docker Ubuntu harden for security with SSH... 1 [OK] + visualjeff/ubuntu-14.04 0 [OK] + #+END_SRC +*** Pull images + Once you've found the image you want, you can download it with =docker pull= + #+BEGIN_SRC command + $ docker pull [image]:[tag] + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker pull ubuntu:14.04 + 14.04: Pulling from library/ubuntu + 56eb14001ceb: Pulling fs layer + 7ff49c327d83: Downloading [========================> ] 49.15 kB/101.4 kB + 6e532f87f96d: Download complete + 3ce63537e70c: Pulling fs layer + #+END_SRC +*** Push images + In order to push an image in your docker hub the name of the image + should be same as that of the repository in your docker hub account. + #+BEGIN_SRC command + $ docker push yourname/newimage:tag + #+END_SRC + For Example: + #+BEGIN_SRC command + $ docker push meghanab/myapp:1.0 + #+END_SRC + The image will then be uploaded and available for use by your team-mates and/or + the community.You can also make the repository private. + For more info refer this [[https://docs.docker.com/engine/userguide/containers/dockerrepos/][link]] +* Performance Testing + + We tried to analyse the performance of Docker containers by giving load on + 197 Docker containers(each container deployed with one lab) using the + following methods: +** Test using curl command and crontab + Curl is a tool to transfer data from or to a server, using one of the + protocol HTTP, HTTPS out of many supported protocols. Using this feature of + curl command, we tried generating load on containers. Here are the steps - ++ Write a script to send 10000 curl request to a container :: + #+BEGIN_SRC command + root@vlead-pc:~/load-scripts# vim load-test-script.sh + #+END_SRC + #+BEGIN_SRC command + #!/bin/sh + + echo "START TEST : `date`" + a=0 + count=0 + while [ $a -lt 10000 ] + do + curl http://$1 + a=`expr $a + 1` + count=`expr $count + 1` + done + #+END_SRC ++ Write a script to generate crontab entries for executing load-testing script for all containers :: + #+BEGIN_SRC command + root@vlead-pc:~/load-scripts# vim create-crontab.sh + #+END_SRC + #+BEGIN_SRC command + #!/bin/sh + + a=2 + ip="172.17.0." + file=">/root/load-scripts/data" + while [ $a -lt 200 ] + do + echo $1 $2 $ip$a $file$a + a=`expr $a + 1` + done + #+END_SRC ++ Copy paste the ouput of above script in crontab :: + #+BEGIN_SRC command + $ crontab -e + #+END_SRC ++ Write a script to check the =docker stats= :: + #+BEGIN_SRC command + root@vlead-pc:~/load-scripts# cat get-stat.sh + #+END_SRC + #+BEGIN_SRC command + #!/bin/sh + + a=0 + while [ $a -lt 100 ] + do + echo "`docker stats --no-stream=true`" + a=1 + echo "" + done + #+END_SRC ++ Write a script to analyse output of docker stats :: + #+BEGIN_SRC command + #!/bin/sh + + cat $1 | awk '{print $2}' | sed 's/%//g' | sed '/CPU/d' | sed '/^$/d' > ouput.txt + split -l 197 ouput.txt + for i in `find x*` + do + echo "`awk '{ sum += $1 } END { print sum }' $i`" + done + #+END_SRC ++ Following graphs were obtained :: + [[./images/CPU-utilization-bar-graph.png]] + [[./images/CPU-utilizaton-line-graph.png]] + [[./images/memory-utilization-bar-graph.png]] + [[./images/memory-utilization-line-graph.png]] +** Test using siege and sar commands + + Siege is an HTTP load testing and benchmarking utility that can be used to + measure the performance of a web server when under duress. It evaluates the + amount of data transferred, response time of the server, transaction rate, + throughput, concurrency, and times the program returned okay + + sar command is used to collect, report, or save system activity information. + + Using the =siege= command we tried to generate load on the + containers.Following are the steps: + ++ Install sar,siege and configure them :: + + To install sar refer [[http://www.vishalvyas.com/2012/05/installing-system-activity-reporter-sar.html][here]]. + + To install siege refer [[https://www.linode.com/docs/tools-reference/tools/load-testing-with-siege][here]]. ++ Use sar command to get the memory(RAM) usage statistics when the Containes are :: + + Stopped + + Started + + Containers were running + + Apache is started in containers + + Apache is running in containers + #+BEGIN_SRC command + $ sar -r 5 10 + #+END_SRC + + Redirect the output to a file in each case ++ Write a script to generate siege commands :: + #+BEGIN_SRC command + root@vlead-pc:~/load-scripts# vim generate-siege-file.sh + #+END_SRC + #+BEGIN_SRC command + #!/bin/sh + + a=2 + while [ $a -lt 200 ] + do + echo "siege -c $1 -t $2s http://172.17.0.$a &" + echo 'echo "SEIGE CONTAINER $a"' + a=`expr $a + 1` + done + #+END_SRC + + Running this script will generate siege commands for all the containers ++ Copy these siege commands to siege-test.sh :: + #+BEGIN_SRC command + $ sh generate-siege-file.sh [no. of users] [Total time] > siege-test.sh + #+END_SRC ++ Run =sar -r [time interval] [no of times]= and =sh siege-test.sh= + parallely and redirect the output of =sar= command to output file ++ Change the values of 'no of users' and 'total time' and repeat above for + each set of values and redirect the output of =sar= command to output file ++ Take the values of 'Time' and '%mem used' from output file and depict + graphs. You can view the data [[./sar-test.org][here]] + + The following graphs were obtained: + [[./images/memory-usage-time-bar-graph.png]] + [[./images/memory-usage-time-line-graph.png]] + [[./images/memory-usage-container-status-bar-graph.png]] +** Test using Fork bomb + A fork bomb is a denial-of-service attack wherein a process continually + replicates itself to deplete available system resources, slowing down or + crashing the system due to resource starvation. + + =:(){ :|: & };:= This is fork bomb. + + Due to this command you will run out of system resources and you may need + to reboot your system. + + Here we tried to run fork bomb in one of the containers +*** Testing Docker Container without limiting its memory + + Create and run a container :: + #+BEGIN_SRC command + $ docker run -it ubuntu:14.04 bash + root@ec164228902a:~# =:(){ :|: & };: + #+END_SRC + + This container now will ask for more system resources from host + until you run of system resources. + + Since we ran out of resources, the host machine goes down and need to + be rebooted + + Thus we found out that the Docker container asks for system + resources from host when ever required without any limit. + Due to this if the container goes down it will crash the host. + + So we have to limit the memory usage of the container. +*** Testing Docker container after limiting its memory + + Create and run a container(include memory limit) + #+BEGIN_SRC command + $ docker run -it -m=200M ubuntu:14.04 + root@ae164798902a:~# =:(){ :|: & }; + #+END_SRC + + This container will use memory of 200 MB only. If it asks for more than + 200 MB then the container stop. + + To start the container again you have to use =docker start= command and + the container will start normally. + + Thus by limiting memory of a container, if any container crashes the + others will be still running normally + +* Conclusion +With our understanding on docker, there are more features of our interest and limitations are rare. Docker looks a good option to containerize current VM based architecture, reducing the cost to half and stabilizing it with increased scalability. +* Reference ++ Docker Tutorials - https://training.docker.com/self-paced-training ++ Benefits of Docker - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.0_Release_Notes/sect-Red_Hat_Enterprise_Linux-7.0_Release_Notes-Linux_Containers_with_Docker_Format-Advantages_of_Using_Docker.html ++ Docker Architecture - https://docs.docker.com/v1.8/introduction/understanding-docker/ ++ Install Docker - https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-getting-started ++ Docker glossary - https://docs.docker.com/engine/reference/glossary/#union-file-system ++ Docker Commands - https://docs.docker.com/engine/reference/commandline/ ++ Docker file reference - https://docs.docker.com/engine/reference/builder/ ++ Docker Data Volumes - https://docs.docker.com/engine/tutorials/dockervolumes/ + ++ Fork bomb - + http://askubuntu.com/questions/159491/why-did-the-command-make-my-system-lag-so-badly-i-had-to-reboot ++ Crontab - http://www.adminschoice.com/crontab-quick-reference ++ curl command - https://curl.haxx.se/docs/manpage.html ++ Load testing with siege - + https://www.linode.com/docs/tools-reference/tools/load-testing-with-siege ++ Docker forum group - https://groups.google.com/forum/#!forum/docker-user ++ Docker community forums - https://forums.docker.com/ diff --git a/docs/images/CPU-utilization-bar-graph.png b/docs/images/CPU-utilization-bar-graph.png new file mode 100644 index 0000000..52661d9 Binary files /dev/null and b/docs/images/CPU-utilization-bar-graph.png differ diff --git a/docs/images/CPU-utilizaton-line-graph.png b/docs/images/CPU-utilizaton-line-graph.png new file mode 100644 index 0000000..039272c Binary files /dev/null and b/docs/images/CPU-utilizaton-line-graph.png differ diff --git a/docs/images/architecture.png b/docs/images/architecture.png new file mode 100644 index 0000000..5f40d28 Binary files /dev/null and b/docs/images/architecture.png differ diff --git a/docs/images/architecture.svg b/docs/images/architecture.svg new file mode 100644 index 0000000..afe563a --- /dev/null +++ b/docs/images/architecture.svg @@ -0,0 +1,2597 @@ + + + + + 2014-04-15 00:37Z + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/images/docker-layer.jpg b/docs/images/docker-layer.jpg new file mode 100644 index 0000000..35cd521 Binary files /dev/null and b/docs/images/docker-layer.jpg differ diff --git a/docs/images/memory-usage-container-status-bar-graph.png b/docs/images/memory-usage-container-status-bar-graph.png new file mode 100644 index 0000000..b4c5778 Binary files /dev/null and b/docs/images/memory-usage-container-status-bar-graph.png differ diff --git a/docs/images/memory-usage-time-bar-graph.png b/docs/images/memory-usage-time-bar-graph.png new file mode 100644 index 0000000..93be985 Binary files /dev/null and b/docs/images/memory-usage-time-bar-graph.png differ diff --git a/docs/images/memory-usage-time-line-graph.png b/docs/images/memory-usage-time-line-graph.png new file mode 100644 index 0000000..4476b9a Binary files /dev/null and b/docs/images/memory-usage-time-line-graph.png differ diff --git a/docs/images/memory-utilization-bar-graph.png b/docs/images/memory-utilization-bar-graph.png new file mode 100644 index 0000000..92ab256 Binary files /dev/null and b/docs/images/memory-utilization-bar-graph.png differ diff --git a/docs/images/memory-utilization-line-graph.png b/docs/images/memory-utilization-line-graph.png new file mode 100644 index 0000000..c508f79 Binary files /dev/null and b/docs/images/memory-utilization-line-graph.png differ diff --git a/docs/images/volumes.png b/docs/images/volumes.png new file mode 100644 index 0000000..d05d8f0 Binary files /dev/null and b/docs/images/volumes.png differ diff --git a/docs/sar-test-memory-utilization.org b/docs/sar-test-memory-utilization.org new file mode 100644 index 0000000..68849af --- /dev/null +++ b/docs/sar-test-memory-utilization.org @@ -0,0 +1,333 @@ +#+Title: Data for Sar and siege test +#+Date: 28th July, 2016 +* sar command output when containers (197) were not running(Stopped) +#+BEGIN_SRC command + +root@vlead-pc:~# sar -r 5 10 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +01:57:10 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +01:57:15 IST 6019940 2023220 25.15 130676 1187044 4449984 55.33 1075444 650056 60 +01:57:20 IST 6019816 2023344 25.16 130676 1187044 4449984 55.33 1075428 650052 60 +01:57:25 IST 6020064 2023096 25.15 130676 1187048 4449984 55.33 1075468 650052 60 +01:57:30 IST 6019940 2023220 25.15 130684 1187052 4449984 55.33 1075492 650056 52 +01:57:35 IST 6020128 2023032 25.15 130692 1187052 4449984 55.33 1074956 650060 4 +01:57:40 IST 6020252 2022908 25.15 130700 1187052 4449984 55.33 1074948 650064 20 +01:57:45 IST 6020252 2022908 25.15 130700 1187052 4449984 55.33 1074948 650064 20 +01:57:50 IST 6020252 2022908 25.15 130700 1187052 4449984 55.33 1074948 650064 20 +01:57:55 IST 6020252 2022908 25.15 130700 1187052 4449984 55.33 1074948 650064 20 +01:58:00 IST 6024160 2019000 25.10 130700 1183008 4439124 55.19 1074900 646116 16 + Average: 6020506 2022654 25.15 130690 1186646 4448898 55.31 1075148 649665 33 +root@vlead-pc:~# +#+END_SRC + +* sar command output when containers were starting +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 3 100 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:02:30 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:02:33 IST 6010852 2032308 25.27 131368 1189208 4683428 58.23 1082496 652176 120 +02:02:36 IST 5985292 2057868 25.59 131380 1190020 5108956 63.52 1103464 652392 152 +02:02:39 IST 5962976 2080184 25.86 131392 1191036 5496428 68.34 1119052 652756 404 +02:02:42 IST 5942328 2100832 26.12 131392 1192236 5937248 73.82 1131900 653096 476 +02:02:45 IST 5916544 2126616 26.44 131404 1193448 6364680 79.13 1147696 653496 716 +02:02:48 IST 5887096 2156064 26.81 131404 1195152 6785584 84.36 1169192 654364 748 +02:02:51 IST 5875396 2167764 26.95 131416 1196212 7003340 87.07 1172052 654612 984 +02:02:54 IST 5835932 2207228 27.44 131428 1197400 7510820 93.38 1203940 655004 548 +02:02:57 IST 5822112 2221048 27.61 131428 1198480 7753008 96.39 1206628 655368 540 +02:03:00 IST 5793288 2249872 27.97 131440 1199644 8172208 101.60 1225896 655760 748 +02:03:03 IST 5756936 2286224 28.42 131440 1200188 8725396 108.48 1252940 655496 784 +02:03:06 IST 5728388 2314772 28.78 131464 1201212 9081048 112.90 1271656 655836 920 +02:03:09 IST 5707636 2335524 29.04 131476 1202412 9309680 115.75 1281940 656336 960 +02:03:12 IST 5681132 2362028 29.37 131476 1203420 9680796 120.36 1296748 656380 924 +02:03:15 IST 5652776 2390384 29.72 131488 1204552 10070304 125.20 1314388 656724 1144 +02:03:18 IST 5629060 2414100 30.01 131488 1205344 10422944 129.59 1327608 657072 1172 +02:03:21 IST 5590652 2452508 30.49 131500 1206492 10984012 136.56 1355108 657460 1372 +02:03:24 IST 5573240 2469920 30.71 131512 1207572 11178804 138.99 1361152 657828 1416 +02:03:27 IST 5538696 2504464 31.14 131512 1208720 11728904 145.82 1385552 658168 1624 +02:03:30 IST 5509100 2534060 31.51 131524 1209856 12090872 150.32 1404012 658628 548 +02:03:33 IST 5488732 2554428 31.76 131524 1210808 12443476 154.71 1412388 658880 596 +02:03:36 IST 5475240 2567920 31.93 131536 1212132 12630292 157.03 1416244 659492 804 +02:03:39 IST 5441992 2601168 32.34 131548 1213164 13181452 163.88 1438308 659840 840 +02:03:42 IST 5417920 2625240 32.64 131548 1214340 13553388 168.51 1451348 660236 760 +02:03:45 IST 5404896 2638264 32.80 131560 1215276 13769328 171.19 1452800 660460 916 +02:03:48 IST 5366852 2676308 33.27 131560 1216444 14309768 177.91 1479568 660852 948 +02:03:51 IST 5348948 2694212 33.50 131576 1217520 14529932 180.65 1485696 661228 1180 +02:03:54 IST 5307916 2735244 34.01 131588 1218560 15090256 187.62 1515296 661540 1216 +02:03:57 IST 5290732 2752428 34.22 131588 1219692 15301332 190.24 1520252 661892 1436 +02:04:00 IST 5255028 2788132 34.66 131600 1220700 15808752 196.55 1544496 662204 1668 +02:04:03 IST 5230412 2812748 34.97 131600 1221808 16155800 200.86 1557792 662564 1716 +02:04:06 IST 5229352 2813808 34.98 131644 1222328 16115248 200.36 1554456 662732 560 +02:04:09 IST 5235372 2807788 34.91 131676 1222344 16053556 199.59 1548732 662748 648 +02:04:12 IST 5236908 2806252 34.89 131676 1222324 16045056 199.49 1547956 662612 536 +02:04:15 IST 5236548 2806612 34.89 131684 1222984 16043412 199.47 1547964 663236 388 +02:04:18 IST 5236772 2806388 34.89 131684 1223028 16043412 199.47 1547980 663256 388 +02:04:20 IST 5236916 2806244 34.89 131692 1222992 16043412 199.47 1547996 663212 360 + Average: 5563242 2479918 30.83 131519 1208353 11383955 141.54 1361694 658269 845 + +#+END_SRC + +* sar command when containers were running + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 3 10 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:07:44 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:07:47 IST 4789580 3253580 40.45 134928 1470852 16921316 210.38 1746576 900552 40 +02:07:50 IST 4789704 3253456 40.45 134928 1470852 16921316 210.38 1746576 900552 40 +02:07:53 IST 4789580 3253580 40.45 134928 1470852 16921316 210.38 1746596 900532 40 +02:07:56 IST 4793708 3249452 40.40 134928 1466756 16921316 210.38 1746596 896404 40 +02:07:59 IST 4793704 3249456 40.40 134928 1466588 16921316 210.38 1746456 896268 40 +02:08:02 IST 4793804 3249356 40.40 134928 1466732 16921316 210.38 1746288 896436 0 +02:08:05 IST 4793604 3249556 40.40 134936 1466724 16921316 210.38 1746288 896436 0 +02:08:08 IST 4794176 3248984 40.39 134936 1466152 16921316 210.38 1746304 895824 24 +02:08:11 IST 4794284 3248876 40.39 134936 1466152 16921316 210.38 1746304 895824 24 +02:08:14 IST 4794132 3249028 40.39 134936 1466152 16921316 210.38 1746476 895824 24n + Average: 4792628 3250532 40.41 134931 1467781 16921316 210.38 1746446 897465 27 +root@vlead-pc:~# + +#+END_SRC + +* sar command when apache was starting in all containers + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 5 50 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:10:09 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:10:14 IST 4707672 3335488 41.47 135000 1495408 17473368 217.25 1787396 922476 44 +02:10:19 IST 4652540 3390620 42.16 135008 1517740 17894172 222.48 1810504 944536 220 +02:10:24 IST 4598544 3444616 42.83 135016 1539500 18332152 227.92 1833484 966300 360 +02:10:29 IST 4528660 3514500 43.70 135036 1566688 18863812 234.53 1864932 993028 512 +02:10:34 IST 4473064 3570096 44.39 135044 1588444 19287452 239.80 1888304 1014812 684 +02:10:39 IST 4418348 3624812 45.07 135052 1610648 19711036 245.07 1911724 1036800 856 +02:10:44 IST 4350016 3693144 45.92 135060 1637788 20234256 251.57 1940268 1063664 856 +02:10:49 IST 4297612 3745548 46.57 135060 1659512 20670444 256.99 1961368 1085072 1000 +02:10:54 IST 4243108 3800052 47.25 135068 1681320 21100460 262.34 1985764 1106768 412 +02:10:59 IST 4186240 3856920 47.95 135076 1703212 21518560 267.54 2009180 1128440 540 +02:11:04 IST 4115560 3927600 48.83 135092 1730408 22060520 274.28 2041044 1155392 724 +02:11:09 IST 4064212 3978948 49.47 135100 1752040 22479988 279.49 2061100 1176904 836 +02:11:14 IST 4015612 4027548 50.07 135108 1774024 22915120 284.90 2077676 1198548 936 +02:11:19 IST 3959124 4084036 50.78 135116 1795860 23428988 291.29 2103868 1220216 1060 +02:11:24 IST 3897152 4146008 51.55 135140 1823076 23878492 296.88 2126484 1247020 460 +02:11:29 IST 3842436 4200724 52.23 135148 1844804 24305332 302.19 2149324 1268576 576 +02:11:34 IST 3788176 4254984 52.90 135156 1866688 24725352 307.41 2171940 1290160 652 +02:11:39 IST 3716860 4326300 53.79 135164 1893896 25268284 314.16 2203924 1317344 808 +02:11:44 IST 3666604 4376556 54.41 135172 1915776 25689860 319.40 2222528 1338880 924 +02:11:49 IST 3613608 4429552 55.07 135180 1937512 26116912 324.71 2245360 1360560 1000 +02:11:54 IST 3559260 4483900 55.75 135188 1959344 26543832 330.02 2267952 1382144 1068 +02:11:59 IST 3488656 4554504 56.63 135196 1986604 27076984 336.65 2297640 1409120 396 +02:12:04 IST 3434992 4608168 57.29 135204 2008360 27514812 342.09 2320636 1430740 528 +02:12:09 IST 3382644 4660516 57.94 135212 2030148 27931264 347.27 2341124 1452208 656 +02:12:14 IST 3329408 4713752 58.61 135220 2052024 28407188 353.18 2364220 1473968 820 +02:12:19 IST 3261288 4781872 59.45 135228 2079088 28895080 359.25 2391588 1500800 940 +02:12:24 IST 3206892 4836268 60.13 135236 2100908 29322804 364.57 2414544 1522404 1068 +02:12:29 IST 3150620 4892540 60.83 135244 2122776 29759724 370.00 2439368 1544104 1168 +02:12:34 IST 3095576 4947584 61.51 135252 2144688 30173564 375.15 2462312 1565788 412 +02:12:39 IST 3027560 5015600 62.36 135260 2171784 30729872 382.06 2491832 1592716 504 +02:12:44 IST 2972180 5070980 63.05 135268 2193564 31137720 387.13 2514408 1614232 588 +02:12:49 IST 2919248 5123912 63.71 135276 2215480 31573684 392.55 2537004 1635976 724 +02:12:54 IST 2861028 5182132 64.43 135284 2237272 31999488 397.85 2561272 1657548 852 +02:12:59 IST 2801916 5241244 65.16 135292 2264444 32538824 404.55 2583788 1684476 968 +02:13:04 IST 2733520 5309640 66.01 135328 2291644 33069284 411.15 2613992 1711448 1100 +02:13:09 IST 2678888 5364272 66.69 135336 2313504 33490240 416.38 2636412 1733072 408 +02:13:14 IST 2652264 5390896 67.02 135344 2324492 33709324 419.11 2645984 1743940 556 +02:13:19 IST 2651372 5391788 67.04 135352 2324492 33709324 419.11 2645924 1743948 544 +02:13:24 IST 2651136 5392024 67.04 135360 2324508 33709324 419.11 2646176 1743952 48 +02:13:29 IST 2656396 5386764 66.97 135368 2319172 33701328 419.01 2646108 1738624 168 +02:13:34 IST 2625664 5417496 67.36 135368 2334700 33919712 421.72 2657464 1754168 176 +02:13:39 IST 2570596 5472564 68.04 135376 2356652 34349968 427.07 2680212 1775840 208 +02:13:44 IST 2570424 5472736 68.04 135384 2356708 34349968 427.07 2680000 1775824 376 +02:13:49 IST 2575168 5467992 67.98 135384 2351920 34349968 427.07 2680116 1771304 388 +02:13:54 IST 2575804 5467356 67.98 135384 2351892 34341944 426.97 2680144 1771008 44 +02:13:59 IST 2571452 5471708 68.03 135384 2356292 34347012 427.03 2680104 1775448 44 +02:14:04 IST 2505716 5537444 68.85 135392 2383688 34874040 433.59 2708228 1802376 76 +02:14:09 IST 2449356 5593804 69.55 135416 2405684 35307816 438.98 2732200 1824300 220 +02:14:14 IST 2396976 5646184 70.20 135424 2427756 35727664 444.20 2753272 1846228 380 +02:14:19 IST 2340520 5702640 70.90 135464 2449576 36167976 449.67 2777000 1867836 560 + Average: 3376633 4666527 58.02 135224 2031470 27973686 347.79 2344944 1453621 589 +root@vlead-pc:~# + +#+END_SRC + +* sar command when apache was running on all containers + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 3 10 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:16:54 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:16:57 IST 2165324 5877836 73.08 135620 2515396 37327392 464.09 2858360 1932972 20 +02:17:00 IST 2164492 5878668 73.09 135628 2515396 37327392 464.09 2858232 1932968 24 +02:17:03 IST 2165208 5877952 73.08 135632 2514652 37327392 464.09 2858048 1932276 64 +02:17:06 IST 2164940 5878220 73.08 135632 2514724 37327392 464.09 2858320 1932268 64 +02:17:09 IST 2164716 5878444 73.09 135640 2515916 37327392 464.09 2857780 1933412 96 +02:17:12 IST 2164220 5878940 73.09 135640 2515716 37327392 464.09 2858136 1933068 96 +02:17:15 IST 2164168 5878992 73.09 135640 2515716 37327392 464.09 2858176 1933084 96 +02:17:18 IST 2164196 5878964 73.09 135640 2515716 37327392 464.09 2857992 1933084 88 +02:17:21 IST 2164196 5878964 73.09 135648 2515716 37327392 464.09 2857992 1933084 88 +02:17:24 IST 2164444 5878716 73.09 135648 2515508 37327392 464.09 2857964 1932844 108 + Average: 2164590 5878570 73.09 135637 2515446 37327392 464.09 2858100 1932906 74 +root@vlead-pc:~# +#+END_SRC + +* sar command output when siege was running with: +** 2 users for 5 seconds +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:32:09 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:32:11 IST 1343852 6699308 83.29 136500 2522484 41422480 515.00 3435260 1925232 20 +02:32:13 IST 754944 7288216 90.61 136500 2530164 48164008 598.82 3978796 1931380 3680 +02:32:15 IST 720512 7322648 91.04 136500 2533272 48203524 599.31 4003100 1932224 6788 +02:32:17 IST 696204 7346956 91.34 136508 2535948 48248308 599.87 4013560 1932828 9680 +02:32:19 IST 1222648 6820512 84.80 136508 2537064 41617608 517.43 3514236 1933096 10796 +02:32:21 IST 1222524 6820636 84.80 136508 2537064 41617608 517.43 3514208 1933096 10776 +^C +02:32:22 IST 1222524 6820636 84.80 136508 2537064 41617608 517.43 3514208 1933096 10776 + Average: 1026173 7016987 87.24 136505 2533294 44413021 552.18 3710481 1931565 7502 + +#+END_SRC + +** 2 users for 10 seconds +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:34:02 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:34:04 IST 1151416 6891744 85.68 136608 2550800 41642780 517.74 3543792 1937340 15276 +02:34:06 IST 1151416 6891744 85.68 136612 2550724 41642780 517.74 3543712 1937244 15280 +02:34:08 IST 937660 7105500 88.34 136612 2551436 48358736 601.24 3724140 1937928 15312 +02:34:10 IST 936784 7106376 88.35 136612 2551436 48358736 601.24 3724128 1937948 15312 +02:34:12 IST 936412 7106748 88.36 136620 2551440 48358736 601.24 3724108 1937948 15340 +02:34:14 IST 629312 7413848 92.18 136624 2551852 48358736 601.24 4031048 1938072 6164 +02:34:16 IST 615720 7427440 92.34 136652 2555120 48358736 601.24 4044364 1938912 6140 +02:34:18 IST 1136860 6906300 85.87 136652 2558104 41679924 518.20 3554096 1939308 8856 +02:34:20 IST 1137996 6905164 85.85 136652 2558108 41679924 518.20 3554060 1939312 8860 +^C +02:34:21 IST 1137720 6905440 85.85 136652 2558108 41679924 518.20 3554104 1939344 8860 + Average: 977130 7066030 87.85 136630 2553713 45011901 559.63 3699755 1938336 11540 + +#+END_SRC + +** 2 users for 15 seconds + +#+BEGIN_SRC command +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:37:30 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:37:32 IST 1170016 6873144 85.45 137072 2555988 41637804 517.68 3571044 1936236 604 +02:37:34 IST 601560 7441600 92.52 137080 2561744 48367676 601.35 4098100 1941320 2712 +02:37:36 IST 581908 7461252 92.77 137080 2564712 48367676 601.35 4111912 1942188 5776 +02:37:38 IST 591016 7452144 92.65 137080 2567860 48367676 601.35 4093524 1943040 8532 +02:37:40 IST 584888 7458272 92.73 137088 2570816 48367676 601.35 4088412 1943900 11908 +02:37:42 IST 573884 7469276 92.86 137088 2573964 48367676 601.35 4093732 1944796 15056 +02:37:44 IST 560828 7482332 93.03 137100 2577024 48367676 601.35 4098348 1945628 18308 +02:37:46 IST 548480 7494680 93.18 137100 2580196 48367676 601.35 4103184 1946536 21480 +02:37:48 IST 891056 7152104 88.92 137100 2583344 47056084 585.04 3757988 1947404 24628 +02:37:50 IST 1123104 6920056 86.04 137108 2584084 41648448 517.81 3553808 1947872 25596 +^C +02:37:50 IST 1123104 6920056 86.04 137108 2584084 41648448 517.81 3553808 1947872 25596 + Average: 759077 7284083 90.56 137091 2573074 46414956 577.07 3920351 1944254 14563 +#+END_SRC + +** 5 users for 5 seconds +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:39:37 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:39:39 IST 1134528 6908632 85.89 137216 2582488 41636156 517.66 3563932 1946348 104 +02:39:41 IST 209644 7833516 97.39 136888 2579176 54547532 678.19 4381248 1947204 3172 +02:39:43 IST 133556 7909604 98.34 95112 2276800 56880728 707.19 4444960 1834504 5448 +02:39:45 IST 134356 7908804 98.33 79508 2222636 57081704 709.69 4468196 1793996 9260 +02:39:47 IST 1291488 6751672 83.94 79528 2223436 44619984 554.76 3401156 1794184 3000 +02:39:49 IST 1294508 6748652 83.91 79528 2223452 44619984 554.76 3400992 1793984 2924 +^C + +02:39:51 IST 1295440 6747720 83.89 79540 2223368 44611640 554.65 3400492 1793912 4536 +Average: 784789 7258371 90.24 98189 2333051 49142533 610.99 3865854 1843447 4063 + +#+END_SRC +** 5 users for 10 seconds + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:40:38 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:40:40 IST 1302064 6741096 83.81 79580 2218180 44592192 554.41 3406096 1788568 400 +02:40:42 IST 223900 7819260 97.22 57880 2189612 56261948 699.50 4466332 1755848 3468 +02:40:44 IST 207568 7835592 97.42 56660 2160248 56261948 699.50 4503844 1727348 5856 +02:40:46 IST 197020 7846140 97.55 56668 2150020 56269840 699.60 4514848 1719984 9656 +02:40:48 IST 189056 7854104 97.65 56668 2142484 56277804 699.70 4518160 1715568 11788 +02:40:50 IST 182460 7860700 97.73 56672 2136040 56277804 699.70 4522684 1711472 14400 +02:40:52 IST 1317056 6726104 83.63 56768 2132968 44661336 555.27 3434804 1710032 16512 +^C + +02:40:54 IST 1317508 6725652 83.62 56892 2132556 44661336 555.27 3435148 1709756 16512 +Average: 617079 7426081 92.33 59724 2157764 51908026 645.37 4100240 1729822 9824 + +#+END_SRC + +** 5 users for 15 seconds + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:42:09 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:42:11 IST 1338848 6704312 83.35 57104 2127040 44653108 555.17 3437516 1704324 116 +02:42:13 IST 583992 7459168 92.74 57112 2132856 56297104 699.94 4143796 1709788 1360 +02:42:15 IST 159420 7883740 98.02 46504 2111584 56297104 699.94 4581452 1690616 4672 +02:42:17 IST 167124 7876036 97.92 40104 2088376 56297104 699.94 4586024 1671272 7264 +02:42:19 IST 164520 7878640 97.95 37788 2083356 56297104 699.94 4588660 1664752 10692 +02:42:21 IST 164912 7878248 97.95 37788 2083588 56297104 699.94 4589020 1664920 11236 +02:42:23 IST 164904 7878256 97.95 37788 2083592 56297104 699.94 4589020 1664920 11240 +02:42:25 IST 165248 7877912 97.95 37632 2082620 56297104 699.94 4588736 1664028 11536 +02:42:27 IST 767168 7275992 90.46 37632 2083272 50664604 629.91 4006400 1664432 11540 +02:42:29 IST 1373864 6669296 82.92 37632 2083384 44672900 555.41 3426496 1664764 11768 +^C + +02:42:30 IST 1374064 6669096 82.92 37640 2083384 44672900 555.41 3426480 1664824 11768 +Average: 584006 7459154 92.74 42248 2094823 52613022 654.13 4178509 1675331 8472 + +#+END_SRC + +** 10 users for 5 seconds + +#+BEGIN_SRC command +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:43:30 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:43:32 IST 1408136 6635024 82.49 37688 2077616 44664340 555.31 3428484 1659124 208 +02:43:34 IST 255984 7787176 96.82 37688 2084080 56708104 705.05 4520540 1665056 1692 +02:43:36 IST 149172 7893988 98.15 27344 1648360 63145720 785.09 4686884 1450476 4108 +02:43:38 IST 154292 7888868 98.08 2604 1399596 67533604 839.64 4665844 1319452 5204 +02:43:40 IST 904740 7138420 88.75 3152 1386480 57704272 717.43 3930064 1311884 5380 +02:43:42 IST 1488620 6554540 81.49 3160 1396156 52820724 656.72 3429580 1317872 8180 +^C +02:43:44 IST 1967332 6075828 75.54 3188 1397276 47817536 594.51 3073652 1318220 10072 + Average: 904039 7139121 88.76 16403 1627081 55770614 693.39 3962150 1434583 4978 +#+END_SRC + +** 10 users for 10 seconds + +#+BEGIN_SRC command + + + +root@vlead-pc:~# sar -r 2 200 +Linux 3.13.0-24-generic (vlead-pc) Tuesday 28 June 2016 _x86_64_ (4 CPU) + +02:44:44 IST kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty +02:44:46 IST 2252544 5790616 71.99 4616 1433872 44554036 553.94 2924728 1355396 80 +02:44:48 IST 895208 7147952 88.87 4624 1436396 64714460 804.59 4201568 1357504 1136 +02:44:50 IST 101452 7941708 98.74 4396 1405140 68695376 854.08 4842968 1322040 3988 + + +#+END_SRC diff --git a/documentation-template.org b/documentation-template.org deleted file mode 100644 index 71d1138..0000000 --- a/documentation-template.org +++ /dev/null @@ -1,20 +0,0 @@ -#+Title: Document template for Docker Project -#+Author: Ashay Maheshwari -#+Date: June 14, 2016 - - -* Introduction to Docker -* How to Install docker on Ubuntu 14.04 -* Check if docker is installed -* Docker Hub -* Basic operations in docker -** Set up container using base image -** Create/Destroy a container -** Start/Stop a container -** List containers -** List processes in a container -** How to create a container which can run for ever -** Attaching a container -** Get inside container -** Save the state of container -* Run a simple web application from container diff --git a/license.org b/license.org new file mode 100644 index 0000000..4d1d017 --- /dev/null +++ b/license.org @@ -0,0 +1,862 @@ +#+TITLE: Licensing policy at VLEAD +#+AUTHOR: VLEAD +#+DATE: [2018-04-11 Wed] +#+SETUPFILE: ./org-templates/level-0.org +#+TAGS: boilerplate(b) lu tsk txt sup +#+EXCLUDE_TAGS: boilerplate +#+OPTIONS: ^:nil' prop:t + + +* Introduction + This document provides information on the licenses used at + Virtual Labs. + +* Content Licensing + All content of Virtual Labs is licensed under + [[https://creativecommons.org/licenses/by-nc-sa/4.0/][Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)]]. + +** License content + Attribution-NonCommercial-ShareAlike 4.0 International + (CC BY-NC-SA 4.0) This is a human-readable summary of + (and not a substitute for) the license. Disclaimer. You + are free to: + + Share - copy and redistribute the material in any medium + or format + + Adapt - remix, transform, and build upon the material + + The licensor cannot revoke these freedoms as long as you + follow the license terms. + + + Under the following terms: + + Attribution - You must give appropriate credit, provide a + link to the license, and indicate if changes were + made. You may do so in any reasonable manner, but not in + any way that suggests the licensor endorses you or your + use. + + NonCommercial - You may not use the material for + commercial purposes. + + ShareAlike - If you remix, transform, or build upon the + material, you must distribute your contributions under + the same license as the original. + + No additional restrictions - You may not apply legal + terms or technological measures that legally restrict + others from doing anything the license permits. + + Notices: + + You do not have to comply with the license for elements + of the material in the public domain or where your use + is permitted by an applicable exception or limitation. + No warranties are given. The license may not give you + all of the permissions necessary for your intended + use. For example, other rights such as publicity, + privacy, or moral rights may limit how you use the + material. + +* Software Licensing + Virtual Labs software - experiments, platform and + services - is licensed under [[https://www.gnu.org/licenses/agpl-3.0.en.html][GNU AFFERO GENERAL PUBLIC LICENSE, Version 3(AGPL-3.0))]] + +** License Content + GNU AFFERO GENERAL PUBLIC LICENSE + + Version 3, 19 November 2007 + + Copyright © 2007 Free Software Foundation, + Inc. Everyone is permitted to copy and + distribute verbatim copies of this license document, but + changing it is not allowed. + + *Preamble* + + The GNU Affero General Public License is a free, copyleft + license for software and other kinds of works, + specifically designed to ensure cooperation with the + community in the case of network server software. + + The licenses for most software and other practical works + are designed to take away your freedom to share and + change the works. By contrast, our General Public + Licenses are intended to guarantee your freedom to share + and change all versions of a program--to make sure it + remains free software for all its users. + + When we speak of free software, we are referring to + freedom, not price. Our General Public Licenses are + designed to make sure that you have the freedom to + distribute copies of free software (and charge for them + if you wish), that you receive source code or can get it + if you want it, that you can change the software or use + pieces of it in new free programs, and that you know you + can do these things. + + Developers that use our General Public Licenses protect + your rights with two steps: (1) assert copyright on the + software, and (2) offer you this License which gives you + legal permission to copy, distribute and/or modify the + software. + + A secondary benefit of defending all users' freedom is + that improvements made in alternate versions of the + program, if they receive widespread use, become available + for other developers to incorporate. Many developers of + free software are heartened and encouraged by the + resulting cooperation. However, in the case of software + used on network servers, this result may fail to come + about. The GNU General Public License permits making a + modified version and letting the public access it on a + server without ever releasing its source code to the + public. + + The GNU Affero General Public License is designed + specifically to ensure that, in such cases, the modified + source code becomes available to the community. It + requires the operator of a network server to provide the + source code of the modified version running there to the + users of that server. Therefore, public use of a modified + version, on a publicly accessible server, gives the + public access to the source code of the modified version. + + An older license, called the Affero General Public + License and published by Affero, was designed to + accomplish similar goals. This is a different license, + not a version of the Affero GPL, but Affero has released + a new version of the Affero GPL which permits relicensing + under this license. + + The precise terms and conditions for copying, + distribution and modification follow. + + + *TERMS AND CONDITIONS* + + +*** 0. Definitions. + + "This License" refers to version 3 of the GNU Affero + General Public License. + + "Copyright" also means copyright-like laws that apply to + other kinds of works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed + under this License. Each licensee is addressed as + "you". "Licensees" and "recipients" may be individuals or + organizations. + + To "modify" a work means to copy from or adapt all or + part of the work in a fashion requiring copyright + permission, other than the making of an exact copy. The + resulting work is called a "modified version" of the + earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a + work based on the Program. + + To "propagate" a work means to do anything with it that, + without permission, would make you directly or + secondarily liable for infringement under applicable + copyright law, except executing it on a computer or + modifying a private copy. Propagation includes copying, + distribution (with or without modification), making + available to the public, and in some countries other + activities as well. + + To "convey" a work means any kind of propagation that + enables other parties to make or receive copies. Mere + interaction with a user through a computer network, with + no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal + Notices" to the extent that it includes a convenient and + prominently visible feature that (1) displays an + appropriate copyright notice, and (2) tells the user that + there is no warranty for the work (except to the extent + that warranties are provided), that licensees may convey + the work under this License, and how to view a copy of + this License. If the interface presents a list of user + commands or options, such as a menu, a prominent item in + the list meets this criterion. + +*** 1. Source Code. + + The "source code" for a work means the preferred form of + the work for making modifications to it. "Object code" + means any non-source form of a work. + + A "Standard Interface" means an interface that either is + an official standard defined by a recognized standards + body, or, in the case of interfaces specified for a + particular programming language, one that is widely used + among developers working in that language. + + The "System Libraries" of an executable work include + anything, other than the work as a whole, that (a) is + included in the normal form of packaging a Major + Component, but which is not part of that Major Component, + and (b) serves only to enable use of the work with that + Major Component, or to implement a Standard Interface for + which an implementation is available to the public in + source code form. A "Major Component", in this context, + means a major essential component (kernel, window system, + and so on) of the specific operating system (if any) on + which the executable work runs, or a compiler used to + produce the work, or an object code interpreter used to + run it. + + The "Corresponding Source" for a work in object code form + means all the source code needed to generate, install, + and (for an executable work) run the object code and to + modify the work, including scripts to control those + activities. However, it does not include the work's + System Libraries, or general-purpose tools or generally + available free programs which are used unmodified in + performing those activities but which are not part of the + work. For example, Corresponding Source includes + interface definition files associated with source files + for the work, and the source code for shared libraries + and dynamically linked subprograms that the work is + specifically designed to require, such as by intimate + data communication or control flow between those + subprograms and other parts of the work. + + The Corresponding Source need not include anything that + users can regenerate automatically from other parts of + the Corresponding Source. + + The Corresponding Source for a work in source code form + is that same work. + + +*** 2. Basic Permissions. + + All rights granted under this License are granted for the + term of copyright on the Program, and are irrevocable + provided the stated conditions are met. This License + explicitly affirms your unlimited permission to run the + unmodified Program. The output from running a covered + work is covered by this License only if the output, given + its content, constitutes a covered work. This License + acknowledges your rights of fair use or other equivalent, + as provided by copyright law. + + You may make, run and propagate covered works that you do + not convey, without conditions so long as your license + otherwise remains in force. You may convey covered works + to others for the sole purpose of having them make + modifications exclusively for you, or provide you with + facilities for running those works, provided that you + comply with the terms of this License in conveying all + material for which you do not control copyright. Those + thus making or running the covered works for you must do + so exclusively on your behalf, under your direction and + control, on terms that prohibit them from making any + copies of your copyrighted material outside their + relationship with you. + + Conveying under any other circumstances is permitted + solely under the conditions stated below. Sublicensing is + not allowed; section 10 makes it unnecessary. + +*** 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective + technological measure under any applicable law fulfilling + obligations under article 11 of the WIPO copyright treaty + adopted on 20 December 1996, or similar laws prohibiting + or restricting circumvention of such measures. + + When you convey a covered work, you waive any legal power + to forbid circumvention of technological measures to the + extent such circumvention is effected by exercising + rights under this License with respect to the covered + work, and you disclaim any intention to limit operation + or modification of the work as a means of enforcing, + against the work's users, your or third parties' legal + rights to forbid circumvention of technological measures. + +*** 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source + code as you receive it, in any medium, provided that you + conspicuously and appropriately publish on each copy an + appropriate copyright notice; keep intact all notices + stating that this License and any non-permissive terms + added in accord with section 7 apply to the code; keep + intact all notices of the absence of any warranty; and + give all recipients a copy of this License along with the + Program. + + You may charge any price or no price for each copy that + you convey, and you may offer support or warranty + protection for a fee. + +*** 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the + modifications to produce it from the Program, in the form + of source code under the terms of section 4, provided + that you also meet all of these conditions: + + - a) The work must carry prominent notices stating that + you modified it, and giving a relevant date. + + - b) The work must carry prominent notices stating that it + is released under this License and any conditions added + under section 7. This requirement modifies the + requirement in section 4 to "keep intact all notices". + + - c) You must license the entire work, as a whole, under + this License to anyone who comes into possession of a + copy. This License will therefore apply, along with any + applicable section 7 additional terms, to the whole of + the work, and all its parts, regardless of how they are + packaged. This License gives no permission to license + the work in any other way, but it does not invalidate + such permission if you have separately received it. + + - d) If the work has interactive user interfaces, each + must display Appropriate Legal Notices; however, if the + Program has interactive interfaces that do not display + Appropriate Legal Notices, your work need not make them + do so. + + A compilation of a covered work with other separate and + independent works, which are not by their nature + extensions of the covered work, and which are not + combined with it such as to form a larger program, in or + on a volume of a storage or distribution medium, is + called an "aggregate" if the compilation and its + resulting copyright are not used to limit the access or + legal rights of the compilation's users beyond what the + individual works permit. Inclusion of a covered work in + an aggregate does not cause this License to apply to the + other parts of the aggregate. + +*** 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under + the terms of sections 4 and 5, provided that you also + convey the machine-readable Corresponding Source under + the terms of this License, in one of these ways: + + - a) Convey the object code in, or embodied in, a + physical product (including a physical distribution + medium), accompanied by the Corresponding Source fixed + on a durable physical medium customarily used for + software interchange. + + - b) Convey the object code in, or embodied in, a + physical product (including a physical distribution + medium), accompanied by a written offer, valid for at + least three years and valid for as long as you offer + spare parts or customer support for that product model, + to give anyone who possesses the object code either (1) + a copy of the Corresponding Source for all the software + in the product that is covered by this License, on a + durable physical medium customarily used for software + interchange, for a price no more than your reasonable + cost of physically performing this conveying of source, + or (2) access to copy the Corresponding Source from a + network server at no charge. + + - c) Convey individual copies of the object code with a + copy of the written offer to provide the Corresponding + Source. This alternative is allowed only occasionally + and noncommercially, and only if you received the + object code with such an offer, in accord with + subsection 6b. + + - d) Convey the object code by offering access from a + designated place (gratis or for a charge), and offer + equivalent access to the Corresponding Source in the + same way through the same place at no further + charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the + place to copy the object code is a network server, the + Corresponding Source may be on a different server + (operated by you or a third party) that supports + equivalent copying facilities, provided you maintain + clear directions next to the object code saying where + to find the Corresponding Source. Regardless of what + server hosts the Corresponding Source, you remain + obligated to ensure that it is available for as long as + needed to satisfy these requirements. + + - e) Convey the object code using peer-to-peer + transmission, provided you inform other peers where the + object code and Corresponding Source of the work are + being offered to the general public at no charge under + subsection 6d. + + A separable portion of the object code, whose source code + is excluded from the Corresponding Source as a System + Library, need not be included in conveying the object + code work. + + A "User Product" is either (1) a "consumer product", + which means any tangible personal property which is + normally used for personal, family, or household + purposes, or (2) anything designed or sold for + incorporation into a dwelling. In determining whether a + product is a consumer product, doubtful cases shall be + resolved in favor of coverage. For a particular product + received by a particular user, "normally used" refers to + a typical or common use of that class of product, + regardless of the status of the particular user or of the + way in which the particular user actually uses, or + expects or is expected to use, the product. A product is + a consumer product regardless of whether the product has + substantial commercial, industrial or non-consumer uses, + unless such uses represent the only significant mode of + use of the product. + + "Installation Information" for a User Product means any + methods, procedures, authorization keys, or other + information required to install and execute modified + versions of a covered work in that User Product from a + modified version of its Corresponding Source. The + information must suffice to ensure that the continued + functioning of the modified object code is in no case + prevented or interfered with solely because modification + has been made. + + If you convey an object code work under this section in, + or with, or specifically for use in, a User Product, and + the conveying occurs as part of a transaction in which + the right of possession and use of the User Product is + transferred to the recipient in perpetuity or for a fixed + term (regardless of how the transaction is + characterized), the Corresponding Source conveyed under + this section must be accompanied by the Installation + Information. But this requirement does not apply if + neither you nor any third party retains the ability to + install modified object code on the User Product (for + example, the work has been installed in ROM). + + The requirement to provide Installation Information does + not include a requirement to continue to provide support + service, warranty, or updates for a work that has been + modified or installed by the recipient, or for the User + Product in which it has been modified or + installed. Access to a network may be denied when the + modification itself materially and adversely affects the + operation of the network or violates the rules and + protocols for communication across the network. + + Corresponding Source conveyed, and Installation + Information provided, in accord with this section must be + in a format that is publicly documented (and with an + implementation available to the public in source code + form), and must require no special password or key for + unpacking, reading or copying. + +*** 7. Additional Terms. + + "Additional permissions" are terms that supplement the + terms of this License by making exceptions from one or + more of its conditions. Additional permissions that are + applicable to the entire Program shall be treated as + though they were included in this License, to the extent + that they are valid under applicable law. If additional + permissions apply only to part of the Program, that part + may be used separately under those permissions, but the + entire Program remains governed by this License without + regard to the additional permissions. + + When you convey a copy of a covered work, you may at your + option remove any additional permissions from that copy, + or from any part of it. (Additional permissions may be + written to require their own removal in certain cases + when you modify the work.) You may place additional + permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright + permission. + + Notwithstanding any other provision of this License, for + material you add to a covered work, you may (if + authorized by the copyright holders of that material) + supplement the terms of this License with terms: + + - a) Disclaiming warranty or limiting liability + differently from the terms of sections 15 and 16 of + this License; or + + - b) Requiring preservation of specified reasonable legal + notices or author attributions in that material or in + the Appropriate Legal Notices displayed by works + containing it; or + + - c) Prohibiting misrepresentation of the origin of that + material, or requiring that modified versions of such + material be marked in reasonable ways as different from + the original version; or + + - d) Limiting the use for publicity purposes of names of + licensors or authors of the material; or + + - e) Declining to grant rights under trademark law for + use of some trade names, trademarks, or service marks; + or + + - f) Requiring indemnification of licensors and authors + of that material by anyone who conveys the material (or + modified versions of it) with contractual assumptions + of liability to the recipient, for any liability that + these contractual assumptions directly impose on those + licensors and authors. + + All other non-permissive additional terms are considered + "further restrictions" within the meaning of + section 10. If the Program as you received it, or any + part of it, contains a notice stating that it is governed + by this License along with a term that is a further + restriction, you may remove that term. If a license + document contains a further restriction but permits + relicensing or conveying under this License, you may add + to a covered work material governed by the terms of that + license document, provided that the further restriction + does not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this + section, you must place, in the relevant source files, a + statement of the additional terms that apply to those + files, or a notice indicating where to find the + applicable terms. + + Additional terms, permissive or non-permissive, may be + stated in the form of a separately written license, or + stated as exceptions; the above requirements apply either + way. + + +*** 8. Termination. + + You may not propagate or modify a covered work except as + expressly provided under this License. Any attempt + otherwise to propagate or modify it is void, and will + automatically terminate your rights under this License + (including any patent licenses granted under the third + paragraph of section 11). + + However, if you cease all violation of this License, then + your license from a particular copyright holder is + reinstated (a) provisionally, unless and until the + copyright holder explicitly and finally terminates your + license, and (b) permanently, if the copyright holder + fails to notify you of the violation by some reasonable + means prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder + is reinstated permanently if the copyright holder + notifies you of the violation by some reasonable means, + this is the first time you have received notice of + violation of this License (for any work) from that + copyright holder, and you cure the violation prior to 30 + days after your receipt of the notice. + + Termination of your rights under this section does not + terminate the licenses of parties who have received + copies or rights from you under this License. If your + rights have been terminated and not permanently + reinstated, you do not qualify to receive new licenses + for the same material under section 10. + + +*** 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to + receive or run a copy of the Program. Ancillary + propagation of a covered work occurring solely as a + consequence of using peer-to-peer transmission to receive + a copy likewise does not require acceptance. However, + nothing other than this License grants you permission to + propagate or modify any covered work. These actions + infringe copyright if you do not accept this + License. Therefore, by modifying or propagating a covered + work, you indicate your acceptance of this License to do + so. + +*** 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient + automatically receives a license from the original + licensors, to run, modify and propagate that work, + subject to this License. You are not responsible for + enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring + control of an organization, or substantially all assets + of one, or subdividing an organization, or merging + organizations. If propagation of a covered work results + from an entity transaction, each party to that + transaction who receives a copy of the work also receives + whatever licenses to the work the party's predecessor in + interest had or could give under the previous paragraph, + plus a right to possession of the Corresponding Source of + the work from the predecessor in interest, if the + predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the + exercise of the rights granted or affirmed under this + License. For example, you may not impose a license fee, + royalty, or other charge for exercise of rights granted + under this License, and you may not initiate litigation + (including a cross-claim or counterclaim in a lawsuit) + alleging that any patent claim is infringed by making, + using, selling, offering for sale, or importing the + Program or any portion of it. + +*** 11. Patents. + + A "contributor" is a copyright holder who authorizes use + under this License of the Program or a work on which the + Program is based. The work thus licensed is called the + contributor's "contributor version". + + A contributor's "essential patent claims" are all patent + claims owned or controlled by the contributor, whether + already acquired or hereafter acquired, that would be + infringed by some manner, permitted by this License, of + making, using, or selling its contributor version, but do + not include claims that would be infringed only as a + consequence of further modification of the contributor + version. For purposes of this definition, "control" + includes the right to grant patent sublicenses in a + manner consistent with the requirements of this License. + + Each contributor grants you a non-exclusive, worldwide, + royalty-free patent license under the contributor's + essential patent claims, to make, use, sell, offer for + sale, import and otherwise run, modify and propagate the + contents of its contributor version. + + In the following three paragraphs, a "patent license" is + any express agreement or commitment, however denominated, + not to enforce a patent (such as an express permission to + practice a patent or covenant not to sue for patent + infringement). To "grant" such a patent license to a + party means to make such an agreement or commitment not + to enforce a patent against the party. + + If you convey a covered work, knowingly relying on a + patent license, and the Corresponding Source of the work + is not available for anyone to copy, free of charge and + under the terms of this License, through a publicly + available network server or other readily accessible + means, then you must either (1) cause the Corresponding + Source to be so available, or (2) arrange to deprive + yourself of the benefit of the patent license for this + particular work, or (3) arrange, in a manner consistent + with the requirements of this License, to extend the + patent license to downstream recipients. "Knowingly + relying" means you have actual knowledge that, but for + the patent license, your conveying the covered work in a + country, or your recipient's use of the covered work in a + country, would infringe one or more identifiable patents + in that country that you have reason to believe are + valid. + + If, pursuant to or in connection with a single + transaction or arrangement, you convey, or propagate by + procuring conveyance of, a covered work, and grant a + patent license to some of the parties receiving the + covered work authorizing them to use, propagate, modify + or convey a specific copy of the covered work, then the + patent license you grant is automatically extended to all + recipients of the covered work and works based on it. + + A patent license is "discriminatory" if it does not + include within the scope of its coverage, prohibits the + exercise of, or is conditioned on the non-exercise of one + or more of the rights that are specifically granted under + this License. You may not convey a covered work if you + are a party to an arrangement with a third party that is + in the business of distributing software, under which you + make payment to the third party based on the extent of + your activity of conveying the work, and under which the + third party grants, to any of the parties who would + receive the covered work from you, a discriminatory + patent license (a) in connection with copies of the + covered work conveyed by you (or copies made from those + copies), or (b) primarily for and in connection with + specific products or compilations that contain the + covered work, unless you entered into that arrangement, + or that patent license was granted, prior to 28 + March 2007. + + Nothing in this License shall be construed as excluding + or limiting any implied license or other defenses to + infringement that may otherwise be available to you under + applicable patent law. + +*** 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, + agreement or otherwise) that contradict the conditions of + this License, they do not excuse you from the conditions + of this License. If you cannot convey a covered work so + as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a + consequence you may not convey it at all. For example, if + you agree to terms that obligate you to collect a royalty + for further conveying from those to whom you convey the + Program, the only way you could satisfy both those terms + and this License would be to refrain entirely from + conveying the Program. + +*** 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if + you modify the Program, your modified version must + prominently offer all users interacting with it remotely + through a computer network (if your version supports such + interaction) an opportunity to receive the Corresponding + Source of your version by providing access to the + Corresponding Source from a network server at no charge, + through some standard or customary means of facilitating + copying of software. This Corresponding Source shall + include the Corresponding Source for any work covered by + version 3 of the GNU General Public License that is + incorporated pursuant to the following paragraph. + + Notwithstanding any other provision of this License, you + have permission to link or combine any covered work with a + work licensed under version 3 of the GNU General Public + License into a single combined work, and to convey the + resulting work. The terms of this License will continue to + apply to the part which is the covered work, but the work + with which it is combined will remain governed by version + 3 of the GNU General Public License. + + +*** 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or + new versions of the GNU Affero General Public License from + time to time. Such new versions will be similar in spirit + to the present version, but may differ in detail to + address new problems or concerns. + + Each version is given a distinguishing version number. If + the Program specifies that a certain numbered version of + the GNU Affero General Public License "or any later + version" applies to it, you have the option of following + the terms and conditions either of that numbered version + or of any later version published by the Free Software + Foundation. If the Program does not specify a version + number of the GNU Affero General Public License, you may + choose any version ever published by the Free Software + Foundation. + + If the Program specifies that a proxy can decide which + future versions of the GNU Affero General Public License + can be used, that proxy's public statement of acceptance + of a version permanently authorizes you to choose that + version for the Program. + + Later license versions may give you additional or + different permissions. However, no additional obligations + are imposed on any author or copyright holder as a result + of your choosing to follow a later version. + +*** 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT + PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED + IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES + PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, + EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE + QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD + THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL + NECESSARY SERVICING, REPAIR OR CORRECTION. + + +*** 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO + IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY + WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED + ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM + (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING + RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY + OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS + BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +*** 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability + provided above cannot be given local legal effect + according to their terms, reviewing courts shall apply + local law that most closely approximates an absolute + waiver of all civil liability in connection with the + Program, unless a warranty or assumption of liability + accompanies a copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + + *How to Apply These Terms to Your New Programs* + + If you develop a new program, and you want it to be of the + greatest possible use to the public, the best way to + achieve this is to make it free software which everyone + can redistribute and change under these terms. + + To do so, attach the following notices to the program. It + is safest to attach them to the start of each source file + to most effectively state the exclusion of warranty; and + each file should have at least the "copyright" line and a + pointer to where the full notice is found. + +#+BEGIN_EXAMPLE + Copyright (C) + + This program is free software: you can redistribute it + and/or modify it under the terms of the GNU Affero + General Public License as published by the Free Software + Foundation, either version 3 of the License, or (at your + option) any later version. + + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. See the GNU Affero General Public + License for more details. + + You should have received a copy of the GNU Affero + General Public License along with this program. If not, + see . + +#+END_EXAMPLE + + Also add information on how to contact you by electronic + and paper mail. + + If your software can interact with users remotely through + a computer network, you should also make sure that it + provides a way for users to get its source. For example, + if your program is a web application, its interface could + display a "Source" link that leads users to an archive of + the code. There are many ways you could offer source, and + different solutions will be better for different programs; + see section 13 for the specific requirements. + + You should also get your employer (if you work as a + programmer) or school, if any, to sign a "copyright + disclaimer" for the program, if necessary. For more + information on this, and how to apply and follow the GNU + AGPL, see .