├── .gitattributes ├── .gitignore ├── README.md └── images ├── container_menu.jpg ├── drop_down.png ├── examine_containers.png ├── magnifying_glass.png ├── ports.png ├── run_container.png ├── show_containers.png └── which_node.png /.gitattributes: -------------------------------------------------------------------------------- 1 | # These settings are for any web project 2 | 3 | # Handle line endings automatically for files detected as text 4 | # and leave all files detected as binary untouched. 5 | * text=auto 6 | 7 | # 8 | # The above will handle all files NOT found below 9 | # 10 | 11 | # 12 | ## These files are text and should be normalized (Convert crlf => lf) 13 | # 14 | 15 | # source code 16 | *.php text 17 | *.css text 18 | *.sass text 19 | *.scss text 20 | *.less text 21 | *.styl text 22 | *.js text 23 | *.coffee text 24 | *.json text 25 | *.htm text 26 | *.html text 27 | *.xml text 28 | *.svg text 29 | *.txt text 30 | *.ini text 31 | *.inc text 32 | *.pl text 33 | *.rb text 34 | *.py text 35 | *.scm text 36 | *.sql text 37 | *.sh text 38 | *.bat text 39 | 40 | # templates 41 | *.ejs text 42 | *.hbt text 43 | *.jade text 44 | *.haml text 45 | *.hbs text 46 | *.dot text 47 | *.tmpl text 48 | *.phtml text 49 | 50 | # server config 51 | .htaccess text 52 | 53 | # git config 54 | .gitattributes text 55 | .gitignore text 56 | .gitconfig text 57 | 58 | # code analysis config 59 | .jshintrc text 60 | .jscsrc text 61 | .jshintignore text 62 | .csslintrc text 63 | 64 | # misc config 65 | *.yaml text 66 | *.yml text 67 | .editorconfig text 68 | 69 | # build config 70 | *.npmignore text 71 | *.bowerrc text 72 | 73 | # Heroku 74 | Procfile text 75 | .slugignore text 76 | 77 | # Documentation 78 | *.md text 79 | LICENSE text 80 | AUTHORS text 81 | 82 | 83 | # 84 | ## These files are binary and should be left untouched 85 | # 86 | 87 | # (binary is a macro for -text -diff) 88 | *.png binary 89 | *.jpg binary 90 | *.jpeg binary 91 | *.gif binary 92 | *.ico binary 93 | *.mov binary 94 | *.mp4 binary 95 | *.mp3 binary 96 | *.flv binary 97 | *.fla binary 98 | *.swf binary 99 | *.gz binary 100 | *.zip binary 101 | *.7z binary 102 | *.ttf binary 103 | *.eot binary 104 | *.woff binary 105 | *.pyc binary 106 | *.pdf binary 107 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ##NOTE 2 | This lab is for participants of the Docker Universal Control Plane beta program. It will not work unless you have access to the UCP binaries. 3 | 4 | ##Introduction 5 | This lab will guide you through 5 tasks with Docker Universal Control Plane: 6 | 7 | - Task 1: Install Docker Universal Control Plane on ducp-0 8 | 9 | 10 | - Task 2: Add ducp-1 as a second managed node 11 | 12 | 13 | - Task 3: Create an Nginx container 14 | 15 | 16 | - Task 4: Download the Client bundle to ducp-2 17 | 18 | 19 | - Task 5: Use Docker Compose from ducp-2 to stand up an app 20 | 21 | It should take 25-35 minutes to finish. 22 | 23 | ##What is Docker Universal Control Plane 24 | Docker Universal Control Plane is a an on-premise solution to help you manage your Docker-based applications. 25 | 26 | ## Prerequisites 27 | 28 | - This lab assumes you've created 3 Docker hosts running Docker Engine 1.9. These hosts should be named ducp-0, ducp-1, and ducp-2. 29 | 30 | - You will need fully qualified domain name (FQDN) and IP address for each host. 31 | 32 | - You will need a Docker hub account that has been given permission to access the Docker Universal Control Plane beta. 33 | 34 | - The following ports need to be accessible on all of you hosts for UCP to function: 35 | 36 | - 443: UCP controller 37 | - 2376: Swarm manager 38 | - 12376: Engine proxy 39 | - 12379, 12380: Key Value store 40 | - 12381: Swarm CA service 41 | - 12382: UCD CA service 42 | 43 | - The following ports are used as part of this lab: 44 | - 8005: Nginx container created in Task 3 45 | - 5000, 5001: Voting containers deployed in Task 5 46 | 47 | ##Task 1: Installing Docker Universal Control Plane 48 | In this task we're going to install the Docker Universal Control Plane (UCP) server onto **ducp-0**. This is done by running a bootstrap container, and providing a few pieces of information. 49 | 50 | **Note***: Some dialogs / logs may say "Orca" this is the internal code name for UCP* 51 | 52 | 1. ssh into **ducp-0** 53 | 54 | $ ssh -i ubuntu@ 55 | 56 | **Note***: You may be prompted to accept the RSA key. If so, enter* `yes` 57 | 58 | 2. Run the UCP installer 59 | 60 | docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name ucp dockerorca/ucp install -i 61 | 62 | 3. Provide the following inputs: 63 | 64 | - Password: `` 65 | - Additional Aliases: `` `` 66 | - Your Docker hub credentials 67 | 68 | **Note***: Do not use the private IP. Use the one labled "IP"* 69 | 70 | The UCP installer should finish something similar to: 71 | 72 | INFO[0160] Installing UCP with host address 172.31.42.38 73 | INFO[0002] Generating Swarm Root CA 74 | INFO[0013] Generating UCP Root CA 75 | INFO[0022] Deploying UCP Containers 76 | INFO[0027] UCP instance ID: JJOB:SQP3:PERQ:UPP3:54UP:K7B6:ZWL6:GLES:CN7M:5KLO 77 | INFO[0027] UCP Server SSL: SHA1 Fingerprint=48:22:4F:6B:36:6D: 78 | INFO[0027] Login as "admin"/(your admin password) to UCP at https://:443 79 | 80 | **Note***: If you are deploying to an EC2 istance, the installer may indicate the server is reachable on the `private IP`, but instead use your web browser navigate to the UCP server via ducp-0's `public IP`* 81 | 82 | **Note***: You may be warned that your connection is not private. That is because we are not using publicly signed certificates for the SSL connnection to the website.* 83 | 84 | *To bypass this in Chrome click `advanced` and then `proceed to . . . .` link. Safari may net let you past this warning* 85 | 86 | 2. Login into the UCP server with the username `admin` (case sensitive) and the password you chose. 87 | 88 | You'll be logged into the UCP dashboard. Notice you have several containers and images, as well as 1 node, and 0 applications running. These images and containers are what power the UCP server. 89 | 90 | ##Task 2: Deploy a Second Docker Host 91 | In this step we'll add a 2nd node (**ducp-1**) to our cluster. 92 | 93 | 1. In a new terminal session ssh into **ducp-1** 94 | 95 | $ ssh -i ubuntu@ 96 | 97 | **Note***: You may be prompted to accept the RSA key. If so, enter* `yes` 98 | 99 | 2. Run the UCP bootstrap with the join option 100 | 101 | docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock --name ucp dockerorca/ucp join -i 102 | 103 | 3. Provide the following inputs: 104 | 105 | - URL to the Orca server: `https://` 106 | - Proceed with the join: `y` 107 | - Admin username: `admin` 108 | - Admin password: `` 109 | - Docker Hub credentials 110 | - Additional Aliases: `` `` 111 | 112 | The Installer should finish with something similar to: 113 | 114 | INFO[0000] This engine will join UCP and advertise itself with host address 10.0.11.13 115 | INFO[0000] Verifying your system is compatible with UCP 116 | INFO[0012] Starting local swarm containers 117 | 118 | 4. Go back to your web browser, and refresh the dashboard. You should now see you have 2 nodes running. 119 | 120 | 5. Click `Nodes` 121 | 122 | Here you can see details on both of your running nodes 123 | 124 | 125 | ##Task 3: Create a Container 126 | In this section we'll deploy an Nginx container using UCP 127 | 128 | 3. In the UCP UI click the menu button in the upper left corner 129 | 130 | ![Menu](images/drop_down.png) 131 | 132 | 4. From the drop down select `Containers` 133 | 134 | 5. On the Control Plane / Containers page, click `+ Deploy Container` 135 | 136 | 6. Provide the following inputs: 137 | 138 | - Image Name: `nginx:latest` 139 | - Container Name: `mynginx` 140 | - Under Network set port 80 to redirect to 8005 and click the `+` button 141 | 142 | ![Ports](images/ports.png) 143 | 144 | Feel free to examine the other settings, but leave them at their defaults 145 | 146 | 5. Click `Run Container` 147 | 148 | ![Run Container](images/run_container.png) 149 | 150 | 6. Click the magnifying glass next to your container, 151 | 152 | ![Magnifying Glass](images/magnifying_glass.png) 153 | 154 | Scroll down to the node section of the page to find out which node your webserver is running on (`ducp-0` or `ducp-1`) 155 | 156 | In your web browser navigate to the IP address (and port 8005) of the node (`ducp-0` or `ducp-1`) where Nginx is running. 157 | 158 | ![Which Node](images/which_node.png) 159 | 160 | For example: `http://52.23.41.23:8005` 161 | 162 | You should see the Nginx welcome screen. 163 | 164 | ## Task 4: Using UCP from the Command Line 165 | One of the great things about UCP is that it doesn't preclude you from using the Docker command line tools you're used to. In this task we're going to install the UCP client bundle onto your local machine 166 | 167 | 1. Navigate to your UCP server in your web browser 168 | 169 | 2. In the upper right corner click `admin` and choose `Profile` 170 | 171 | 3. Click `Create a Client Bundle` 172 | 173 | 4. Navigate to where the bundle was downloaded, and unzip the client bundle 174 | 175 | $ unzip bundle.zip 176 | Archive: bundle.zip 177 | extracting: ca.pem 178 | extracting: cert.pem 179 | extracting: key.pem 180 | extracting: cert.pub 181 | extracting: env.sh 182 | 183 | 5. Change into the directory that was created when the bundle was unzipped 184 | 185 | 6. Execute the `env.sh` script to set the appropriate environment variables for your UCP deployment 186 | 187 | $ source env.sh 188 | 189 | 9. Run `docker info` to examine the configuration of your Docker Swarm. Your output should show that you are managing the swarm vs. a single node. 190 | 191 | $ docker info 192 | Containers: 10 193 | Images: 15 194 | Role: primary 195 | Strategy: spread 196 | Filters: health, port, dependency, affinity, constraint 197 | Nodes: 2 198 | orca-ducp-0: 10.0.10.47:12376 199 | └ Containers: 7 200 | └ Reserved CPUs: 0 / 1 201 | └ Reserved Memory: 0 B / 3.859 GiB 202 | └ Labels: executiondriver=native-0.2, kernelversion=3.19.0-26-generic, operatingsystem=Ubuntu 14.04.3 LTS, storagedriver=aufs 203 | orca-ducp-1: 10.0.11.13:12376 204 | └ Containers: 3 205 | └ Reserved CPUs: 0 / 1 206 | └ Reserved Memory: 0 B / 3.859 GiB 207 | └ Labels: executiondriver=native-0.2, kernelversion=3.19.0-26-generic, operatingsystem=Ubuntu 14.04.3 LTS, storagedriver=aufs 208 | CPUs: 2 209 | Total Memory: 7.718 GiB 210 | Name: orca-ducp-0 211 | ID: F4Q3:NJRJ:GZ3M:6TKK:KUEE:TRUO:AEFG:ET7U:RAP4:3RHW:HYOH:I2TK 212 | Labels: 213 | swarm_master=tcp://10.0.10.47:2376 214 | 215 | ##Task 5: Use Docker Compose 216 | In this task we'll use Docker Compose to stand up a multi-tier voting application. 217 | 218 | 1. Use the editor of your choice to createa a file named `docker-compose.yml`, and copy the following commands into your new file. 219 | 220 | voting-app: 221 | image: dockercond2/dockercon-voting-app 222 | links: 223 | - redis:voteapps_redis_1 224 | ports: 225 | - "5000:80" 226 | 227 | redis: 228 | image: redis 229 | ports: ["6379"] 230 | 231 | worker: 232 | image: dockercond2/dockercon-worker 233 | links: 234 | - redis:voteapps_redis_1 235 | - db:voteapps_db_1 236 | 237 | db: 238 | image: postgres:9.4 239 | 240 | result-app: 241 | image: dockercond2/dockercon-result-app 242 | links: 243 | - db:voteapps_db_1 244 | ports: 245 | - "5001:80" 246 | 247 | 4. Deploy the application. The compose file will start several different containers that comprise a voting app 248 | 249 | $ docker-compose up -d 250 | 251 | It will take several minutes for the compose to complete, and several lines of text will scroll by. It should finish similar to this 252 | 253 | Creating ubuntu_voting-app_1 254 | Pulling result-app (dockercond2/dockercon-result-app:latest)... 255 | orca-ducp-1: Pulling dockercond2/dockercon-result-app:latest... : downloaded 256 | orca-ducp-0: Pulling dockercond2/dockercon-result-app:latest... : downloaded 257 | Creating ubuntu_result-app_1 258 | 259 | 5. In your web browser navigate back to the UCP server dashboard (`https://`) 260 | 261 | Notice the dashboard now shows 1 application running. 262 | 263 | 6. Click on the menu icon and select `applications` from the drop down. 264 | 265 | ![Menu](images/drop_down.png) 266 | 267 | 7. List out all the running containers by clicking `Show` on the line listing the Ubuntu application 268 | 269 | ![Show Containers](images/show_containers.png) 270 | 271 | 8. Click show to the on the Ubuntu application to find out which nodes your voting app and results are running (`ducp-0` or `ducp-1`) 272 | 273 | ![Which Container](images/examine_containers.png) 274 | 275 | In your web browser navigate to the IP address (and port 5000) of the node (`ducp-0` or `ducp-1`) where the voting app is running. 276 | 277 | For example: `http://52.23.41.23:5000` 278 | 279 | Then navigate to the IP address (and port 5001) of the node (`ducp-0` or `ducp-1`) where the results app is running. 280 | 281 | For example: `http://52.23.41.23:5001` 282 | 283 | 8. Navigate back to the applcation view in UPC, and click `inspect` next to any of the containers 284 | 285 | This shows us the details of the running container. We can control container state here. Aditionally we can scale out a given container. 286 | 287 | Finally, the menu bar allows you to see performance stats, logs, and even open a console window into the container. 288 | 289 | Feel free to explore these options. 290 | 291 | ![Container Menu](images/container_menu.jpg) 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | -------------------------------------------------------------------------------- /images/container_menu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/container_menu.jpg -------------------------------------------------------------------------------- /images/drop_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/drop_down.png -------------------------------------------------------------------------------- /images/examine_containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/examine_containers.png -------------------------------------------------------------------------------- /images/magnifying_glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/magnifying_glass.png -------------------------------------------------------------------------------- /images/ports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/ports.png -------------------------------------------------------------------------------- /images/run_container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/run_container.png -------------------------------------------------------------------------------- /images/show_containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/show_containers.png -------------------------------------------------------------------------------- /images/which_node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/docker-archive/ucp_lab/f49a30835bbfe2d4101fedca4f67d5ae45ce6b89/images/which_node.png --------------------------------------------------------------------------------