Deploying on Digital Ocean

    1. Sign up at Digital Ocean and get an API Token
      1. Note - you can also access droplet via console w/in Digital Ocean
        1. https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04
          1. users: root/pw=address, doug/pw=social, dougwells/pw=social
    2. Provision a VM in Digital Ocean
      1. $ docker-machine create --driver digitalocean --digitalocean-access-token <API-Token-AlphaNum> <desired-name-of-VM-on-Digital-Ocean>
      2. (Actual Code w/o Token) $ docker-machine create --driver digitalocean --digitalocean-access-token abcFakexyz docker-app-machine
        1. --driver
          1. Docker has drivers for all of the large cloud providers (DO, AWS, Azure, Linode, etc).
        2. --digitalocean
          1. Each provider has their own way of sharing API Token
        3. Name of VM (we use docker-app-machine)
    3. Set up Docker Client to communicate with docker-machine/server on Digital Ocean
      1. When we finished provisioning VM on DO (above), got the following message:
        1. > To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: $ docker-machine env docker-app-machine
        2. > # Run this command to configure your shell: $ eval $(docker-machine env docker-app-machine)
        3. Do exactly that. Steps 1 & 2. Run env command (sets environment var)
        4. Run $ docker-machine ls to see all VM and to make sure DO is active (*)
        5. Run $ docker info to display info on Dig Ocean VM
    4. Let Digital Ocean know how to get app image (that it will run to spin up containers)
      1. Image that passed CircleCI is on Docker Hub. How point DO to Docker Hub?
        1. Copy docker-compose.yml into new file called prod.yml
          1. In prod.yml

change line build: .

Builds new image w Dockerfile in CWD

to → image: dougwells/dockerapp

Use existing image from Docker Hub

    1. Time to Deploy our dockerapp!!
      1. Make sure docker VM is active → $ docker-machine ls
        1. If not, follow steps in section C above
      2. With docker vm active
        1. $ docker-compose -f prod.yml up -d
          1. docker-compose up → regular command that builds/gets images and spins them up
          2. -f prod.yml → what file to use (otherwise defaults to docker-compose.yml)
          3. -d → free up console (“detached” mode)
      3. Now when run $ docker-machine ls
        1. → get name of app (docker-app-machine) w/IP
          1. Name we gave VM in first step above (step “b” - when we provisioned VM on DO)
    2. Digital Ocean has lots of options for provisioning a VM
      1. Google “docker digital ocean driver”
    3. High level summary of steps
      1. Create Servers

$ docker-machine create --driver digitalocean --digitalocean-access-token <API-Token-AlphaNum> <desired-name-of-VM-on-Digital-Ocean>

      1. “Provision” Servers
        1. Once the server has been set up, it needs to be "provisioned", meaning that the all software and configuration settings are being applied. Other tools beside Docker include Chef, Puppet and Ansible for this.

$ docker-compose -f prod.yml up -d

      1. To take to Swarm, need tool like Consul (see below)

results matching ""

    No results matching ""