xmtp / xmtp-node-go

Software for the nodes that currently form the XMTP network
MIT License
10 stars 3 forks source link

Missing database string when starting server #56

Closed PranayAnchuri closed 2 years ago

PranayAnchuri commented 2 years ago

I am trying to start XMTP node on my local machine based on the instructions in https://github.com/xmtp/xmtp-node-go/blob/main/README.md

I get the following error when I try to run the node using ./build/xmtp.

2022-07-12T15:16:55.795-0400    WARN    gowaku  logger not yet initialized
2022-07-12T15:16:55.800-0400    INFO    gowaku  resolved host addr  {"addr": "0.0.0.0:60000"}
panic: pgdriver: invalid scheme:  [recovered]
    panic: pgdriver: invalid scheme:

goroutine 1 [running]:
github.com/xmtp/xmtp-node-go/tracing.Do.func1()
    /Users/pranayanchuri/work/xmtp-node-go/tracing/tracing.go:53 +0x100
panic({0x101130ca0, 0x14000914140})
    /opt/homebrew/Cellar/go/1.18.3/libexec/src/runtime/panic.go:838 +0x204
github.com/uptrace/bun/driver/pgdriver.WithDSN.func1(0x1400117b6e8?)
    /Users/pranayanchuri/go/pkg/mod/github.com/uptrace/bun/driver/pgdriver@v1.1.3/config.go:178 +0x90
github.com/uptrace/bun/driver/pgdriver.NewConnector({0x1400117b760, 0x1, 0x10?})
    /Users/pranayanchuri/go/pkg/mod/github.com/uptrace/bun/driver/pgdriver@v1.1.3/driver.go:76 +0x88
github.com/xmtp/xmtp-node-go/server.createDbOrFail({0x0?, 0x14000110150?}, 0x1?)
    /Users/pranayanchuri/work/xmtp-node-go/server/server.go:419 +0x40
github.com/xmtp/xmtp-node-go/server.New({_, _}, {0xea60, {0x10111b402, 0x7}, 0x0, 0xea61, {0x10116f87a, 0x7}, 0x0, ...})
    /Users/pranayanchuri/work/xmtp-node-go/server/server.go:77 +0x4ac
main.main.func1({0x1012e8e50?, 0x14000216870?})
    /Users/pranayanchuri/work/xmtp-node-go/main.go:83 +0x54
github.com/xmtp/xmtp-node-go/tracing.Do({0x1012e8de0?, 0x140001a4000?}, {0x100c294fb?, 0x0?}, 0x1012dadc0)
    /Users/pranayanchuri/work/xmtp-node-go/tracing/tracing.go:56 +0x84
main.main()
    /Users/pranayanchuri/work/xmtp-node-go/main.go:82 +0x368

It looked like a postgres issue. So, I ran docker-compose up -d and ensured that go_message_db and go_authz_db are up and running.

I then saw that db-connection-string option is required. So, I ran

./build/xmtp --message-db-connection-string="postgres://postgres:xmtp@localhost:5432/postgres?sslmode=disable"

but this throws

2022-07-12T15:19:39.720-0400    WARN    gowaku  logger not yet initialized
2022-07-12T15:19:39.725-0400    INFO    gowaku  resolved host addr  {"addr": "0.0.0.0:60000"}
2022-07-12T15:19:39.740-0400    FATAL   gowaku  timeout waiting for DB:     {"error": "FATAL: role \"postgres\" does not exist (SQLSTATE=28000)"}

Not sure if there is any additional db setup required before string the node.

jazzz commented 2 years ago

@PranayAnchuri Agreed the docs should be updated to make to make sure we are pointing developers in the right direction.

Not sure what your exact use case is, but running the node it self is likely not going to be too useful.

1) If your goal is to run tests, then the test harness will spin up the containers needed to run the test suite automatically.
if make test is causing you issues let me know and we can look at it.

2) The SDK has a good example of what it takes to spin up a functioning node. https://github.com/xmtp/xmtp-js/blob/main/dev/docker-compose.yml.

You can get a functioning node for testing by executing cd ./dev && docker-compose up in the SDK project folder.

PranayAnchuri commented 2 years ago

@jazzz

If your goal is to run tests, then the test harness will spin up the containers needed to run the test suite automatically. if make test is causing you issues let me know and we can look at it.

Tests seem to fail as well. Test nodes are not deploying. I see a bunch of postgres errors

--- FAIL: TestNodes_Deployment (0.00s)
    --- FAIL: TestNodes_Deployment/new_instances_connect_to_old_instances (0.02s)
        store.go:23:
                Error Trace:    store.go:23
                                                        node_test.go:473
                                                        node_test.go:457
                                                        wakunode2.go:291
                                                        node.go:77
                                                        node_test.go:447
                                                        node_test.go:420
                Error:          Received unexpected error:
                                FATAL: role "postgres" does not exist (SQLSTATE=28000)
                Test:           TestNodes_Deployment/new_instances_connect_to_old_instances

Here's the entire log error.log

snormore commented 2 years ago

Going to close this since it was sorted out in Slack. Future first-time setups shouldn't run into this with the dev/up workflow.