Problème d'accès à Duniter en localhost #22

Open
opened 2023-03-08 00:28:03 +01:00 by qo-op · 7 comments
Member

Après avoir installé Duniter 1.9
https://forum.duniter.org/t/image-docker-de-duniter-1-9-pour-raspberry-pi2-1v1-32bit/10532/50

J'essaye jaklis

~/.zen/Astroport.ONE/tools/jaklis/jaklis.py -n http://127.0.0.1:30901 balance -p 12JDJibbgZPRfD6Hoecg8rQRvCR5VYrMnqzfhQYmAr3k
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 581, in write_bytes
    await self.body.write(writer)
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/payload.py", line 247, in write
    await writer.write(self._value)
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/http_writer.py", line 115, in write
    self._write(chunk)
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/http_writer.py", line 75, in _write
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 42, in sendDoc
    balanceResult = self.client.execute(queryBuild, variable_values=paramsBuild)
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 167, in execute
    data: Dict[Any, Any] = loop.run_until_complete(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 126, in execute_async
    async with self as session:
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 250, in __aenter__
    await self.session.fetch_schema()
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 427, in fetch_schema
    execution_result = await self.transport.execute(
  File "/usr/local/lib/python3.9/dist-packages/gql/transport/aiohttp.py", line 198, in execute
    async with self.session.post(self.url, ssl=self.ssl, **post_args) as resp:
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 560, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 899, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno None] Can not write request body for http://127.0.0.1:30901

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/jaklis.py", line 252, in <module>
    gva.balance(args.mempool)
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gva.py", line 60, in balance
    balanceValue = gva.sendDoc()
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 44, in sendDoc
    message = ast.literal_eval(str(e))["message"]
  File "/usr/lib/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    [Errno None] Can not write request body for http://127.0.0.1:30901
           ^
SyntaxError: invalid syntax
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f88a64070>

Voici la config
https://ipfs.asycn.io/ipfs/QmZez3bvbGd1ZfWadUCtjsdQMZfziFXiA2dxPhrfrJDVdh

Je ne comprends pas bien l'erreur...
Faut-il passer par un proxy nginx?

Après avoir installé Duniter 1.9 https://forum.duniter.org/t/image-docker-de-duniter-1-9-pour-raspberry-pi2-1v1-32bit/10532/50 J'essaye jaklis ``` ~/.zen/Astroport.ONE/tools/jaklis/jaklis.py -n http://127.0.0.1:30901 balance -p 12JDJibbgZPRfD6Hoecg8rQRvCR5VYrMnqzfhQYmAr3k ``` ``` Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 581, in write_bytes await self.body.write(writer) File "/usr/local/lib/python3.9/dist-packages/aiohttp/payload.py", line 247, in write await writer.write(self._value) File "/usr/local/lib/python3.9/dist-packages/aiohttp/http_writer.py", line 115, in write self._write(chunk) File "/usr/local/lib/python3.9/dist-packages/aiohttp/http_writer.py", line 75, in _write raise ConnectionResetError("Cannot write to closing transport") ConnectionResetError: Cannot write to closing transport The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 42, in sendDoc balanceResult = self.client.execute(queryBuild, variable_values=paramsBuild) File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 167, in execute data: Dict[Any, Any] = loop.run_until_complete( File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 126, in execute_async async with self as session: File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 250, in __aenter__ await self.session.fetch_schema() File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 427, in fetch_schema execution_result = await self.transport.execute( File "/usr/local/lib/python3.9/dist-packages/gql/transport/aiohttp.py", line 198, in execute async with self.session.post(self.url, ssl=self.ssl, **post_args) as resp: File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 1141, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 560, in _request await resp.start(conn) File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 899, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.9/dist-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno None] Can not write request body for http://127.0.0.1:30901 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/fred/.zen/Astroport.ONE/tools/jaklis/jaklis.py", line 252, in <module> gva.balance(args.mempool) File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gva.py", line 60, in balance balanceValue = gva.sendDoc() File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 44, in sendDoc message = ast.literal_eval(str(e))["message"] File "/usr/lib/python3.9/ast.py", line 62, in literal_eval node_or_string = parse(node_or_string, mode='eval') File "/usr/lib/python3.9/ast.py", line 50, in parse return compile(source, filename, mode, flags, File "<unknown>", line 1 [Errno None] Can not write request body for http://127.0.0.1:30901 ^ SyntaxError: invalid syntax Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f88a64070> ``` Voici la config https://ipfs.asycn.io/ipfs/QmZez3bvbGd1ZfWadUCtjsdQMZfziFXiA2dxPhrfrJDVdh Je ne comprends pas bien l'erreur... Faut-il passer par un proxy nginx?
qo-op changed title from Problème d'aaccès localhost to Problème d'accès à Duniter en localhost 2023-03-08 00:28:20 +01:00
Author
Member

La première install était faite sur YunoHost, et les problèmes pouvaient provenir du proxy http ou du firewall que ce système ajoute (il a été incapable de gérer le proxy https)

Avec Duniter 1.9-GVA en mode docker sur Pi4 sans serveur http ni https

./jaklis.py -n http://127.0.0.1:30901 balance

Renvoi. Connection reset by peer

Traceback (most recent call last):
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 42, in sendDoc
    balanceResult = self.client.execute(queryBuild, variable_values=paramsBuild)
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 167, in execute
    data: Dict[Any, Any] = loop.run_until_complete(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 126, in execute_async
    async with self as session:
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 250, in __aenter__
    await self.session.fetch_schema()
  File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 427, in fetch_schema
    execution_result = await self.transport.execute(
  File "/usr/local/lib/python3.9/dist-packages/gql/transport/aiohttp.py", line 198, in execute
    async with self.session.post(self.url, ssl=self.ssl, **post_args) as resp:
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 560, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 899, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/usr/local/lib/python3.9/dist-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/fred/.zen/Astroport.ONE/./tools/jaklis/jaklis.py", line 252, in <module>
    gva.balance(args.mempool)
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gva.py", line 60, in balance
    balanceValue = gva.sendDoc()
  File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 44, in sendDoc
    message = ast.literal_eval(str(e))["message"]
  File "/usr/lib/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    [Errno 104] Connection reset by peer
           ^
SyntaxError: invalid syntax
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f7ff06400>

faut-il la couche https pour que jaklis fonctionne? Non.

La première install était faite sur YunoHost, et les problèmes pouvaient provenir du proxy http ou du firewall que ce système ajoute (il a été incapable de gérer le proxy https) Avec [Duniter 1.9-GVA en mode docker](https://forum.duniter.org/t/image-docker-de-duniter-1-9-pour-raspberry-pi2-1v1-32bit/10532/50?u=frederic_renault) sur Pi4 sans serveur http ni https ``` ./jaklis.py -n http://127.0.0.1:30901 balance ``` Renvoi. Connection reset by peer ``` Traceback (most recent call last): File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 42, in sendDoc balanceResult = self.client.execute(queryBuild, variable_values=paramsBuild) File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 167, in execute data: Dict[Any, Any] = loop.run_until_complete( File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 126, in execute_async async with self as session: File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 250, in __aenter__ await self.session.fetch_schema() File "/usr/local/lib/python3.9/dist-packages/gql/client.py", line 427, in fetch_schema execution_result = await self.transport.execute( File "/usr/local/lib/python3.9/dist-packages/gql/transport/aiohttp.py", line 198, in execute async with self.session.post(self.url, ssl=self.ssl, **post_args) as resp: File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 1141, in __aenter__ self._resp = await self._coro File "/usr/local/lib/python3.9/dist-packages/aiohttp/client.py", line 560, in _request await resp.start(conn) File "/usr/local/lib/python3.9/dist-packages/aiohttp/client_reqrep.py", line 899, in start message, payload = await protocol.read() # type: ignore[union-attr] File "/usr/local/lib/python3.9/dist-packages/aiohttp/streams.py", line 616, in read await self._waiter aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/fred/.zen/Astroport.ONE/./tools/jaklis/jaklis.py", line 252, in <module> gva.balance(args.mempool) File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gva.py", line 60, in balance balanceValue = gva.sendDoc() File "/home/fred/.zen/Astroport.ONE/tools/jaklis/lib/gvaBalance.py", line 44, in sendDoc message = ast.literal_eval(str(e))["message"] File "/usr/lib/python3.9/ast.py", line 62, in literal_eval node_or_string = parse(node_or_string, mode='eval') File "/usr/lib/python3.9/ast.py", line 50, in parse return compile(source, filename, mode, flags, File "<unknown>", line 1 [Errno 104] Connection reset by peer ^ SyntaxError: invalid syntax Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x7f7ff06400> ``` faut-il la couche https pour que jaklis fonctionne? Non.
Owner

C'est bien ton docker compose actuel ? https://ipfs.copylaradio.com/ipfs/QmWQU7zVdPydsNhvNkM59s4gQGf55v7PoktnXLN4C4De8k/docker-compose.yml

Tu arrives bien à accéder à http://127.0.0.1:30901/gva/playground ?
Et à faire une requête GVA ici, genre ça ?

{
  currentBlock {
    number
  }
}

Essai de rajouter le binding de port 0.0.0.0 pour le port GVA comme je l'indique sur mon compose: https://forum.monnaie-libre.fr/t/installer-facilement-duniter-1-9-gva/26923?u=poka

ports:
- 0.0.0.0:10901:10901
- 0.0.0.0:20901:20901
- 0.0.0.0:30901:30901
- 0.0.0.0:9220:9220
C'est bien ton docker compose actuel ? https://ipfs.copylaradio.com/ipfs/QmWQU7zVdPydsNhvNkM59s4gQGf55v7PoktnXLN4C4De8k/docker-compose.yml Tu arrives bien à accéder à http://127.0.0.1:30901/gva/playground ? Et à faire une requête GVA ici, genre ça ? ``` { currentBlock { number } } ``` Essai de rajouter le binding de port 0.0.0.0 pour le port GVA comme je l'indique sur mon compose: https://forum.monnaie-libre.fr/t/installer-facilement-duniter-1-9-gva/26923?u=poka ``` ports: - 0.0.0.0:10901:10901 - 0.0.0.0:20901:20901 - 0.0.0.0:30901:30901 - 0.0.0.0:9220:9220 ```
Author
Member

merci pour le coup de main
J'ai ajouté les 0.0.0.0 dans "ports"

J'ai modifié le docker-compose.yml et relancé avec "lazydocker" (ça me me permet de piger ce qui se passe sans tout comprendre)
https://korben.info/interface-docker-docker-compose.html

Toujours pas mieux...
Il faut lancer une commande docker spéciale pour qu'il relise le yml?

/gva/playground
Tu aurai des 'curl' POST qui trainent pour que je m'entraine avec l'API?

merci pour le coup de main J'ai ajouté les 0.0.0.0 dans "ports" J'ai modifié le docker-compose.yml et relancé avec "lazydocker" (ça me me permet de piger ce qui se passe sans tout comprendre) https://korben.info/interface-docker-docker-compose.html Toujours pas mieux... Il faut lancer une commande docker spéciale pour qu'il relise le yml? /gva/playground Tu aurai des 'curl' POST qui trainent pour que je m'entraine avec l'API?
Owner

il faut docker compose down, puis up, pour que le yaml soit pris en compte (pas juste stopper les container avec docker stop).

mais docker compose up, sans même down avant, doit recharger automatiquement le container si des changements dans le yaml ont été effectué justement.

Pour curl, oui c'était même ma première interaction avec gva: https://forum.duniter.org/t/prototype-de-gva/7688/7?u=poka

curl -s -X POST https://g1.librelois.fr/gva \
    -H "Content-Type: application/json" \
    --data '{ "query": "{currentUd {amount}}" }' \
    | jq .data.currentUd.amount
il faut docker compose down, puis up, pour que le yaml soit pris en compte (pas juste stopper les container avec docker stop). mais docker compose up, sans même down avant, doit recharger automatiquement le container si des changements dans le yaml ont été effectué justement. Pour curl, oui c'était même ma première interaction avec gva: https://forum.duniter.org/t/prototype-de-gva/7688/7?u=poka ``` curl -s -X POST https://g1.librelois.fr/gva \ -H "Content-Type: application/json" \ --data '{ "query": "{currentUd {amount}}" }' \ | jq .data.currentUd.amount ```
Author
Member

OK. J'ai fait docker-compose "down" puis "up"

Mais je n'ai pas de réponse avec cette requête sur http://127.0.0.1:30901/gva (je suis sur la même machine)

curl -s -X POST http://127.0.0.1:30901/gva -H "Content-Type: application/json"     --data '{ "query": "{currentUd {amount}}" }'

pourtant le port est bien là

netstat -tan | grep 30901
tcp        0      0 0.0.0.0:30901           0.0.0.0:*               LISTEN  
OK. J'ai fait docker-compose "down" puis "up" Mais je n'ai pas de réponse avec cette requête sur http://127.0.0.1:30901/gva (je suis sur la même machine) ``` curl -s -X POST http://127.0.0.1:30901/gva -H "Content-Type: application/json" --data '{ "query": "{currentUd {amount}}" }' ``` pourtant le port est bien là ``` netstat -tan | grep 30901 tcp 0 0 0.0.0.0:30901 0.0.0.0:* LISTEN ```
Owner

Ah si tu tapes sur l'ip/port directement sans passer par le reverse proxy alors il faut probablement enlever le path /gva:

curl -s -X POST http://127.0.0.1:30901 -H "Content-Type: application/json"     --data '{ "query": "{currentUd {amount}}" }'

?

Ah si tu tapes sur l'ip/port directement sans passer par le reverse proxy alors il faut probablement enlever le path /gva: ``` curl -s -X POST http://127.0.0.1:30901 -H "Content-Type: application/json" --data '{ "query": "{currentUd {amount}}" }' ``` ?
Author
Member

Bah non plus

curl -X POST http://127.0.0.1:30901/gva -H "Content-Type: application/json"     --data '{ "query": "{currentUd {amount}}" }'
curl: (56) Recv failure: Connexion ré-initialisée par le correspondant

curl -X POST http://127.0.0.1:30901 -H "Content-Type: application/json"     --data '{ "query": "{currentUd {amount}}" }'
curl: (52) Empty reply from server

Voila mon docker-compose.yml

version: '2.4'

services:
  duniter:
    image: pinidh/duniter:dev-arm64
    restart: unless-stopped
    environment:
      DUNITER_AUTO_SYNC: 'true'
      DUNITER_SYNC_HOST: "g1.duniter.org:443"
      DUNITER_BMA_ENABLED: 'true'
      DUNITER_BMA_IP4: "0.0.0.0"
      DUNITER_BMA_REMOTE_PORT: "443"
      DUNITER_BMA_REMOTE_HOST: "scorpio.copylaradio.com"
      DUNITER_GVA_ENABLED: 'true'
      DUNITER_GVA_PATH: 'gva'
      DUNITER_GVA_PORT: '30901'
      #DUNITER_GVA_REMOTE_PATH: "gva"
      #DUNITER_GVA_REMOTE_PORT: "443"
      DUNITER_GVA_REMOTE_HOST: "scorpio.copylaradio.com"
      DUNITER_GVA_SUBSCRIPTIONS_PATH: "gva-sub"
      DUNITER_GVA_WHITELIST: "127.0.0.1,::1"
      DUNITER_WS2P_HOST: "0.0.0.0"
      DUNITER_WS2P_PORT: '20901'
      DUNITER_WS2P_PUBLIC: 'false'
      DUNITER_WS2P_REMOTE_HOST: "scorpio.copylaradio.com"
      #DUNITER_WS2P_REMOTE_PORT: "443"
      #DUNITER_WS2P_REMOTE_PATH: "ws2p"
      #
      #DUNITER_POW_CPU: "0.3"
      #DUNITER_POW_NBCORES: "1"
      #
    ports:
    - 0.0.0.0:9220:9220
    - 0.0.0.0:10901:10901
    - 0.0.0.0:20901:20901
    - 0.0.0.0:30901:30901
    volumes:
    - data:/var/lib/duniter
    - etc:/etc/duniter
    networks:
      frontend:
    logging:
      options:
        max-size: "10m"
        max-file: "3"

volumes:
  data:
  etc:

networks:
  frontend:
Bah non plus ``` curl -X POST http://127.0.0.1:30901/gva -H "Content-Type: application/json" --data '{ "query": "{currentUd {amount}}" }' curl: (56) Recv failure: Connexion ré-initialisée par le correspondant ``` ``` curl -X POST http://127.0.0.1:30901 -H "Content-Type: application/json" --data '{ "query": "{currentUd {amount}}" }' curl: (52) Empty reply from server ``` Voila mon docker-compose.yml ``` version: '2.4' services: duniter: image: pinidh/duniter:dev-arm64 restart: unless-stopped environment: DUNITER_AUTO_SYNC: 'true' DUNITER_SYNC_HOST: "g1.duniter.org:443" DUNITER_BMA_ENABLED: 'true' DUNITER_BMA_IP4: "0.0.0.0" DUNITER_BMA_REMOTE_PORT: "443" DUNITER_BMA_REMOTE_HOST: "scorpio.copylaradio.com" DUNITER_GVA_ENABLED: 'true' DUNITER_GVA_PATH: 'gva' DUNITER_GVA_PORT: '30901' #DUNITER_GVA_REMOTE_PATH: "gva" #DUNITER_GVA_REMOTE_PORT: "443" DUNITER_GVA_REMOTE_HOST: "scorpio.copylaradio.com" DUNITER_GVA_SUBSCRIPTIONS_PATH: "gva-sub" DUNITER_GVA_WHITELIST: "127.0.0.1,::1" DUNITER_WS2P_HOST: "0.0.0.0" DUNITER_WS2P_PORT: '20901' DUNITER_WS2P_PUBLIC: 'false' DUNITER_WS2P_REMOTE_HOST: "scorpio.copylaradio.com" #DUNITER_WS2P_REMOTE_PORT: "443" #DUNITER_WS2P_REMOTE_PATH: "ws2p" # #DUNITER_POW_CPU: "0.3" #DUNITER_POW_NBCORES: "1" # ports: - 0.0.0.0:9220:9220 - 0.0.0.0:10901:10901 - 0.0.0.0:20901:20901 - 0.0.0.0:30901:30901 volumes: - data:/var/lib/duniter - etc:/etc/duniter networks: frontend: logging: options: max-size: "10m" max-file: "3" volumes: data: etc: networks: frontend: ```
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: axiom-team/jaklis#22
No description provided.