Author: gourksaha
Date: Tue May 19 18:47:36 2015
New Revision: 1680371
URL: http://svn.apache.org/r1680371
Log:
formatting change only
Modified:
incubator/slider/site/trunk/content/docs/slider_specs/application_pkg_docker.md
Modified:
incubator/slider/site/trunk/content/docs/slider_specs/application_pkg_docker.md
URL:
http://svn.apache.org/viewvc/incubator/slider/site/trunk/content/docs/slider_specs/application_pkg_docker.md?rev=1680371&r1=1680370&r2=1680371&view=diff
==============================================================================
---
incubator/slider/site/trunk/content/docs/slider_specs/application_pkg_docker.md
(original)
+++
incubator/slider/site/trunk/content/docs/slider_specs/application_pkg_docker.md
Tue May 19 18:47:36 2015
@@ -69,28 +69,28 @@ Refer to [*What is Docker*](https://www.
Below is an example of how we can use Slider to deploy a multi-component
Dockerized application
**appConfig.json**
-```
- {
- "schema": "http://example.org/specification/v2.0.0",
- "metadata": {
- },
- "global": {
- },
- "components": {
- "REDIS": {
- "memcached.commandPath":"/user/local/bin/docker",
- "memcached.options":"-d -e REDIS_PASS=\"**None**\"",
- "memcached.statusCommand":"/usr/bin/docker ps",
- "memcached.inputFiles": [
- {
- "containerPath": "/tmp/input",
- "fileLocalPath": "/Users/peter/config.json"
- }
- ]
+
+
+ {
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": { },
+ "global": { },
+ "components": {
+ "REDIS": {
+ "memcached.commandPath": "/user/local/bin/docker",
+ "memcached.options": "-d -e REDIS_PASS=\"**None**\"",
+ "memcached.statusCommand": "/usr/bin/docker ps",
+ "memcached.inputFiles": [
+ {
+ "containerPath": "/tmp/input",
+ "fileLocalPath": "/Users/peter/config.json"
+ }
+ ]
+ }
}
}
- }
-```
+
+
Please note that in this example, we are specifying a different docker command
path than the default `/usr/bin/docker` in appConfig.json. We also specify the
options that we need to include in the `docker run` command (`-d` is by default
included). This is just a demo as how to include docker run command options. We
also need to expose a port to listen on for the application. Thus, we are
specifying `site.global.listen_port` in appConfig.json and the export config in
metainfo.json below
The config structure in appConfig.json(map) -> components(list) ->
component(map) -> containers(list)-> container(map) have to match the one in
metainfo.json.
@@ -98,43 +98,43 @@ Please note that in this example, we are
We are also adding a few configurations for the component *memcached* in
appConfig.json here. These configurations are runtime parameters of the
component, as opposed to being part of the Docker image definition in
metainfo.json.
**metainfo.json**
-```
- {
- "schemaVersion": "2.1",
- "application": {
- "name": "FAKEAPP",
+
+ {
+ "schemaVersion": "2.1",
+ "application": {
+ "name": "FAKEAPP",
"components": [
{
- "name": "MEMCACHED",
- "type": "docker",
+ "name": "MEMCACHED",
+ "type": "docker",
"dockerContainers": [
{
- "name": "memcached",
- "image": "borja/memcached",
- "additionalParam": "--appendonly yes",
- "commandPath": "/usr/bin/docker",
+ "name": "memcached",
+ "image": "borja/memcached",
+ "additionalParam": "--appendonly yes",
+ "commandPath": "/usr/bin/docker",
"statusCommand": "docker inspect ${container_id}"
}
]
- },
+ },
{
- "name": "REDIS",
- "type": "docker",
+ "name": "REDIS",
+ "type": "docker",
"dockerContainers": [
{
- "name": "redis",
- "image": "dockerhub/redis",
- "additionalParam": "--appendonly yes",
- "commandPath": "/usr/bin/docker",
+ "name": "redis",
+ "image": "dockerhub/redis",
+ "additionalParam": "--appendonly yes",
+ "commandPath": "/usr/bin/docker",
"ports": [
{
- "containerPort" : "11211",
+ "containerPort": "11211",
"hostPort":
"${conf:configuration/global/port1}"
}
- ],
+ ],
"mounts": [
{
- "containerMount": "/tmp/confg",
+ "containerMount": "/tmp/confg",
"hostMount":
"${conf:configuration/global/app_root}/conf"
}
]
@@ -143,8 +143,9 @@ We are also adding a few configurations
}
]
}
- }
-```
+ }
+
+
Please note, in metainfo.json (we are trying to migrate from metainfo.xml to
metainfo.json as an improvement to the packaging approach) we are adding some
new fields in the component section to support Docker based applications:
- **type**: if specified as `docker`, Slider will start Docker containers for
the application; by default it is `process`, which means Slider will
instantiate the application as normal process as today
@@ -156,30 +157,28 @@ Please note, in metainfo.json (we are tr
- Properties specified in metainfo.json can be overridden in appConfig.json:
**commandPath, options, statusCommand, inputFiles, mounts, ports**
**resources.json**
-```
-{
- "schema" : "http://example.org/specification/v2.0.0",
- "metadata" : {
- },
- "global" : {
- },
- "components": {
- "slider-appmaster": {
- },
- "REDIS": {
- "yarn.role.priority": "1",
- "yarn.component.instances": "2",
- "yarn.memory": "512"
- },
- "MEMCACHED": {
- "yarn.role.priority": "1",
- "yarn.component.instances": "2",
- "yarn.memory": "512"
+
+
+ {
+ "schema": "http://example.org/specification/v2.0.0",
+ "metadata": { },
+ "global": { },
+ "components": {
+ "slider-appmaster": { },
+ "REDIS": {
+ "yarn.role.priority": "1",
+ "yarn.component.instances": "2",
+ "yarn.memory": "512"
+ },
+ "MEMCACHED": {
+ "yarn.role.priority": "1",
+ "yarn.component.instances": "2",
+ "yarn.memory": "512"
+ }
+ }
}
- }
-}
-```
+
With the configuration files above, Slider will ask for the required number of
containers from YARN, as specified in resources.json. In each of those YARN
containers, Slider will run `docker pull` to download the Docker image
specified in metainfo.json. In the scope of this JIRA ticket, we are not
supporting Docker images stored in private Docker hubs that require credentials
to run docker pull. After downloading completes, Slider will start the
containers by running, in this case, `/usr/bin/docker run -d borja/memcached`
- For redis components, it will run: