Docker / Vela / TAP

Intro to container-based application deployment at Target

Goal

  • Deploy a small Python web app to a Target cluster
  • Set up automatic testing and deployment

Docker

  • Deliver software in packages ("containers")
  • Containers are isolated from each other
  • Fewer resources than virtual machines

docker.com/products/docker-desktop

Vela

  • Target's pipeline automation framework
    • Continuous Integration (CI)
    • Continuous Delivery (CD)
  • Based on Docker containers

 

TAP

  • "Target Application Platform"
  • Target's cloud compute platform based on Docker
  • Simple UI for managing and deploying applications

 

tapui.prod.platform.target.com

Workflow

Plan

  1. Fork and clone Python server repo
  2. Run Python server in Docker
  3. Use Vela to run tests
  4. Create TAP application
  5. Deploy Python server to TAP

1. Fork and Clone repo

git.target.com/RedOptHaskell/python-docker-vela-tap

# Set base image (host OS)
FROM python:3.8

# Copy the dependencies file to the working directory
COPY requirements.txt .

# Install dependencies
RUN pip install -r requirements.txt

# Copy the content of the local src directory to the working directory
COPY src/ .

# Command to run on container start
CMD [ "python", "./server.py" ]

2. Run Server in Docker

$ docker build -t tap .
$ docker run -p8080:8080 tap

Dockerfile

Terminal

version: "1"

steps:

  - name: test
    ruleset:
      event: push
    image: python:3.8
    commands:
      - python test.py

3. Use Vela to run tests

Activate repository:

vela.prod.target.com

.vela.yml

4. Create TAP Application

tapui.prod.platform.target.com

version: "1"

steps:

  - name: test
    ruleset:
      event: push
    image: python:3.8
    commands:
      - python test.py

  - name: build and push docker image
    ruleset:
      event: push
    image: docker.target.com/vela-plugins/kaniko:v0.6.0-1
    secrets:
      - docker_password
    parameters:
      dockerfile: Dockerfile
      registry: docker.target.com
      repo: docker.target.com/app/<app_name>
      username: svcpejkn001
      tags:
        - latest
        - test-${VELA_BUILD_NUMBER}

secrets:
  - name: docker_password
    key: tap/vela-secrets/ARTIFACTORY_SVCPEJKN001_BINREPO
    engine: native
    type: shared

5. Deploy to TAP

docker-vela-tap

By Moritz Drexl

docker-vela-tap

  • 424