hibobmaster / matrix-stt-bot

A simple matrix bot that transcribes your voice to text message
https://matrix.to/#/#public:matrix.qqs.tw
MIT License
21 stars 3 forks source link

Getting stuck at "INFO - Login via password" #1

Closed jakobkilian closed 1 year ago

jakobkilian commented 1 year ago

Hi! Thanks for providing this repo. Very cool idea that I would like to experiment with for deaf people.

I am using the Yunohost package synapse_ynh. I followed the instructions and edited the config.json according to my server dates. Unfortunately when starting the the docker image with sudo docker compose up this is the output (won't change in 1 hour):

[+] Running 1/0
 ✔ Container matrix-stt-bot  Created                                                                                                                                0.0s 
Attaching to matrix-stt-bot
matrix-stt-bot  | 2023-07-19 18:15:05,645 - INFO - Bot started!
matrix-stt-bot  | 2023-07-19 18:15:11,946 - INFO - Login via password

I restarted the system and double checked the login credentials. Using Cinny I can login just fine.

This is my current config.json

{
    "homeserver": "https://matrix.MYDOMAIN.de",
    "user_id": "@botwhisper:MYDOMAIN.de",
    "password": "************",
    "device_id": "GMIAZSVFF",
    "room_id": "!mDqFzeYMAuCTDOlrBh:MYDOMAIN.de",
    "model_size": "medium",
    "import_keys_path": "element-keys.txt",
    "import_keys_password": "************"
}

Any idea? How can I get more verbose logging on why the login doesn't work?

hibobmaster commented 1 year ago

Hi, I just tested it without problem, It seems you stuck at model downloading step? Can you provide your working directory screenshot for me?

If you have downloaded model before, you can start to use the bot when getting INFO - Login via password.

Besides, you can try without importing e2ee keys, here is my test configuration. config.json

{
    "homeserver": "https://xxxxx.xxx",
    "user_id": "@lullap:xxx.xxxx",
    "password": "xxxxxxxxxx@NABYGaS^9",
    "device_id": "DFYEOKVPLG",
    "room_id": "!pgFjjtPUiAXSMyTmTU:matrix.qqs.tw",
    "model_size": "base"
}

compose.yaml

services:
  app:
    image: ghcr.io/hibobmaster/matrix-stt-bot:latest
    container_name: matrix-stt-bot
    restart: always
    # build:
    #   context: .
    #   dockerfile: ./Dockerfile
    # env_file:
    #   - .env
    volumes:
      # use env file or config.json
      - ./config.json:/app/config.json
      # use touch to create an empty file stt_db, for persist database only
      - ./stt_db:/app/db
      # import_keys path
      # - ./element-keys.txt:/app/element-keys.txt
      # store whisper models that program will download
      - ./models:/app/models
    networks:
      - matrix_network

networks:
  matrix_network:

Some errors can be ignored if you are not using E2EE room.

image image image

jakobkilian commented 1 year ago

Hi! Thanks for the quick reply.

Model download worked just fine i think. I used "medium" and the model could be found in the dir. I tested again now with "model_size": "base" and without E2EE. So my config and compose are identical to yours (except of URL and credentials of course). This is the log:

[+] Running 1/0
 ✔ Container matrix-stt-bot  Created                                                                                                                                                                                                       0.0s 
Attaching to matrix-stt-bot
matrix-stt-bot  | 2023-07-20 05:55:06,642 - INFO - Bot started!
Downloading model.bin:   0%|          | 0.00/145M [00:00<?, ?B/s]
matrix-stt-bot  | 
matrix-stt-bot  | 
Downloading (…)88d7250a/config.json: 100%|██████████| 2.31k/2.31k [00:00<00:00, 5.22MB/s]
matrix-stt-bot  | 
matrix-stt-bot  | 
matrix-stt-bot  | 0a/vocabulary.txt:   0%|          | 0.00/460k [00:00<?, ?B/s]
matrix-stt-bot  | 
Downloading model.bin:  14%|█▍        | 21.0M/145M [00:00<00:00, 151MB/s]
Downloading model.bin:  36%|███▌      | 52.4M/145M [00:00<00:00, 196MB/s], ?B/s]
matrix-stt-bot  | 
matrix-stt-bot  | 
Downloading (…)7250a/vocabulary.txt: 100%|██████████| 460k/460k [00:00<00:00, 1.62MB/s]
Downloading model.bin:  58%|█████▊    | 83.9M/145M [00:00<00:00, 206MB/s]
matrix-stt-bot  | 
matrix-stt-bot  | 
matrix-stt-bot  | 
Downloading (…)7250a/tokenizer.json: 100%|██████████| 2.20M/2.20M [00:00<00:00, 4.57MB/s]
matrix-stt-bot  | 
matrix-stt-bot  | 
Downloading model.bin:  79%|███████▉  | 115M/145M [00:00<00:00, 215MB/s] 
Downloading model.bin: 100%|██████████| 145M/145M [00:00<00:00, 214MB/s]
Downloading model.bin: 100%|██████████| 145M/145M [00:00<00:00, 204MB/s]
matrix-stt-bot  | 2023-07-20 05:55:09,165 - INFO - Login via password

