Closed huashaoxu closed 9 months ago
The root cause of the issue, that odd-platform cannot connect to database. You need to start this docker service
database: image: postgres:13.2-alpine restart: always environment:
5432:5432
You will find all services here docker/demo.yaml Also you can find ${POSTGRES_USER}, ${POSTGRES_PASSWORD}, ${POSTGRES_DATABASE} here - docker/.env If you have any questions, feel free to join our slack and we will assist you - Slack
This is what I did. I have executed the deployment according to the configuration of demo.yaml, and the database has been started and can be accessed normally in navicat. But collect cannot access it normally.
This exception was thrown by odd-platform, not by collector. Collector always restarts because odd-platform cannot start and collector trying to reach it. From this exception, I can assume, that smth wrong with your DB. could you please double check, is there postgresql://127.0.0.1:5432/odd-platform DB ?
odd-platform can start normally and can be accessed normally using a web browser. When I used the collector to collect another database, I found that collect was not working properly and always restarted.
could you please let me know 1) Do you start. all this in Docker? If yes, could you please share a list of your docker containers ? 2) It is strange that you are trying to access 127.0.0.1:5432 localhost instead of jdbc:postgresql://database:5432/${POSTGRES_DATABASE} 3) Could you please share your docker compose file in case you made some modifications in there ?
docker-compose.yaml:
version: '3.3'
services:
database:
image: postgres:13.2-alpine
restart: always
env_file: .env
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DATABASE=${POSTGRES_DATABASE}
ports:
- 5432:5432
volumes:
- odd_platform_db_home:/var/lib/postgresql/data
odd-platform:
image: dsatair2023/odd-platform:0.21.0
restart: always
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/${POSTGRES_DATABASE}
- SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
- SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
env_file: .env
ports:
- 8080:8080
odd-platform-enricher:
image: python:3.9.12-alpine3.15
volumes:
- ./injector:/injector
- ./config/injector:/samples
command:
- sh
- ./injector/start.sh
env_file: .env
environment:
- PLATFORM_HOST_URL=${PLATFORM_HOST_URL}
- PYTHONUNBUFFERED=1
depends_on:
- odd-platform
sample-postgresql:
image: postgres:13.2-alpine
restart: always
env_file: .env
volumes:
- ./config/dump.sql:/docker-entrypoint-initdb.d/init.sql
environment:
- POSTGRES_USER=${SAMPLE_POSTGRES_USER}
- POSTGRES_PASSWORD=${SAMPLE_POSTGRES_PASSWORD}
- POSTGRES_DATABASE=${SAMPLE_POSTGRES_DATABASE}
odd-collector:
image: dsatair2023/odd-platform:0.21.0
restart: always
env_file: .env
volumes:
- ./config/collector_config.yaml:/app/collector_config.yaml
environment:
- PLATFORM_HOST_URL=${PLATFORM_HOST_URL}
volumes:
odd_platform_db_home:
external: false
.env file:
POSTGRES_USER=odd-platform
POSTGRES_PASSWORD=odd-platform-password
POSTGRES_DATABASE=odd-platform
PLATFORM_HOST_URL=http://odd-platform:8080
SAMPLE_POSTGRES_USER=sample_odd_platform
SAMPLE_POSTGRES_PASSWORD=sample_odd_platform_password
SAMPLE_POSTGRES_DATABASE=sample_odd_platform
odd-collector: image: dsatair2023/odd-platform:0.21.0 restart: always env_file: .env volumes:
You are using odd-platform image for odd-collector For odd-collector we expect smth like image: ghcr.io/opendatadiscovery/odd-collector:latest
Seems the issue was due to the miss configuration of docker-compose: we have to use different images for platform and for collectors.
version: v0.21.0 deploy: docker-compose
The collector always restarts, and the log information is as follows: