Skip to content

[Bug] Errors initializing the database #1141

@lordraiden

Description

@lordraiden

What happened?

With a clean setup taking the oficial compose and env a adapting the network configuration to my network, I get errors related with the database.

How we reproduce?

Compose

# Networks ####################################################

networks:
  eth2:
    name: eth2
    external: true

services:
  
  postgres:
    container_name: safeline-pg
    restart: always
    image: ${IMAGE_PREFIX}/safeline-postgres${ARCH_SUFFIX}:15.2
    volumes:
      - ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data
      - /etc/localtime:/etc/localtime:ro
    environment:
      - POSTGRES_USER=safeline-ce
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?postgres password required}
    networks:
      eth2:
        ipv4_address: ${postgres_ip} #2 postgres
    command: [postgres, -c, max_connections=600]
    healthcheck:
      test: pg_isready -U safeline-ce -d safeline-ce
  
  mgt:
    container_name: safeline-mgt
    restart: always
    image: ${IMAGE_PREFIX}/safeline-mgt${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG:?image tag required}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${SAFELINE_DIR}/resources/mgt:/app/data
      - ${SAFELINE_DIR}/logs/nginx:/app/log/nginx:z
      - ${SAFELINE_DIR}/resources/sock:/app/sock
      - /var/run:/app/run
    ports:
      - ${MGT_PORT:-9443}:1443
    healthcheck:
      test: curl -k -f https://localhost:1443/api/open/health
    environment:
      - MGT_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
    depends_on:
      - postgres
      - fvm
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"
    networks:
      eth2:
        ipv4_address: ${mgt_ip} #4 mgt
  
  detect:
    container_name: safeline-detector
    restart: always
    image: ${IMAGE_PREFIX}/safeline-detector${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}
    volumes:
      - ${SAFELINE_DIR}/resources/detector:/resources/detector
      - ${SAFELINE_DIR}/logs/detector:/logs/detector
      - /etc/localtime:/etc/localtime:ro
    environment:
      - LOG_DIR=/logs/detector
    networks:
      eth2:
        ipv4_address: ${detect_ip} #5 detect
  
  tengine: #host
    container_name: safeline-tengine
    restart: always
    image: ${IMAGE_PREFIX}/safeline-tengine${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/resolv.conf:/etc/resolv.conf:ro
      - ${SAFELINE_DIR}/resources/nginx:/etc/nginx
      - ${SAFELINE_DIR}/resources/detector:/resources/detector
      - ${SAFELINE_DIR}/resources/chaos:/resources/chaos
      - ${SAFELINE_DIR}/logs/nginx:/var/log/nginx:z
      - ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache
      - ${SAFELINE_DIR}/resources/sock:/app/sock
    environment:
      - TCD_MGT_API=https://${mgt_ip}:1443/api/open/publish/server #mgt 4
      - TCD_SNSERVER=${detect_ip}:8000 #detect 5
      # deprecated
      - SNSERVER_ADDR=${detect_ip}:8000 #detect 5
      - CHAOS_ADDR=${chaos_ip} #chaos 10
    ulimits:
      nofile: 131072
    network_mode: host  ##!!!!!!
  
  luigi: #7
    container_name: safeline-luigi
    restart: always
    image: ${IMAGE_PREFIX}/safeline-luigi${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}
    environment:
      - MGT_IP=${mgt_ip} #mgt 4
      - LUIGI_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ${SAFELINE_DIR}/resources/luigi:/app/data
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"
    depends_on:
      - detect
      - mgt
    networks:
      eth2:
        ipv4_address: ${luigi_ip} #7 luigi
  
  fvm:
    container_name: safeline-fvm
    restart: always
    image: ${IMAGE_PREFIX}/safeline-fvm${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}
    volumes:
      - /etc/localtime:/etc/localtime:ro
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "5"
    networks:
      eth2:
        ipv4_address: ${fvm_ip} #8 fvm
  
  chaos:
    container_name: safeline-chaos
    restart: always
    image: ${IMAGE_PREFIX}/safeline-chaos${REGION}${ARCH_SUFFIX}${RELEASE}:${IMAGE_TAG}
    logging:
      driver: "json-file"
      options:
        max-size: "100m"
        max-file: "10"
    environment:
      - DB_ADDR=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
    volumes:
      - ${SAFELINE_DIR}/resources/sock:/app/sock
      - ${SAFELINE_DIR}/resources/chaos:/app/chaos
    networks:
      eth2:
        ipv4_address: ${chaos_ip} #10 chaos

Env

# Safeline

SAFELINE_DIR=/mnt/services/docker/Safeline
IMAGE_TAG=latest
MGT_PORT=9443
POSTGRES_PASSWORD=GHANIShYenGbICES
SUBNET_PREFIX=10.10.50
IMAGE_PREFIX=chaitin
ARCH_SUFFIX=
RELEASE=
REGION=-g

# IP	
mgt_ip=10.10.50.11
postgres_ip=10.10.50.12
detect_ip=10.10.50.13
luigi_ip=10.10.50.14
fvm_ip=10.10.50.15
chaos_ip=10.10.50.16

Expected behavior

I should go to https://10.10.50.11:9443/ and I should have access to the webui of mgt

I can't find any problem with my docker compose, but I have a few questions
Why tengine has to run as host in network?

safeline-fvm-2025-01-21T22-42-06.log
safeline-luigi-2025-01-21T22-42-06.log
safeline-mgt-2025-01-21T22-42-06.log
safeline-pg-2025-01-21T22-42-06.log
safeline-tengine-2025-01-21T22-42-06.log
safeline-chaos-2025-01-21T22-42-06.log
safeline-detector-2025-01-21T22-42-06.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions