docker

Docker Usage

Docker Compose

The docker-compose.yml file defines:

  • Docker container to build/run (build directive)
  • Network links between those containers (networks directive)
  • Port bindings (ports directive)
  • Mounted data volumes for each of our containers (volumes directive)
version: '3.1'

services:
  ldap:
    build: ./ldap
    networks:
      back:
        ipv4_address: 172.20.0.253
    volumes:
      - "./ldap/db:/db"
    ports:
      - "389:389"
  postgresql:
    build: ./postgresql
    networks:
      back:
        ipv4_address: 172.20.0.252
    volumes:
      - "./postgresql/db/data.sql:/docker-entrypoint-initdb.d/data.sql"
    ports:
      - "5432:5432"
  #elastic:
  #  build: ./elastic
  #  environment:
  #    - http.host=0.0.0.0
  #    - xpack.security.enabled=false
  #  networks:
  #    intra:
  #      ipv4_address: 172.20.0.3     
  colectica:
    build: ./colectica
    networks:
      back:
        ipv4_address: 172.20.0.251
    volumes:
      - ./colectica/app/db.json:/usr/src/app/db.json
      - ./colectica/app/routes.json:/usr/src/app/routes.json
      - ./colectica/app/middleware.js:/usr/src/app/middleware.js
    ports:
      - "3000:3000"
  ddi-access-services:
    build: ./ddi-access-services
    volumes:
      - "./ddi-access-services/ddi-access-services.war:/usr/local/tomcat/webapps/ddi-access-services.war"
      - "./ddi-access-services/ddi-access-services.properties:/usr/local/tomcat/webapps/ddi-access-services.properties"
    networks:
      - back
  stromae:
    build: ./stromae
    volumes:
      - "./stromae/rmesstromae.war:/usr/local/tomcat/webapps/rmesstromae.war"
      - "./stromae/config/:/usr/local/tomcat/webapps/config/"
    networks:
      back:
        ipv4_address: 172.20.0.250
    ports:
      - "8181:8080"
  pogues-bo:
    build: ./pogues-bo
    environment:
      - fr.insee.pogues.env=qa
    volumes:
      - "./pogues-bo/rmspogfo.war:/usr/local/tomcat/webapps/rmspogfo.war"
      - "./pogues-bo/rmspogfo.properties:/usr/local/tomcat/webapps/rmspogfo.properties"
    networks:
      - back
    ports:
      - "8080:8080"
  exist:
    build: ./eXist
    networks:
      back:
        ipv4_address: 172.20.0.249
    ports:
      - "9080:8080"
  exist-seed:
    build:
      context: ./eXist-seed
      args:
        - HTTP_PROXY=$HTTP_PROXY
    depends_on:
      - exist
    volumes:
      - ./eXist-seed/app:/opt/exist/app
      - ./eXist-seed/db:/opt/exist/db
      - ./eXist-seed/system:/opt/exist/system
    networks:
      back:
  json-db-seed:
    build:
      context: ./json-db-seed
      args:
        - HTTP_PROXY=$HTTP_PROXY
    depends_on:
      - pogues-bo
    volumes:
      - ./json-db-seed/app:/opt/json-db-seed/app
      - ./json-db-seed/json:/opt/json-db-seed/json

    networks:
      back:
networks:
  back:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.20.0.0/16

Travis will run the following command to run the containers:

docker-compose up

With this command all the containers will best started and linked to each other resulting in an up and running environment.

NB: Tomcat container will start a server instance using the 'qa' environment

export CATALINA_OPTS="qa"

Using docker in development mode

Possible solutions:

  • Configure your IDE to use the tomcat container as the running environment for the application
  • Use docker-compose to start only the LDAP and Postgresql containers and let your IDE run the application

Example: using the docker-compose way

Start PostgreSQL and LDAP backend using docker-compose

docker-compose up postgresql ldap

Run tomcat in your IDE using the dev environment:

With Eclipse or IDEA just edit your run configuration to use the following VM argument:

-Dfr.insee.pogues.env=dev

results matching ""

    No results matching ""