Merge pull request #750 from joaofnfernandes/ddc-compose

Update DDC deploy app articles
This commit is contained in:
Joao Fernandes 2016-11-30 14:22:30 -08:00 committed by GitHub
commit 01467c846b
9 changed files with 69 additions and 47 deletions

View File

@ -1,23 +1,21 @@
--- ---
title: Deploy an app from the CLI title: Deploy an app from the CLI
description: Learn how to deploy containerized applications on a cluster, with Docker description: Learn how to deploy containerized applications on a swarm, with Docker
Universal Control Plane. Universal Control Plane.
keywords: keywords:
- deploy, application - deploy, application
--- ---
# Deploy an app from the CLI
With Docker Universal Control Plane you can deploy your apps from the CLI, With Docker Universal Control Plane you can deploy your apps from the CLI,
using Docker Compose. In this example we're going to deploy a WordPress using Docker Compose. In this example we're going to deploy a WordPress
application. application.
## Get a client certificate bundle ## Get a client certificate bundle
Docker UCP secures your cluster with role-based access control, so that only Docker UCP secures your Docker swarm with role-based access control, so that only
authorized users can deploy applications to the cluster. To be able to run authorized users can deploy applications. To be able to run
Docker commands on the UCP cluster, you need to authenticate your requests using Docker commands on a swarm managed by UCP, you need to authenticate your
client certificates. requests using client certificates.
[Learn how to set your CLI to use client certificates](../access-ucp/cli-based-access.md). [Learn how to set your CLI to use client certificates](../access-ucp/cli-based-access.md).
@ -25,26 +23,39 @@ client certificates.
The WordPress application we're going to deploy is composed of two services: The WordPress application we're going to deploy is composed of two services:
* wordpress: The container that runs Apache, PHP, and WordPress. * wordpress: The service that runs Apache, PHP, and WordPress.
* db: A MariaDB database used for data persistence. * db: A MariaDB database used for data persistence.
<!-- would be better if this was a docker-compose v2 file-->
After setting up your terminal to authenticate using client certificates, After setting up your terminal to authenticate using client certificates,
create a file named `docker-compose.yml` with the following service definition: create a file named `docker-compose.yml` with the following service definition:
```yml ```none
wordpress: version: '2'
image: wordpress
links:
- db:mysql
ports:
- 8080:80
db: services:
image: mariadb db:
environment: image: mysql:5.7
MYSQL_ROOT_PASSWORD: example volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data:
``` ```
In your command line, navigate to the place where you've created the In your command line, navigate to the place where you've created the
@ -62,11 +73,11 @@ $ docker-compose --project-name wordpress ps
Name Command State Ports Name Command State Ports
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
wordpress_db_1 docker-entrypoint.sh mysqld Up 3306/tcp wordpress_db_1 docker-entrypoint.sh mysqld Up 3306/tcp
wordpress_wordpress_1 /entrypoint.sh apache2-for ... Up 192.168.99.106:8080->80/tcp wordpress_wordpress_1 docker-entrypoint.sh apach ... Up 172.31.18.153:8000->80/tcp
``` ```
In this example, WordPress can be accessed at 192.168.99.106:8080. Navigate to In this example, WordPress can be accessed at 172.31.18.153:8000. Navigate to
this address in your browser, to start using the WordPress app you just this address in your browser, to start using the WordPress app you just
deployed. deployed.

View File

@ -7,40 +7,51 @@ keywords:
--- ---
With Docker Universal Control Plane you can deploy applications from the With Docker Universal Control Plane you can deploy applications from the
UI. You can define your application on the UI, or import an existing UI using `docker-compose.yml` files. In this example, we're going to deploy a
docker-compose.yml file. WordPress application.
In this example, we're going to deploy a WordPress application.
## Deploy WordPress ## Deploy WordPress
On your browser, **log in** to UCP, and navigate to the **Applications** page. On your browser, **log in** to UCP, and navigate to the **Applications** page.
There, click the **Compose Application** button, to deploy a new application. There, click the **Deploy compose.yml** button, to deploy a new application.
![](../images/deploy-app-ui-1.png) ![](../images/deploy-app-ui-1.png)
The WordPress application we're going to deploy is composed of two services: The WordPress application we're going to deploy is composed of two services:
* wordpress: The container that runs Apache, PHP, and WordPress. * wordpress: The service that runs Apache, PHP, and WordPress.
* db: A MariaDB database used for data persistence. * db: A MariaDB database used for data persistence.
<!-- would be better if this was a docker-compose v2 file--> ```none
version: '2'
```yml services:
wordpress: db:
image: wordpress image: mysql:5.7
links: volumes:
- db:mysql - db_data:/var/lib/mysql
ports: restart: always
- 8080:80 environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
db: wordpress:
image: mariadb depends_on:
environment: - db
MYSQL_ROOT_PASSWORD: example image: wordpress:latest
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data:
``` ```
Copy-paste the application definition to UCP, and name it 'wordpress'. Name the application 'wordpress', and paste the docker-compose.yml definition.
You can also upload a docker-compose.yml file from your machine, by clicking on You can also upload a docker-compose.yml file from your machine, by clicking on
the 'Upload an existing docker-compose.yml' link. the 'Upload an existing docker-compose.yml' link.
@ -58,7 +69,7 @@ exposing.
![](../images/deploy-app-ui-4.png) ![](../images/deploy-app-ui-4.png)
In this example, WordPress can be accessed at `192.168.99.106:8080`. In this example, WordPress can be accessed at `172.31.18.152:8000`.
Navigate to this address in your browser, to start using the WordPress app you Navigate to this address in your browser, to start using the WordPress app you
just deployed. just deployed.
@ -67,9 +78,9 @@ just deployed.
## Limitations ## Limitations
There are some limitations when deploying application on the UI. You can't There are some limitations when deploying docker-compose.yml applications from
reference any external files, so the following Docker Compose keywords are not the UI. You can't reference any external files, so the following Docker
supported: Compose keywords are not supported:
* build * build
* dockerfile * dockerfile

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB

After

Width:  |  Height:  |  Size: 287 KiB