Here it gets stuck again. When going to the channel there is no response and it is saying that the bot is offline... This is my working dir:

ls -lShR
.:
total 72K
-rw-r--r-- 1 admin 1007  24K Jul 19 14:55 bot.py
drwxr-xr-x 2 root  root 4.0K Jul 19 15:17 models
drwxr-xr-x 2 root  root 4.0K Jul 19 15:17 stt_db
-rw-r--r-- 1 admin 1007 3.1K Jul 19 14:55 README.md
-rw-r--r-- 1 admin 1007 1.3K Jul 19 14:55 send_message.py
-rw-r--r-- 1 admin 1007 1.2K Jul 19 14:55 log.py
-rw-r--r-- 1 admin 1007 1.1K Jul 19 14:55 LICENSE
-rw-r--r-- 1 admin 1007 1.1K Jul 19 14:55 requirements.txt
-rw-r--r-- 1 admin 1007  660 Jul 19 14:55 Dockerfile
-rw-r--r-- 1 admin 1007  657 Jul 19 15:16 compose.yaml
-rw-r--r-- 1 admin 1007  296 Jul 19 14:55 config.json.example
-rw-r--r-- 1 admin 1007  227 Jul 20 05:59 config.json
-rw-r--r-- 1 admin 1007  167 Jul 19 15:15 element-keys.txt

./models:
total 142M
-rw-r--r-- 1 root root 139M Jul 20 05:55 model.bin
-rw-r--r-- 1 root root 2.2M Jul 20 05:55 tokenizer.json
-rw-r--r-- 1 root root 450K Jul 20 05:55 vocabulary.txt
-rw-r--r-- 1 root root 2.3K Jul 20 05:55 config.json
-rw-r--r-- 1 root root    4 Jul 20 05:55 model.txt

./stt_db:
total 0

I also added some more logs to the code and can now be sure that it gets stuck in line 484 (resp = await self.client.login(password=self.password)). It never enters the following if not isinstance(resp, LoginResponse):

Any idea? Could it be a whitelisting problem or so? Bot and Matrix are on the same machine, should not be a problem I think..

hibobmaster commented 1 year ago

room_id correct? Try remove it.

{
    "homeserver": "https://matrix.MYDOMAIN.de",
    "user_id": "@botwhisper:MYDOMAIN.de",
    "password": "************",
    "device_id": "GMIAZSVFF",
    "model_size": "medium",
    "import_keys_path": "element-keys.txt",
    "import_keys_password": "************"
}
jakobkilian commented 1 year ago

