bmoscon / cryptostore

A scalable storage service for cryptocurrency data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Errno 111] Connection refused, [Errno 99] Cannot assign requested address

CharlesFr opened this issue · comments

I first pulled the container:

docker pull ghcr.io/bmoscon/cryptostore:latest

I then try to run it using the following command:

docker run -e EXCHANGE='COINBASE' \
           -e CHANNELS='trades,ticker,l2_book' \
           -e SYMBOLS='BTC-USD,ETH-USD' \
           -e BACKEND='POSTGRES' \
           -e DATABASE='cryptostore' \
           -e HOST='localhost' \
           -e PORT=5432 \
           -e USER='postgres' \
           -e PASSWORD='mypassword' \
            ghcr.io/bmoscon/cryptostore:latest

However, I'm getting this error:

Task exception was never retrieved
future: <Task finished name='Task-2' coro=<PostgresCallback.writer() done, defined at /usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py:84> exception=OSError('Multiple exceptions: [Errno 111] Connection refused, [Errno 99] Cannot assign requested address')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 89, in writer
    await self.write_batch(updates)
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 97, in write_batch
    await self._connect()
  File "/usr/local/lib/python3.9/site-packages/cryptofeed/backends/postgres.py", line 55, in _connect
    self.conn = await asyncpg.connect(user=self.user, password=self.pw, database=self.db, host=self.host, port=self.port)
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connection.py", line 2085, in connect
    return await connect_utils._connect(
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 895, in _connect
    raise last_error
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 881, in _connect
    return await _connect_addr(
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 781, in _connect_addr
    return await __connect_addr(params, timeout, True, *args)
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 825, in __connect_addr
    tr, pr = await compat.wait_for(connector, timeout=timeout)
  File "/usr/local/lib/python3.9/site-packages/asyncpg/compat.py", line 66, in wait_for
    return await asyncio.wait_for(fut, timeout)
  File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.9/site-packages/asyncpg/connect_utils.py", line 691, in _create_ssl_connection
    tr, pr = await loop.create_connection(
  File "uvloop/loop.pyx", line 2027, in create_connection
OSError: Multiple exceptions: [Errno 111] Connection refused, [Errno 99] Cannot assign requested address

Am I missing something?

I am also having issues, seems like networking is a issue, I am still learning docker so finding it a bit difficult sadly.

version: '3'
services:
redis:
image: "redis:latest"
ports:
- "6379:6379"
cryptostore:
image: "ghcr.io/bmoscon/cryptostore:latest"

environment:
- EXCHANGE='COINBASE'
- CHANNELS='trades'
- SYMBOLS='BTC-USD'
- BACKEND='REDIS'
- HOST='localhost'
- PORTS='6379'

documents-redis-1 | 1:M 30 May 2022 00:13:54.650 * DB loaded from disk: 0.000 seconds
documents-redis-1 | 1:M 30 May 2022 00:13:54.650 * Ready to accept connections
documents-cryptostore-1 | Traceback (most recent call last):
documents-cryptostore-1 | File "/cryptostore.py", line 161, in
documents-cryptostore-1 | main()
documents-cryptostore-1 | File "/cryptostore.py", line 155, in main
documents-cryptostore-1 | cfg = load_config()
documents-cryptostore-1 | File "/cryptostore.py", line 143, in load_config
documents-cryptostore-1 | raise ValueError('Invalid backend specified')
documents-cryptostore-1 | ValueError: Invalid backend specified
documents-cryptostore-1 exited with code 1

Resulting in the value error invalid backend specified

@bmoscon Can we get we your input on troubleshooting DB connection? I'm running a local Postgresql server.

I also found that the TCP example with the following command freezes the container with no outputs:

docker run -e EXCHANGE='COINBASE' \
           -e CHANNELS='trades' \
           -e SYMBOLS='BTC-USD' \
           -e BACKEND='TCP' \
           -e HOST='tcp://127.0.0.1' \
           -e PORT=8080 \
           cryptostore:latest

Thanks your help!

@bmoscon Can we get we your input on troubleshooting DB connection? I'm running a local Postgresql server.

I also found that the TCP example with the following command freezes the container with no outputs:

docker run -e EXCHANGE='COINBASE' \
           -e CHANNELS='trades' \
           -e SYMBOLS='BTC-USD' \
           -e BACKEND='TCP' \
           -e HOST='tcp://127.0.0.1' \
           -e PORT=8080 \
           cryptostore:latest

Thanks your help!
I will try to implement that.

I have a suggestion, for the port, try to do -p PORT=8080:8080 instead

you need to set the networking up correctly in docker. see https://docs.docker.com/network/