Commit 598eeb5d authored by Noel Alonso's avatar Noel Alonso
Browse files

Unifica variables de puerto y mueve healtcheck

Ahora todos tienen el mismo puerto, por lo que no es necesario tener dos
variables diferenciadas.

Se pasa el healtcheck del docker-compose de cada componente al
Dockerfile diferenciando el componente por variable
parent 8e17ec3e
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
ARG PARENT_IMAGE_NAME
ARG PARENT_IMAGE_TAG
ARG PARENT_IMAGE_NAME=registry.gitlab.com/redmic-project/docker/redmic-server
ARG PARENT_IMAGE_TAG=latest

FROM ${PARENT_IMAGE_NAME}:${PARENT_IMAGE_TAG}

COPY /*/dist/*.jar ./

EXPOSE ${COMMANDS_PORT} ${VIEW_PORT}
ARG PORT=8080
EXPOSE ${PORT}

HEALTHCHECK \
	--interval=30s \
	--timeout=15s \
	--start-period=3m \
	--retries=10 \
CMD wget --spider -q http://localhost:${PORT}/api/${MICROSERVICE_NAME}/actuator/health
+1 −2
Original line number Diff line number Diff line
UNIT_NAME=atlas
COMMANDS_PORT=8097
VIEW_PORT=8098
PORT=8080
+4 −9
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@ version: '3.5'

services:
  atlas-commands:
    image: ${IMAGE_NAME}:${IMAGE_TAG:-latest}
    image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/server/atlas}:${IMAGE_TAG:-latest}
    environment:
      - COMMANDS_PORT
      - MICROSERVICE_PATH=commands
      - PORT
      - SPRING_PROFILES_ACTIVE
      - OAUTH_CLIENT_ID
      - OAUTH_CLIENT_SECRET
@@ -18,19 +19,13 @@ services:
      - traefik-net
    volumes:
      - commands-vol:/tmp/kafka
    healthcheck:
      test: wget --spider -q http://localhost:${COMMANDS_PORT}/api/${UNIT_NAME}/commands/actuator/health
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 2m
    deploy:
      mode: replicated
      replicas: 1
      labels:
        traefik.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/api/${UNIT_NAME}/commands
        traefik.backend: ${UNIT_NAME}-commands
        traefik.port: '${COMMANDS_PORT}'
        traefik.port: '${PORT}'
      restart_policy:
        delay: 10s
        window: 3m
+4 −9
Original line number Diff line number Diff line
@@ -2,9 +2,10 @@ version: '3.5'

services:
  atlas-view:
    image: ${IMAGE_NAME}:${IMAGE_TAG:-latest}
    image: ${IMAGE_NAME:-registry.gitlab.com/redmic-project/server/atlas}:${IMAGE_TAG:-latest}
    environment:
      - VIEW_PORT
      - MICROSERVICE_PATH=view
      - PORT
      - SPRING_PROFILES_ACTIVE
      - OAUTH_CLIENT_ID
      - OAUTH_CLIENT_SECRET
@@ -20,19 +21,13 @@ services:
      - kafka-net
      - redmic-net
      - traefik-net
    healthcheck:
      test: wget --spider -q http://localhost:${VIEW_PORT}/api/${UNIT_NAME}/view/actuator/health
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 2m
    deploy:
      mode: replicated
      replicas: 1
      labels:
        traefik.frontend.rule: Host:${PUBLIC_HOSTNAME};PathPrefix:/api/${UNIT_NAME}/view
        traefik.backend: ${UNIT_NAME}-view
        traefik.port: '${VIEW_PORT}'
        traefik.port: '${PORT}'
      restart_policy:
        delay: 10s
        window: 3m