Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Latest commit

 

History

History
65 lines (44 loc) · 2.69 KB

2016-2-23-docker-compose-dev.md

File metadata and controls

65 lines (44 loc) · 2.69 KB
layout title tip-number tip-username tip-username-profile tip-tldr
post
How to ease development with docker-compose
7
chamerling
How to ease your OpenPaas ESN development with docker-compose

We are big fans of docker and all the ecosystem/tools around it. Docker can really ease our daily development workflow, here is a tip on how to use docker-compose to run all the required ESN services without effort.

First, install the fresh new version of docker and docker-compose. We use docker v1.10.0 and docker-compose v1.6.0 in this tip.

Clone the OpenPaaS ESN repository from https://github.com/linagora/openpaas-esn.git.

$ git clone https://github.com/linagora/openpaas-esn.git

Install npm and bower dependencies:

(We assume that you have node (v0.10.36) and so npm installed, if not check the awesome nvm)

$ cd openpaas-esn
$ npm install
$ # take a coffee or two, check your mails, twitter streams...

Once everything is ready, you can launch MongoDB, Redis, ElasticSearch, SabreDAV, with a single command:

ESN_HOST=192.168.X.Y docker-compose -f ./docker/dockerfiles/dev/docker-compose.yml up

Note : 192.168.X.Y is your local network computer IP address. Do not put localhost nor 127.0.0.1 since some services will have to call your ESN instance and using a local IP will fail. Use a IP address the ifconfig command will return.

Once services are started, you have to configure the ESN to use these docker services. We will refer to the YOUR_DOCKER_IP variable in the following instructions, replace this with your docker IP which should be '127.0.0.1' or 'localhost' on Linux and '192.168.99.100' on OS X/Windows (docker-machine based installation).

Let's first generate local configuration files:

$ node ./bin/cli.js db --host <YOUR_DOCKER_IP>
  • YOUR_DOCKER_IP is the IP where MongoDB launched by docker-compose above can be reached (default to localhost, check the note above)

Once generated, let's inject the required configuration into MongoDB:

$ node ./bin/cli.js docker-dev --host <YOUR_DOCKER_IP>
  • YOUR_DOCKER_IP is the IP where MongoDB launched by docker-compose above can be reached (default to localhost, check the note above)

Everything is now ready, you can start the OpenPaaS ESN in dev mode:

$ grunt dev

And browse http://localhost:8080. You should be able to login with the 'admin@open-paas.org' username and 'secret' password.

This is it! You are now able to hack on the OpenPaaS ESN code without having to install nor configure external services by hand.