already tried without room_id yes :( like so:

{
    "homeserver": "https://matrix.MYDOMAIN.de",
    "user_id": "@botwhisper:MYDOMAIN.de",
    "password": "************",
    "device_id": "GMIAZSVFF",
    "model_size": "base"
}
hibobmaster commented 1 year ago

I just update dependencies, can you pull the latest image and try again?

jakobkilian commented 1 year ago

unfortunately I am still stuck at "INFO - Login via password" I wonder how I could debug the login process further. I already double checked the credentials... If an connection from my local computer is possible it should be also possible from the same machine( the server) ...

hibobmaster commented 1 year ago

Try using a new device id, such as FMIAZSVFF. Besides, you can debug the code easily if you have python environment.

  1. git clone https://github.com/hibobmaster/matrix-stt-bot
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python bot.py

https://github.com/hibobmaster/matrix-stt-bot/blob/f20b1d5d40df65866cb9650856757ab223e61a9e/bot.py#L454-L468

    # bot login
    async def login(self) -> None:
        if self.access_token is not None:
            logger.info("Login via access_token")
        else:
            logger.info("Login via password")
            try:
                resp = await self.client.login(password=self.password)
                if not isinstance(resp, LoginResponse):
                    logger.error("Login Failed")
                    print(f"Login Failed: {resp}")
                    sys.exit(1)
+                logger.info("Login Success")
            except Exception as e:
                logger.error(f"Error: {e}", exc_info=True)

or mount bot.py in container.

services:
  app:
    image: ghcr.io/hibobmaster/matrix-stt-bot:latest
    container_name: matrix-stt-bot
    restart: always
    # build:
    #   context: .
    #   dockerfile: ./Dockerfile
    # env_file:
    #   - .env
    volumes:
      # use env file or config.json
      - ./config.json:/app/config.json
      # use touch to create an empty file stt_db, for persist database only(first time only!!!)
      - ./stt_db:/app/db
      # import_keys path
      # - ./element-keys.txt:/app/element-keys.txt
      # store whisper models that program will download
      - ./models:/app/models
+      - ./bot.py:/app/bot.py
    networks:
      - matrix_network

networks:
  matrix_network:
jakobkilian commented 1 year ago

Ok cool, got it working at least with the bot.py script (without docker): I ran into issues with the dependencies first and then had to sudo chown -R admin:1007 * in the repo folder because the /model/ dir had root:root rights only and so I couldn't run bot.py without sudo. After doing so I could run python bot.py and I could sucessfully transcribe messages.

sudo docker compose up however still doesn't work. Changing device_id had no effect. logger.info("Login Success") never gets called (as said before) it blocks at resp = await self.client.login(password=self.password)

I am not so experienced in docker. Maybe I need to do some network settings or so?

hibobmaster commented 1 year ago

That's so weird. Can you provide your compose file and docker version?

jakobkilian commented 1 year ago

you mean the compose.yaml? Just like yours:

services:
  app:
    image: ghcr.io/hibobmaster/matrix-stt-bot:latest
    container_name: matrix-stt-bot
    restart: always
    # build:
    #   context: .
    #   dockerfile: ./Dockerfile
    # env_file:
    #   - .env
    volumes:
      # use env file or config.json
      - ./config.json:/app/config.json
      # use touch to create an empty file stt_db, for persist database only(first time only!!!)
      - ./stt_db:/app/db
      # import_keys path
      # - ./element-keys.txt:/app/element-keys.txt
      # store whisper models that program will download
      - ./models:/app/models
      - ./bot.py:/app/bot.py
    networks:
      - matrix_network

networks:
  matrix_network:

And the docker version: Docker version 24.0.4, build 3713ee1

This is my folder now, after the chown thing:

drwxr-xr-x 9 admin 1007 4.0K Jul 20 15:03 .
-rw-r--r-- 1 admin 1007 128K Jul 20 14:38 db
drwxr-xr-x 2 admin 1007 4.0K Jul 20 14:33 output
-rw-r--r-- 1 admin 1007  241 Jul 20 14:29 bot.log
drwxr-xr-x 3 admin 1007 4.0K Jul 20 14:29 models
drwxr-xr-x 6 admin 1007 4.0K Jul 20 14:25 venv
drwxr-xr-x 2 admin 1007 4.0K Jul 20 14:00 __pycache__
-rw-r--r-- 1 admin 1007  686 Jul 20 13:59 compose.yaml
-rw-r--r-- 1 admin 1007  23K Jul 20 13:58 bot.py
-rw-r--r-- 1 admin 1007  227 Jul 20 10:46 config.json
drwxr-xr-x 2 admin 1007 4.0K Jul 20 10:02 stt_db
-rw-r--r-- 1 admin 1007  296 Jul 20 10:02 config.json.example
-rw-r--r-- 1 admin 1007  660 Jul 20 10:02 Dockerfile
-rw-r--r-- 1 admin 1007  213 Jul 20 10:02 .dockerignore
-rw-r--r-- 1 admin 1007  227 Jul 20 10:02 .env.example
drwxr-xr-x 8 admin 1007 4.0K Jul 20 10:02 .git
drwxr-xr-x 3 admin 1007 4.0K Jul 20 10:02 .github
-rw-r--r-- 1 admin 1007 1.9K Jul 20 10:02 .gitignore
-rw-r--r-- 1 admin 1007 1.1K Jul 20 10:02 LICENSE
-rw-r--r-- 1 admin 1007 1.2K Jul 20 10:02 log.py
-rw-r--r-- 1 admin 1007 3.1K Jul 20 10:02 README.md
-rw-r--r-- 1 admin 1007  949 Jul 20 10:02 requirements.txt
-rw-r--r-- 1 admin 1007 1.3K Jul 20 10:02 send_message.py
drwxr-xr-x 3 admin 1007 4.0K Jul 20 10:02 ..

thanks for your patience!

hibobmaster commented 1 year ago

I can't find what wrong with that. Try sudo docker compose down and rm -r models then sudo docker compose up.

If still no luck, you can run the bot in a screen session(~~~).

jakobkilian commented 1 year ago

no sucess with compose down and up again. You mean just use the .py as e.g. systemd service?

hibobmaster commented 1 year ago

You can write a systemd service or use screen or tmux to run bot in background.

hibobmaster commented 1 year ago

Hi, we can debug it by adding a timeout for login step. bot.py

    # bot login
    async def login(self) -> None:
        if self.access_token is not None:
            logger.info("Login via access_token")
        else:
            logger.info("Login via password")
            try:
+               # wait 5 seconds for login
+               resp = await asyncio.wait_for(self.client.login(password=self.password), 5.0)
                if not isinstance(resp, LoginResponse):
                    logger.error("Login Failed")
                    print(f"Login Failed: {resp}")
                    sys.exit(1)
+                logger.info("Login Success")
            except Exception as e:
                logger.error(f"Error: {e}", exc_info=True)
hibobmaster commented 1 year ago

During local debugging, I accidentally triggered the same issue, and magically, the program resumed responsiveness when I pressed the Enter key.

jakobkilian commented 1 year ago

Hi :) I don't really understand the Enter-key-thing (didn't work for me at least), but I have interesting new logs:

