Install and manage a K-Box

Alessio Vertemati

What we will see?

  • A local production K-Box installation
  • How to start/stop a K-Box
  • How to investigate problems
  • How to upgrade a K-Box

the K-Box is a web application
to offer the features requires different type of components

Local installation

or as we call it, deploy

The challenge was make the deployment reproducible and easy

We opted to use Docker

  • Reproducible setups
  • Isolation
  • Orchestration

https://www.docker.com/what-docker

we choose docker because

each component is packaged and confine the dependencies we have different components that have different requirements
Different services might depend on different versions of the same technology
reproducible environment orchestrate the components for us
security all changes disappear after restart unless you specify otherwise
https://www.docker.com/what-container

Docker image

where the code lives

Docker container

when an image is executed

thanks to Docker Compose the configuration can be expressed in a single YAML file

github.com/k-box/k-box/blob/master/docker-compose.example.yml

version: '2'
networks:
internal:
services:
## The Search Engine service
engine:
  image: "docker.klink.asia/../images/k-search-engine:0.4.2"
  volumes:
	- "./storage/index:/opt/solr/k-search/k-search/data"
  expose:
	- "8983"
  networks:
	- internal

## The Search Engine API
ksearch:
  image: "docker.klink.asia/../images/k-search:3.2.1-1"
  depends_on:
	- engine
  networks:
	internal:

## The database
database:
  image: mariadb:10
  networks:
	- internal
  volumes:
	- "./storage/database:/var/lib/mysql"

## The K-Box container
kbox:
  image: "docker.klink.asia/../images/k-box:0.21.0"
  depends_on:
	- ksearch
	- database
  volumes:
	- "./storage/data:/var/www/dms/storage"
  ports:
	- "8080:80"
  networks:
	- internal						
					

Demo

What to do After the installation?

  • Configure the email server
  • Add users
  • Add contact information
  • ...

What if something fails or users have problems

Logs
docker-compose logs [--follow] kbox
docker-compose exec kbox ls storage/logs
Accessing the container
docker-compose exec kbox bash
the integrated shell
php artisan tinker

A new version, 0.21.1, of the K-Box is released


## docker-compose.yml
## The K-Box container
kbox:
image: "docker.klink.asia/../images/k-box:0.21.1"
depends_on:
					
docker-compose stop && docker-compose up -d

95% of the releases requires 2-4 minutes for the upgrade*
*Download time excluded

Search related upgrades might require extra steps

docker-compose exec kbox php artisan dms:reindex

What we saw

  • How to deploy a local K-Box using Docker
  • What to do to finalize the configuration
  • How to enter the running container and see the logs
  • Updates