My application use services that use postgresql instances, I can't satisfy it with GitlabCI

I have an api application that use services.

Each services use it’s own database.

I need to have the databases running during the CI, but I could not found how to do it:

This is my application.yml:

variables:
# build env
  DOCKER_FILE: build/docker/Dockerfile
  DOCKER_DRIVER: overlay2
  DOCKER_HOST: tcp://docker:2375
  SPRING_PROFILES_ACTIVE: gitlab-ci
  GIT_STRATEGY: none
#  posgresql service
  POSTGRES_USER: gitlab-ci
  POSTGRES_PASSWORD: gitlab-ci
  POSTGRES_DB: DATA_V1
#  ldap services
  LDAP_DOMAIN: domain.com
  LDAP_ORGANISATION: domain
  LDAP_ADMIN_PASSWORD: hello-ci

services:
- name: docker:dind
- name: osixia/openldap:1.1.9
- name: postgres:10.0-alpine
  alias: service1-management-db
- name: postgres:10.0-alpine
  alias: service2-management-db
- name: postgres:10.0-alpine
  alias: service3-management-db
- name: postgres:10.0-alpine
  alias: service4-management-db
- name: postgres:10.0-alpine
  alias: service5-management-db
- name: postgres:10.0-alpine
  alias: service6-management-db
- name: postgres:10.0-alpine
  alias: service7-management-db

I have read the documentation and this should work but :

  1. It does fail to name the alias and in consequence fail to start more than 1 database
  2. It does not provide a way to configure the services invidually as you only have 1 environment available.

Can anybody help me find a way to run my services ?

2 Likes