Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
Readme.md 9.10 KiB

deployer

A tool simplifying image building and deploying utilising docker, kubectl and helm. The tool tailors the commands according to the Workflow of University Library of Leipzig for creating official docker images and deploying to alpha- staging- and production environments.

Usage

The tool is bundled with docker, kubectl and helm into a docker image itself. You can use it like this:

docker run --rm --volume $PWD:/app ubleipzig/deployer:latest deployer build --build-arg http_proxy=http://proxy.example.com:3128 --output image.tar.gz

the working directory inside the container is /app, so make sure to bind local files there.

deployer build

This command builds an image from local context. You can set multiple --build-arg options mainly used for providing proxy-environment variables such as HTTP_PROXY, http_proxy, ...

The See Advanced Configuration for more information.

$ deployer build --build-arg http_proxy=http://proxy.example.com:3128 --output image.tar.gz

builds image and saves it to file image.tar.gz

deployer publish

This command publishes an image provided as tar.gz-file to Docker-Hub. The credentials are provided as file content of dockers config-file located by default under ~/.docker/config.json

$ deployer publish --docker-config "$(cat ~/.docker/config.json)" --input image.tar.gz --name example/image --tag latest --tag 1.0 --tag 1

publishes the image from image.tar.gz to Docker-Hub as example/image:latest, example/image:1.0 and example/image:1

deployer deploy

This command deploys a helm-chart to a kubernetes cluster. The credentials are provided by the cluster-admin as well as the namespace and the service-account.

$ deployer deploy \
	--namespace example_namespace \
	--cluster-url https://k8s-cluster.example.com:6443 \
	--certificate-authority "$base64_encoded_cacert" \
	--token "$base64_encoded_bearer_token" \
	--service-account tiller-service-account \
	--name example-staging \
	--charts ./helmcharts

deploys helm-charts found at ./helmcharts to namespace example_namespace

Depending on existing deployment with the same name either an installation or an upgrade is performed.