JerryCai / arachni

15 stars 14 forks source link

psql environment variables #6

Closed tseabra closed 5 years ago

tseabra commented 5 years ago

5 implementation

JerryCai commented 5 years ago

@tseabra you did great improvement, thank you!

evinel commented 5 years ago

Hi,

arachni container could not connect to external postgresql database. The log show "localhost and arachni_production" are always used.

 version: '3'
services:
  postgres:
    image: postgres:9.6
    restart: always
    environment:
      POSTGRES_DB: arachni
      POSTGRES_USER: test_username
      POSTGRES_PASSWORD: test_username
    ports:
      - "5432:5432"
  arachni:
    image: arachni/arachni
    command: bash -c "sleep 10 && entrypoint.sh"
    environment:
      DB_ADAPTER: postgresql
      DB_HOST: postgres
      DB_NAME: arachni
      DB_USER: test_username
      DB_PASS: test_username
    ports:
      - "7331:7331"
      - "9292:9292"
      - "222:22"
    depends_on:
      - postgres

Error :

arachni_1   | Couldn't create database for {"host"=>"localhost", "adapter"=>"postgresql", "encoding"=>"unicode", "database"=>"arachni_production", "pool"=>50, "username"=>"arachni", "password"=>"secret"}
arachni_1   | rake aborted!
arachni_1   | PG::ConnectionBad: could not connect to server: Connection refused
arachni_1   |   Is the server running on host "localhost" (127.0.0.1) and accepting
arachni_1   |   TCP/IP connections on port 5432?
arachni_1   | could not connect to server: Cannot assign requested address
arachni_1   |   Is the server running on host "localhost" (::1) and accepting
arachni_1   |   TCP/IP connections on port 5432?

Could you help me ?