matrix-stt-bot  | 2023-07-21 12:25:30,077 - login - ERROR - Error: 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
matrix-stt-bot  |     return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
matrix-stt-bot  |     raise exceptions[0]
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
matrix-stt-bot  |     sock = await self._connect_sock(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
matrix-stt-bot  |     await self.sock_connect(sock, address)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
matrix-stt-bot  |     return await fut
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
matrix-stt-bot  |     raise OSError(err, f'Connect call failed {address}')
matrix-stt-bot  | ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 443)
matrix-stt-bot  | 
matrix-stt-bot  | The above exception was the direct cause of the following exception:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 778, in _send
matrix-stt-bot  |     transport_resp = await self.send(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 303, in wrapper
matrix-stt-bot  |     return await func(self, *args, **kwargs)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 850, in send
matrix-stt-bot  |     return await self.client_session.request(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
matrix-stt-bot  |     conn = await self._connector.connect(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 277, in connect_wrapper
matrix-stt-bot  |     connection = await type(self).connect(self, *args, **kwargs)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
matrix-stt-bot  |     proto = await self._create_connection(req, traces, timeout)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
matrix-stt-bot  |     _, proto = await self._create_direct_connection(req, traces, timeout)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
matrix-stt-bot  |     raise last_exc
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
matrix-stt-bot  |     transp, proto = await self._wrap_create_connection(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
matrix-stt-bot  |     raise client_error(req.connection_key, exc) from exc
matrix-stt-bot  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host matrix.MYDOMAIN.de:443 ssl:default [Connect call failed ('127.0.0.1', 443)]
matrix-stt-bot  | 
matrix-stt-bot  | During handling of the above exception, another exception occurred:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 998, in login
matrix-stt-bot  |     return await self._send(LoginResponse, method, path, data)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 816, in _send
matrix-stt-bot  |     await asyncio.sleep(wait)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 605, in sleep
matrix-stt-bot  |     return await future
matrix-stt-bot  | asyncio.exceptions.CancelledError
matrix-stt-bot  | 
matrix-stt-bot  | During handling of the above exception, another exception occurred:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
matrix-stt-bot  |     return fut.result()
matrix-stt-bot  | asyncio.exceptions.CancelledError
matrix-stt-bot  | 
matrix-stt-bot  | The above exception was the direct cause of the following exception:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/app/bot.py", line 493, in login
matrix-stt-bot  |     resp = await asyncio.wait_for(self.client.login(password=self.password), 5.0)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
matrix-stt-bot  |     raise exceptions.TimeoutError() from exc
matrix-stt-bot  | asyncio.exceptions.TimeoutError
matrix-stt-bot  | 
matrix-stt-bot  | 2023-07-21 12:25:30,077 - ERROR - Error: 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection
matrix-stt-bot  |     return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1076, in create_connection
matrix-stt-bot  |     raise exceptions[0]
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1060, in create_connection
matrix-stt-bot  |     sock = await self._connect_sock(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 969, in _connect_sock
matrix-stt-bot  |     await self.sock_connect(sock, address)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 501, in sock_connect
matrix-stt-bot  |     return await fut
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 541, in _sock_connect_cb
matrix-stt-bot  |     raise OSError(err, f'Connect call failed {address}')
matrix-stt-bot  | ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 443)
matrix-stt-bot  | 
matrix-stt-bot  | The above exception was the direct cause of the following exception:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 778, in _send
matrix-stt-bot  |     transport_resp = await self.send(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 303, in wrapper
matrix-stt-bot  |     return await func(self, *args, **kwargs)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 850, in send
matrix-stt-bot  |     return await self.client_session.request(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request
matrix-stt-bot  |     conn = await self._connector.connect(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 277, in connect_wrapper
matrix-stt-bot  |     connection = await type(self).connect(self, *args, **kwargs)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect
matrix-stt-bot  |     proto = await self._create_connection(req, traces, timeout)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _create_connection
matrix-stt-bot  |     _, proto = await self._create_direct_connection(req, traces, timeout)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
matrix-stt-bot  |     raise last_exc
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
matrix-stt-bot  |     transp, proto = await self._wrap_create_connection(
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 988, in _wrap_create_connection
matrix-stt-bot  |     raise client_error(req.connection_key, exc) from exc
matrix-stt-bot  | aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host matrix.MYDOMAIN.de:443 ssl:default [Connect call failed ('127.0.0.1', 443)]
matrix-stt-bot  | 
matrix-stt-bot  | During handling of the above exception, another exception occurred:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 998, in login
matrix-stt-bot  |     return await self._send(LoginResponse, method, path, data)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/async_client.py", line 816, in _send
matrix-stt-bot  |     await asyncio.sleep(wait)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 605, in sleep
matrix-stt-bot  |     return await future
matrix-stt-bot  | asyncio.exceptions.CancelledError
matrix-stt-bot  | 
matrix-stt-bot  | During handling of the above exception, another exception occurred:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
matrix-stt-bot  |     return fut.result()
matrix-stt-bot  | asyncio.exceptions.CancelledError
matrix-stt-bot  | 
matrix-stt-bot  | The above exception was the direct cause of the following exception:
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/app/bot.py", line 493, in login
matrix-stt-bot  |     resp = await asyncio.wait_for(self.client.login(password=self.password), 5.0)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
matrix-stt-bot  |     raise exceptions.TimeoutError() from exc
matrix-stt-bot  | asyncio.exceptions.TimeoutError
matrix-stt-bot  | 
matrix-stt-bot  | Traceback (most recent call last):
matrix-stt-bot  |   File "/app/bot.py", line 609, in <module>
matrix-stt-bot  |     asyncio.run(main())
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
matrix-stt-bot  |     return loop.run_until_complete(main)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
matrix-stt-bot  |     return future.result()
matrix-stt-bot  |   File "/app/bot.py", line 604, in main
matrix-stt-bot  |     await sync_task
matrix-stt-bot  |   File "/app/bot.py", line 504, in sync_forever
matrix-stt-bot  |     await self.client.sync_forever(timeout=timeout, full_state=full_state)
matrix-stt-bot  |   File "/usr/local/lib/python3.10/site-packages/nio/client/base_client.py", line 110, in wrapper
matrix-stt-bot  |     raise LocalProtocolError("Not logged in.")
matrix-stt-bot  | nio.exceptions.LocalProtocolError: Not logged in.
matrix-stt-bot  | Unclosed client session
matrix-stt-bot  | client_session: <aiohttp.client.ClientSession object at 0x7fc3f7e60040>
matrix-stt-bot exited with code 0

I have to leave now, but it seems to be a connection problem due to the matrix server being on the localhost but somehow not reachable. Is this maybe because the script cannot "see" outside of the image and thinks localhost is inside of the image or sth like that? I can read into that in more details later.

Maybe this is related as well: https://stackoverflow.com/questions/59976480/docker-errno-111-connect-call-failed-127-0-0-1-6379

see you in a bit

hibobmaster commented 1 year ago

Enter-key

I mean terminal is freeze, press something may help?


In your case, i guess your dns query is matrix.MYDOMAIN.de -> 127.0.0.1. Can you try edit your host and point matrix.MYDOMAIN.de to your public ip address? https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts

jakobkilian commented 1 year ago

Ok, I succeeded with adding this to my compose.yaml:

services:
  app:
+    extra_hosts:
+      - "matrix.MYDOMAIN.de:111.111.111.111"
    image: ghcr.io/hibobmaster/matrix-stt-bot:latest

... rest of the yaml file

of course put your domain and your public IP here. This did work for me. Thank you very very much for your patience.

_While implementing this to my server (I tried to connect that with a Signal Messenger Group) I realised that bridging a Signal Account to a Matrix Server involves some security issues (you only need to compromise the server basically...). This is why I didn't do further tests as I have to rethink my concept. Anyhow, thanks a lot, again. Maybe the extra_hosts tip helps someone..._

see ya