Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 2.14 KB

DEVELOPMENT.md

File metadata and controls

100 lines (67 loc) · 2.14 KB

Developing Kontena

With docker-compose

Initial Setup

CLI

Link a development version of your local cli:

$ ln -s $(pwd)/cli/bin/kontena /usr/local/bin/dontena
$ cd cli && bundle install
$ dontena version

Server and Agent

First you need to create a grid, so start the api (aka server or master) and mongodb from docker-compose.yml with

docker-compose run --service-ports api

Then, in another window login to the master with the initial admin code (set in docker-compose.yml) -- NOTE: wait until the master is healthy (see (the issue about this)[kontena#1460])

dontena master login --name devmaster --code initialadmincode http://localhost:9292

NOTE: If you have an existing master with the same name, you may reuse the id or delete the master, see dontena cloud master

Use Kontena Cloud for your master:

dontena master init-cloud --force

Invite your account as a master_admin:

dontena master users invite -r master_admin your.registered@email.at.kontena.cloud.com

Then login:

dontena master join --name devmaster http://localhost:9292 invit3c0d3

Now create the grid:

dontena grid create --token devtoken dev

Set the token to agent/.env

echo "KONTENA_TOKEN=$(dontena grid show --token dev)" > agent/.env

Now kill the docker-compose run in another window and start everything at once with:

docker-compose up

Verify that service creation and scaling works:

dontena node ls
dontena service create redis redis
dontena service scale redis 3
dontena service logs redis

Development workflow

Make a change to master or agent and restart docker-compose up (with control+c)

Re-creating everything

First remove all services to clean up docker so that the deploys to the next grid will work:

dontena service ls -q | xargs -L 1 dontena service rm --force

Then run:

docker-compose down
docker ps -aq -f name=kontena- | xargs docker rm -f
docker ps -aq -f name=weave | xargs docker rm -f
dontena cloud master rm
dontena master rm

and start from the beginning.