xtrime-ru / TelegramApiServer

Fast, simple, async php telegram api server: MadelineProto + Amp HTTP Server
https://tg.i-c-a.su
MIT License
575 stars 129 forks source link

Error when starting container #155

Closed zqxqt closed 6 months ago

zqxqt commented 6 months ago

Hi, i got error when tried to start container

`user:~/www/folder/TelegramApiServer$ docker compose pull [+] Pulling 2/2 ✔ api Pulled 1.5s ✔ mysql Pulled 1.5s user:~/www/folder/TelegramApiServer$ docker compose run --rm api [+] Creating 2/2 ✔ Network telegramapiserver_default Created 0.3s ✔ Container telegramapiserver-mysql-1 Created 0.2s [+] Running 1/1 ✔ Container telegramapiserver-mysql-1 Started 0.8s [INFO wait] -------------------------------------------------------- [INFO wait] docker-compose-wait 2.9.0 [INFO wait] --------------------------- [DEBUG wait] Starting with configuration: [DEBUG wait] - Hosts to be waiting for: [mysql:3306] [DEBUG wait] - Paths to be waiting for: [] [DEBUG wait] - Timeout before failure: 30 seconds [DEBUG wait] - TCP connection timeout before retry: 5 seconds [DEBUG wait] - Sleeping time before checking for hosts/paths availability: 0 seconds [DEBUG wait] - Sleeping time once all hosts/paths are available: 0 seconds [DEBUG wait] - Sleeping time between retries: 1 seconds [DEBUG wait] -------------------------------------------------------- [INFO wait] Checking availability of host [mysql:3306] [INFO wait] Host [mysql:3306] not yet available... [INFO wait] Host [mysql:3306] is now available! [INFO wait] -------------------------------------------------------- [INFO wait] docker-compose-wait - Everything's fine, the application can now start! [INFO wait] -------------------------------------------------------- [2024-05-13 18:36:46] [warning] Starting MadelineProto...

[2024-05-13 18:36:52] [error] An error occurred while trying to create the database: Connecting to the MySQL server failed: Connection to tcp://mysql:3306 failed after 3 attempts; previous attempts: DNS resolution for mysql failed: All query attempts failed for mysql..: Name 'mysql..' could not be processed for IDN., Name 'mysql..' could not be processed for IDN., DNS resolution for mysql failed: All query attempts failed for mysql..: Name 'mysql..' could not be processed for IDN., Name 'mysql..' could not be processed for IDN.`

env.docker

VERSION=1

SERVER_ADDRESS=0.0.0.0 SERVER_PORT=9503 REAL_IP_HEADER=

MEMORY_LIMIT=256M TIMEZONE=UTC

REQUESTS_BULK_INTERVAL=0.5

IP_WHITELIST=127.0.0.1,other_ips

PASSWORDS={}

TELEGRAM_API_ID=my_id TELEGRAM_API_HASH=my_hash LOGGER_LEVEL=2

TELEGRAM_PROXY_ADDRESS= TELEGRAM_PROXY_PORT= TELEGRAM_PROXY_USERNAME= TELEGRAM_PROXY_PASSWORD=

DB_TYPE=mysql DB_HOST=mysql DB_PORT=3306 DB_USER=root DB_PASSWORD= DB_DATABASE=MadelineProto DB_MAX_CONNECTIONS=10 DB_IDLE_TIMEOUT=60

DB_CACHE_TTL="+5 minutes" DB_SERIALIZER=serialize DB_ENABLE_MIN_DATABASE=0 DB_ENABLE_FILE_REFERENCE_DATABASE=0

docker-compose.yml

services: api: extends: file: docker-compose.base.yml service: base-api ports:

xtrime-ru commented 6 months ago

Hi! This is the issue with latest docker version:

Name 'mysql..' could not be processed for IDN

Here are commands for debian/ubuntu: remove current docker, install docker 25 and lock docker version from upgrading future.

apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh --version 25
apt-mark hold docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin
zqxqt commented 6 months ago

thats helped, thx

xtrime-ru commented 6 months ago

I forgot to send update on this issue. Latest version of TelegramApiServer now supports docker v26+. I was able to find a bug in one of core libraries and fix it: https://github.com/amphp/dns/pull/118

You can update to latest version of docker and TelegramApiServer like this:

cd TelegramApiServer;
docker compose down
git pull
rm -rf vendor/
apt-mark unhold docker-ce docker-ce-cli containerd.io docker-compose-plugin docker-ce-rootless-extras docker-buildx-plugin
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
docker compose pull
docker compose up -d