Merge changes from BurkeAzbill into master

romant authored
revision ff6f8323532bd5514000dbb4ac499f45fea2f4f4
# Getting started with AppCatalyst and Docker
"VMware AppCatalyst is an API and Command Line Interface (CLI)-driven Mac hypervisor that is purpose-built for developers, with the goal of bringing the datacenter to the desktop."

Using it we will build out a simple, but an effective way to demonstrate the ease of use of AppCatalyst, rapid nature with which we can model a modern Meteor application using Docker.

## Before you begin
AppCatalyst is still in Tech Preview. Therefore for the purpose of this walkthrough, all builds of components must be tightly controlled for repeatability of experience.

## What do you need?
- A Mac
- AppCatalyst `Build # 2836636`
> The official documentation for interacting with AppCatalyst can be found [here](
- Docker Client `version 1.7.1, build 786b29d`
- Fabio's _special_ build of [Docker-Machine]( You can make the binary from scratch; or use the OSX Binary.
> NOTE: There is no support for this code.

## Final Result
- Once completed all the steps you will end up with an application that is the meteor sample [todos App]( running across multiple containers, within VMware Photon, atop AppCatalyst, instrumented via `docker-machine` ๐Ÿ˜ณ

- As far as the overall architecture, it's _similar_ to a typical multi-tier app.


## Getting there

### Developer Infrastructure
> *Recommended:* alias the docker-machine command
> `alias dm=docker-machine`

1. Install AppCatalyst
1. Install Docker Client
`curl -O /usr/local/bin/docker`

1. Install docker-machine which has VMware AppCatalyst driver built-in
`curl -O /usr/local/bin/docker-machine && chmod +x /usr/local/bin/docker-machine`

1. Start the AppCatalyst-Daemon

> NOTE : Assuming you've followed the AppCatalyst documention, and added it to your PATH. Otherwise you'll need to refer to the command by the full path of `/opt/vmware/appcatalyst/bin/appcatalyst-daemon`

1. Create the appcatalyst, docker-machine endpoint

`dm create -d vmwareappcatalyst tokyo`
> NOTE : We're indicateing via the `-d` flag the driver to use, in this case `vmwareappcatalyst`. Followed by a friendly name `tokyo`

1. Set our environment to point to this newly created docker host

`dm env tokyo`

โ˜๏ธ_follow the onscreen instructions_

### Application

1. Create the working structure for your application

`mkdir -p my_app/{app,data,compose}`

It should now resemble

โ”œโ”€โ”€ app
โ”œโ”€โ”€ compose
โ””โ”€โ”€ data

> NOTE : we've cheated a little, and am skipping a small step, as am providing a Meteor-ready container for our sample todos app

1. Create the app container
cd my_app\app\
vi Dockerfile
.. and paste the following

FROM romant/node:meteor



WORKDIR /home/app

RUN meteor create --example todos

ENTRYPOINT cd /home/app/todos && meteor

1. Build the docker image

`docker build -t romant/todos .`

> Depending on the internet connection speed, you should see the build start, and the display resemble something close to the following

Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM romant/node:meteor
meteor: Pulling from romant/node
902b87aaaec9: Downloading [> ] 519.1 kB/51.37 MB
9a61b6b1315e: Download complete
1ff9f26f09fb: Downloading [> ] 186 kB/18.54 MB
607e965985c1: Downloading [> ] 437.2 kB/42.37 MB
e3b4bca8cea6: Downloading [> ] 539.7 kB/127.5 MB
21cc4c536cdb: Download complete
e460f18e2989: Download complete
6e68158502bf: Download complete
64c7bdd0de42: Pulling fs layer
3bba441d8886: Pulling fs layer
e115fe109a33: Download complete

Technically, as soon as this is finished finished, you can start the Meteor app without a database, because it has an inbuilt _mini_ MongoDB; scope of which is beyond this lab. We will instead ignore this, and continue to having it connect to a dedicated MongoDB environment we build in the next step

### Database

### Putting it Together
You can manually create links between the different containers at the time of creation, and that works wonderfully; and you can also use Docker-Compose