Skip to content
forked from artsy/hokusai

Artsy's Docker / Kubernetes CLI and Workflow

License

Notifications You must be signed in to change notification settings

ashfurrow/hokusai

 
 

Repository files navigation

HOKUSAI

Hokusai is a Docker + Kubernetes CLI for application developers.

Hokusai "dockerizes" applications and manages their lifecycle throughout development, testing, and release cycles.

Hokusai wraps calls to kubectl, docker, docker-compose and git with a CLI, and defines a CI workflow.

Hokusai currently only supports Kubernetes deployments on AWS, configured to pull from ECS container repositories (ECR), although other providers may be added in the future.

Why Hokusai?

At Artsy, as we began working with Kubernetes, while impressed with its design, capabilities, and flexibility, we were in need of tooling we could deliver to agile development teams that addressed the day-to-day tasks of application development, delivery, introspection and maintenance, while providing a clean and uncomplicated interface.

Transitioning teams to the Docker / Kubernetes ecosystem can be intimidating, and comes with a steep learning curve. We set out to create a Heroku-like CLI that would shepherd the application developer into the ecosystems of Docker and Kubernetes, and while introducing new tooling and concepts, outlining a clear practice for dependency management, local development, testing and CI, image repository structure, deployment and orchestration.

Requirements

  1. Python 2.x and pip

  2. Docker

If you use homebrew on OSX, install Docker for Mac with: brew tap caskroom/cask && brew cask install docker

  1. Docker Compose

If you installed Docker for Mac, docker-compose is also installed. Otherwise install with: (sudo) pip install docker-compose.

  1. Git

Setup

  1. Install Hokusai via pip with (sudo) pip install hokusai and hokusai will be installed on your PATH.

Note: If installing via pip fails due to pip failing to upgrade your system Python packages, try running (sudo) pip install hokusai --ignore-installed.

Alternatively, you can workaround a pure Python installation and install a binary for OSX by simply downloading it from https://artsy-provisioning-public.s3.amazonaws.com/hokusai and adding it to your $PATH, i.e.

curl https://artsy-provisioning-public.s3.amazonaws.com/hokusai -o /usr/local/bin/hokusai && chmod +x /usr/local/bin/hokusai
  1. Set the environment variables $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY in your shell / ~/.bash_profile.

  2. Run hokusai configure --kubectl-version <kubectl version> --s3-bucket <bucket name> --s3-key <file key>. You'll need to provide the kubectl version matching your Kubernetes deployments, as well as the S3 bucket name and key of your org's kubectl config file. System administrators: see Administering Hokusai for instructions on preparing AWS, Kubernetes, and publishing a kubectl config file. Artsy devs: see these artsy/README docs for the current way to install and configure hokusai.

To enable bash autocompletion: eval "$(_HOKUSAI_COMPLETE=source hokusai)"

Getting Started

See Getting Started.md to start using Hokusai for your project.

Command Reference

A full command reference can be found in Command Reference.md.

Developing Hokusai

To work on Hokusai itself, set up your local development environment like so:

  • As above, install python, pip, docker, docker-compose and git.

  • Install Python development packages: pip install -r requirements.txt.

Finally, to install the Hokusai package to your system's PATH from a checkout of this repository, you can run (sudo) pip install --upgrade .

Alternatively, you can invoke Hokusai directly with python bin/hokusai.

Testing Hokusai

All tests can be run with python -m unittest discover test.

Only run unit tests: python -m unittest discover test.unit Only run integration tests: python -m unittest discover test.integration

Tests for specific modules, TestClasses, or even methods can be run with python -m unittest test.unit.test_module.TestClass.test_method

Set the DEBUG=1 environment variable to print boto logging

Review Apps

Hokusai can be used to simplify the process of spinning up a "review app" instance of your project, based on a feature branch or pull request.

Full details are in the Review App reference.

Distributing Hokusai

To distribute Hokusai you must be a member of Artsy engineering and have write credentials to:

Install git, twine, pyinstaller, s3cmd and docker then run ./distribute.sh {VERSION}

The Name

The project is named for the great Japanese artist Katsushika Hokusai (1760-1849).

About

Artsy's Docker / Kubernetes CLI and Workflow

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.6%
  • Other 1.4%