ruma / homeserver

A Matrix homeserver written in Rust.
https://www.ruma.io/
1.08k stars 41 forks source link

[DOCKER] Problem running server #173

Closed gperdomor closed 7 years ago

gperdomor commented 7 years ago

hi, i tried to run RUMA in a localhost enviroment but i get this error:

ERROR:r2d2: could not connect to server: Connection refused
    Is the server running on host "localhost" (::1) and accepting
    TCP/IP connections on port 5432"?
could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432"?

This is my ruma.yml file:

version: "1"
domain: "localhost"
macaroon_secret_key: "Ctr/mkMHebQ4OlqZNdB34exmNT/u1YY9+Hulor6XNWY="
postgres_url: postgres://postgres:test@localhost:5432/ruma"
bind_port: "3000"
mujx commented 7 years ago

Thank you for your interest in the project! Can you provide some steps (what you did) to reproduce your error?

gperdomor commented 7 years ago

Hi @mujx...

  1. I clone/download the repo
  2. Run script/cargo build
  3. Generate secret key with script/cargo run -- secret
  4. Create ruma.yaml on root of repository screen shot 2017-03-07 at 11 17 53 am
  5. Run script/cargo run -- run

I'm using macOS Sierra and the last Docker version

mujx commented 7 years ago

Ruma needs a postgres instance; that's the cause of the error. Currently ruma isn't ready for use so we don't have a script to run it.

You can use docker-compose run postgres to bring up a postgres database and change postgres://postgres:test@localhost:5432/ruma to postgres://postgres:test@postgres:5432/postgres in your ruma.yml file to use the defaults. You can always change them from the docker-compose file.

mujx commented 7 years ago

Closing as resolved. Please follow up with a comment if the problem persists.

gperdomor commented 7 years ago

@mujx well i made some changes in docker-compose.yml:

version: "2"
services:
  rust:
    build: ./docker/
    links:
      - "postgres"
    ports:
      - "3000:3000"    # NEW BUT NOT WORK xD
    volumes:
      - ".:/source"
      - "cargo_git:/root/.cargo/git"
      - "cargo_registry:/root/.cargo/registry"
  postgres:
    image: "postgres"
    ports:
      - "5432:5432"    # NEW
    environment:
      - "POSTGRES_DB=ruma"    # NEW
      - "POSTGRES_USER=user"    # NEW
      - "POSTGRES_PASSWORD=test"
volumes:
  cargo_git: {}
  cargo_registry: {}

I can connect to postgres but i can't connect to ruma... I browse to localhost:3000 but not works

mujx commented 7 years ago

I managed to get this working on my machine with the following configs. Just run docker-compose up. Let me know if that also works for you. You can verify with netstat -antp or similar if the 3000 port is open.

docker-compose.yaml

version: "2"
services:
  rust:
    image: "rumaio/ruma-dev@sha256:75a38913b7b325c47e115d5c5808efa8a309882288f91ee4ce4c077ef89213c3"
    links:
        - "postgres"
    ports:
        - "3000:3000"
    command: "cargo run -- run"
    environment:
        - "RUST_LOG=info"
    depends_on:
        - "postgres"
    volumes:
      - ".:/source"
      - "cargo_git:/root/.cargo/git"
      - "cargo_registry:/root/.cargo/registry"
  postgres:
    image: "postgres"
    ports:
        - "5432:5432"
    environment:
      - "POSTGRES_PASSWORD=test"
      - "POSTGRES_DB=ruma"
      - "POSTGRES_USER=user"
volumes:
  cargo_git: {}
  cargo_registry: {}

ruma.yaml

version: "1"
domain: "localhost"
macaroon_secret_key: "Ctr/mkMHebQ4OlqZNdB34exmNT/u1YY9+Hulor6XNWY="
postgres_url: "postgres://user:test@postgres:5432/ruma"
bind_port: "3000"
gperdomor commented 7 years ago

The port is open but...

screen shot 2017-03-09 at 5 12 02 pm

localhost:3000/ruma/swagger.jsonnot working either

mujx commented 7 years ago

You need the bind_address: "0.0.0.0" in your ruma.yaml to listen to all interfaces.

gperdomor commented 7 years ago

thanks... It's working now... Please update the docs :D