ci: propose a docker-compose to handle services tests locally
[nit.git] / misc / docker / ci-local / README.md
1 # Local setup of services for tests
2
3 Some tests and libs require specific external services like postgres.
4 To simplify the automation and the setup, we just assume these services are accessible at specific hostnames.
5
6 When running and testing nit within a docker, it is easy to compose/link nit with other dockers/services.
7 See also .gitlab-ci.yml
8
9 ~~~
10 $ docker run --link postgres [...]
11 ~~~
12
13 When running and testing on a local host, one can setup those services locally then add aliases for localhost in `/etc/hosts`.
14
15 ~~~
16 $ cat /etc/hosts
17 [...]
18 127.0.0.1 postgres
19 ~~~
20
21 An other way is to run/test on a local host and have the services running in dockers.
22
23 Because accessing a specific container by its name is cumbersome, a proposed way is to:
24
25 * run these services with specific and fixed IPs
26 * add these IPs to `/etc/hosts`
27
28 ~~~
29 $ cd misc/docker/ci-local
30 $ docker-compose up -d
31 $ cat /etc/hosts
32 [...]
33 172.16.238.4 postgres
34 ~~~