Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Errors initializing the database #1141

Open
lordraiden opened this issue Jan 21, 2025 · 3 comments
Open

[Bug] Errors initializing the database #1141

lordraiden opened this issue Jan 21, 2025 · 3 comments

Comments

@lordraiden
Copy link

lordraiden commented Jan 21, 2025

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

@lordraiden
Copy link
Author

lordraiden commented Jan 21, 2025

For some reason I can access the web ui in https://10.10.50.11:1443/instead of https://10.10.50.11:9443/
Does it makes sense?
Can I run tengine with a dedicated IP in eth2 or it MUST be in host?
Which containers requires internet access?
Are still all the errors in the logs normal?

Attached the logs with tengine with an IP in eth2

container-logs-2025-01-21T22-55-02.zip

@dhsifss
Copy link
Contributor

dhsifss commented Jan 22, 2025

Why tengine has to run as host in network?

safeline-tengine use host network because site's port need expose to external.

Can I run tengine with a dedicated IP in eth2 or it MUST be in host?

you can run safeline-tengine with a dedicated IP in eth2, but you need to expose port manually

safeline-pg's log seems table initial failed, you can exec docker restart safeline-mgt to restart safeline-mgt, and table will reinit

@lordraiden
Copy link
Author

Why tengine has to run as host in network?

safeline-tengine use host network because site's port need expose to external.

Can I run tengine with a dedicated IP in eth2 or it MUST be in host?

you can run safeline-tengine with a dedicated IP in eth2, but you need to expose port manually

safeline-pg's log seems table initial failed, you can exec docker restart safeline-mgt to restart safeline-mgt, and table will reinit

Thanks.
So considering that I'm running safeline together with traefik plugin do I need to run tengine container? what containers can I remove from the docker compose? or all of them are require despite using traefik plugin?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants