Automate Deployments with Kontena Deploy

Kontena Deploy is a powerful new feature for defining and running complex applications with Kontena. It may be used to define a multi-service application in a single file including all necessary settings and environment variables. An application described in any such file can be started with a single command kontena deploy that takes care of everything for you: scheduling services across cluster, pulling required images, linking services and more.

With Kontena Deploy, the typical workflow for starting a new application is as follows:

  1. Describe your application with kontena.yml file.
  2. Optionally, configure your application environment with env file(s).
  3. Finally, start your application with kontena deploy command.

In order to understand how Kontena Deploy works, let's get started with a simple Wordpress example.

Deploying Wordpress with Kontena Deploy

First, we will describe our application by creating a kontena.yml file:

wordpress:  
  image: wordpress:4.1
  stateful: true
  ports:
    - 8080:80
  links:
    - mysql:wordpress-mysql
  env_file: wordpress.env
mysql:  
  image: mariadb:5.5
  stateful: true
  environment:
    - MYSQL_ROOT_PASSWORD=secret

Next, we will set the configuration for our wordpress service by creating a wordpress.env file. Alternatively you can set all required configuration variables in kontena.yml file (like in our demo video above).

WORDPRESS_DB_HOST=wordpress-mysql.kontena.local  
WORDPRESS_DB_USER=root  
WORDPRESS_DB_PASSWORD=secret  
WORDPRESS_AUTH_KEY=secret  
WORDPRESS_SECURE_AUTH_KEY=secret  
WORDPRESS_LOGGED_IN_KEY=secret  
WORDPRESS_NONCE_KEY=secret  
WORDPRESS_AUTH_SALT=secret  
WORDPRESS_SECURE_AUTH_SALT=secret  
WORDPRESS_LOGGED_IN_SALT=secret  
WORDPRESS_NONCE_SALT=secret  

Finally, we will run kontena deploy to deploy our complete application into Kontena Grid we are currently logged in.

Get this example project from Github.