concourse / concourse-docker

Offical concourse/concourse Docker image.
Apache License 2.0
241 stars 153 forks source link

Web not connecting to DB #41

Closed SOIT-SF closed 5 years ago

SOIT-SF commented 5 years ago

I have followed instructions about running ssh key gen script, then run docker-compose. Here is what I see when doing that.

Attaching to concourse_concourse-db_1, concourse_concourse-web_1, concourse_concourse-worker_1
concourse-web_1     | {"timestamp":"2019-04-06T21:01:50.941371647Z","level":"info","source":"atc","message":"atc.cmd.start","data":{"session":"1"}}
concourse-web_1     | {"timestamp":"2019-04-06T21:01:50.945134121Z","level":"error","source":"atc","message":"atc.db.failed-to-open-db-retrying","data":{"error":"dial tcp 172.20.0.2:5432: connect: connection refused","session":"3"}}
concourse-db_1      | The files belonging to this database system will be owned by user "postgres".
concourse-db_1      | This user must also own the server process.

Here is my compose file just trying to run some testing

version: '3'

services:
  concourse-db:
    image: postgres
    environment:
    - POSTGRES_DB=concourse
    - POSTGRES_PASSWORD=password123
    - POSTGRES_USER=concourse
    - PGDATA=/database

  concourse-web:
    image: concourse/concourse
    command: web
    links: [concourse-db]
    depends_on: [concourse-db]
    ports: ["8080:8080"]
    volumes: ["./keys/web:/concourse-keys"]
    environment:
    - CONCOURSE_POSTGRES_HOST=concourse-db
    - CONCOURSE_POSTGRES_USER=concourse
    - CONCOURSE_POSTGRES_PASSWORD=password123
    - CONCOURSE_POSTGRES_DATABASE=concourse
    - CONCOURSE_EXTERNAL_URL=http://server-ipaddress:8080
    - CONCOURSE_ADD_LOCAL_USER=test:test
    - CONCOURSE_MAIN_TEAM_LOCAL_USER=test

  concourse-worker:
    image: concourse/concourse
    command: worker
    privileged: true
    links: [concourse-web]
    depends_on: [concourse-web]
    volumes: ["./keys/worker:/concourse-keys"]
    environment:
    - CONCOURSE_TSA_HOST=concourse-web:2222
    - CONCOURSE_GARDEN_NETWORK
vito commented 5 years ago

It'll fail for a bit as all components start concurrently. It should eventually connect when db is accepting connections.

I'd recommend trying master again - I just updated docker-compose.yml.

mengxu2018 commented 5 years ago

I met this issue just now , how to fix it?