无法启动FastAPI服务器,asyncpg中出现错误

问题描述

编辑:原来有很多不同的错误。如果您遇到类似的问题,则可能是您在数据库中配置了错误的内容-例如在途中某个地方暴露了错误的端口。

这是我第一次在这里使用几乎所有堆栈。我不确定相关的内容,因此我将尝试提供所有信息。

我正在通过docker-compose在DigitalOcean Droplet上构建附加Postgres db的FastAPI应用。它在我的本地计算机上运行良好,但是无法在DigitalOcean上运行(它在AWS上以相同的方式失败,所以我猜这不是服务器问题)。

这是Dockerfile:

FROM python:3.8

EXPOSE 7000

RUN pip install --upgrade pip

RUN pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

RUN pip install fastapi[all] passlib[bcrypt] transformers[torch] python-jose[cryptography] tortoise-orm fastapi-users[tortoise-orm,oauth] databases[postgresql] python-multipart aiofiles jinja2 asyncpg aiomysql aiosqlite sentence-transformers numpy

COPY ./app /app

CMD uvicorn --host=0.0.0.0 app.main:app

这是docker-compose文件:

version: '3'
services:
  db:
    image: postgres:11
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_USER=XX
      - POSTGRES_PASSWORD=XX
      - POSTGRES_DB=XX
    networks:
      - mynetwork
  web:
    restart: always
    container_name: DiscuSearchFastAPI
    build: .
    ports:
      - "7000:7000"
    depends_on:
      - db
    networks:
      - mynetwork
networks:
  mynetwork:
    driver: bridge

在复制文件并在Droplet(Ubuntu 20)上安装docker之后,这是整个控制台:

root@ubuntu-s-1vcpu-1gb-nyc1-01:~/DiscuSearch# docker-compose build && docker-compose up
db uses an image,skipping
Building web
Step 1/7 : FROM python:3.8
3.8: Pulling from library/python
e4c3d3e4f7b0: Pull complete
101c41d0463b: Pull complete
8275efcd805f: Pull complete
751620502a7a: Pull complete
0a5e725150a2: Pull complete
397dba5694db: Pull complete
b453803265bc: Pull complete
a49354af7e01: Pull complete
7f7c8879a275: Pull complete
Digest: sha256:5b1dc84f5b565ef0a12c093734e76dc7fef2825d7713f90cc5634e1b32c21af1
Status: Downloaded newer image for python:3.8
 ---> f5e423f5ce1f
Step 2/7 : EXPOSE 7000
 ---> Running in ec2b5988704d
Removing intermediate container ec2b5988704d
 ---> 94bce661d81c
Step 3/7 : RUN pip install --upgrade pip
 ---> Running in fb4b28bd0cb5
Requirement already up-to-date: pip in /usr/local/lib/python3.8/site-packages (20.2.4)
Removing intermediate container fb4b28bd0cb5
 ---> e2797c69d3ad
Step 4/7 : RUN pip install torch==1.6.0+cpu torchvision==0.7.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
 ---> Running in 55edfe50a939
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.6.0+cpu
  Downloading https://download.pytorch.org/whl/cpu/torch-1.6.0%2Bcpu-cp38-cp38-linux_x86_64.whl (154.6 MB)
Collecting torchvision==0.7.0+cpu
  Downloading https://download.pytorch.org/whl/cpu/torchvision-0.7.0%2Bcpu-cp38-cp38-linux_x86_64.whl (5.1 MB)
Collecting numpy
  Downloading numpy-1.19.3-cp38-cp38-manylinux2010_x86_64.whl (14.9 MB)
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
Collecting pillow>=4.1.1
  Downloading Pillow-8.0.1-cp38-cp38-manylinux1_x86_64.whl (2.2 MB)
Building wheels for collected packages: future
  Building wheel for future (setup.py): started
  Building wheel for future (setup.py): finished with status 'done'
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491059 sha256=ca73a489be9ae0b4b5736d9162d2cbd2138ccc5f624d7e4bcb7513b2e8971a2b
  Stored in directory: /root/.cache/pip/wheels/8e/70/28/3d6ccd6e315f65f245da085482a2e1c7d14b90b30f239e2cf4
Successfully built future
Installing collected packages: numpy,future,torch,pillow,torchvision
Successfully installed future-0.18.2 numpy-1.19.3 pillow-8.0.1 torch-1.6.0+cpu torchvision-0.7.0+cpu
Removing intermediate container 55edfe50a939
 ---> dc94dba1f82c
Step 5/7 : RUN pip install fastapi[all] passlib[bcrypt] transformers[torch] python-jose[cryptography] tortoise-orm fastapi-users[tortoise-orm,oauth] databases[postgresql] python-multipart aiofiles jinja2 asyncpg aiomysql aiosqlite sentence-transformers numpy
 ---> Running in 495de7e00ea1
Collecting fastapi[all]
  Downloading fastapi-0.61.1-py3-none-any.whl (48 kB)
Collecting passlib[bcrypt]
  Downloading passlib-1.7.4-py2.py3-none-any.whl (525 kB)
Collecting transformers[torch]
  Downloading transformers-3.4.0-py3-none-any.whl (1.3 MB)
Collecting python-jose[cryptography]
  Downloading python_jose-3.2.0-py2.py3-none-any.whl (26 kB)
Collecting tortoise-orm
  Downloading tortoise-orm-0.16.17.tar.gz (94 kB)
Collecting fastapi-users[oauth,tortoise-orm]
  Downloading fastapi_users-3.0.6-py3-none-any.whl (22 kB)
Collecting databases[postgresql]
  Downloading databases-0.4.0-py3-none-any.whl (19 kB)
Collecting python-multipart
  Downloading python-multipart-0.0.5.tar.gz (32 kB)
Collecting aiofiles
  Downloading aiofiles-0.6.0-py3-none-any.whl (11 kB)
Collecting jinja2
  Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting asyncpg
  Downloading asyncpg-0.21.0-cp38-cp38-manylinux1_x86_64.whl (2.9 MB)
Collecting aiomysql
  Downloading aiomysql-0.0.20-py3-none-any.whl (40 kB)
Collecting aiosqlite
  Downloading aiosqlite-0.16.0-py3-none-any.whl (15 kB)
Collecting sentence-transformers
  Downloading sentence-transformers-0.3.8.tar.gz (66 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (1.19.3)
Collecting pydantic<2.0.0,>=1.0.0
  Downloading pydantic-1.7.2-cp38-cp38-manylinux2014_x86_64.whl (12.2 MB)
Collecting starlette==0.13.6
  Downloading starlette-0.13.6-py3-none-any.whl (59 kB)
Collecting orjson<4.0.0,>=3.2.1; extra == "all"
  Downloading orjson-3.4.3-cp38-cp38-manylinux2014_x86_64.whl (232 kB)
Collecting uvicorn<0.12.0,>=0.11.5; extra == "all"
  Downloading uvicorn-0.11.8-py3-none-any.whl (43 kB)
Collecting async_exit_stack<2.0.0,>=1.0.1; extra == "all"
  Downloading async_exit_stack-1.0.1-py3-none-any.whl (4.7 kB)
Collecting email_validator<2.0.0,>=1.1.1; extra == "all"
  Downloading email_validator-1.1.1-py2.py3-none-any.whl (17 kB)
Collecting graphene<3.0.0,>=2.1.8; extra == "all"
  Downloading graphene-2.1.8-py2.py3-none-any.whl (107 kB)
Collecting pyyaml<6.0.0,>=5.3.1; extra == "all"
  Downloading PyYAML-5.3.1.tar.gz (269 kB)
Collecting requests<3.0.0,>=2.24.0; extra == "all"
  Downloading requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting ujson<4.0.0,>=3.0.0; extra == "all"
  Downloading ujson-3.2.0-cp38-cp38-manylinux1_x86_64.whl (181 kB)
Collecting itsdangerous<2.0.0,>=1.1.0; extra == "all"
  Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting async_generator<2.0.0,>=1.10; extra == "all"
  Downloading async_generator-1.10-py3-none-any.whl (18 kB)
Collecting bcrypt>=3.1.0; extra == "bcrypt"
  Downloading bcrypt-3.2.0-cp36-abi3-manylinux2010_x86_64.whl (63 kB)
Collecting regex!=2019.12.17
  Downloading regex-2020.10.28-cp38-cp38-manylinux2010_x86_64.whl (679 kB)
Collecting tqdm>=4.27
  Downloading tqdm-4.51.0-py2.py3-none-any.whl (70 kB)
Collecting filelock
  Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting protobuf
  Downloading protobuf-3.13.0-cp38-cp38-manylinux1_x86_64.whl (1.3 MB)
Collecting sentencepiece!=0.1.92
  Downloading sentencepiece-0.1.94-cp38-cp38-manylinux2014_x86_64.whl (1.1 MB)
Collecting packaging
  Downloading packaging-20.4-py2.py3-none-any.whl (37 kB)
Collecting sacremoses
  Downloading sacremoses-0.0.43.tar.gz (883 kB)
Collecting tokenizers==0.9.2
  Downloading tokenizers-0.9.2-cp38-cp38-manylinux1_x86_64.whl (2.9 MB)
Requirement already satisfied: torch>=1.0; extra == "torch" in /usr/local/lib/python3.8/site-packages (from transformers[torch]) (1.6.0+cpu)
Collecting ecdsa<0.15
  Downloading ecdsa-0.14.1-py2.py3-none-any.whl (79 kB)
Collecting six<2.0
  Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting pyasn1
  Downloading pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
Collecting rsa
  Downloading rsa-4.6-py3-none-any.whl (47 kB)
Collecting cryptography; extra == "cryptography"
  Downloading cryptography-3.2.1-cp35-abi3-manylinux2010_x86_64.whl (2.6 MB)
Collecting pypika>=0.39.0
  Downloading pypika-0.43.0.tar.gz (60 kB)
Collecting iso8601>=0.1.12
  Downloading iso8601-0.1.13-py2.py3-none-any.whl (9.3 kB)
Collecting typing-extensions>=3.7
  Downloading typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting aerich>=0.3.2
  Downloading aerich-0.3.2-py3-none-any.whl (25 kB)
Collecting makefun<1.10,>=1.9.2
  Downloading makefun-1.9.4-py2.py3-none-any.whl (17 kB)
Collecting pyjwt==1.7.1
  Downloading PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
Collecting httpx-oauth<0.4,>=0.3; extra == "oauth"
  Downloading httpx_oauth-0.3.4-py3-none-any.whl (9.8 kB)
Collecting sqlalchemy
  Downloading SQLAlchemy-1.3.20-cp38-cp38-manylinux2010_x86_64.whl (1.3 MB)
Collecting psycopg2; extra == "postgresql"
  Downloading psycopg2-2.8.6.tar.gz (383 kB)
Collecting MarkupSafe>=0.23
  Downloading MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Collecting PyMySQL<=0.9.2,>=0.9
  Downloading PyMySQL-0.9.2-py2.py3-none-any.whl (47 kB)
Collecting scikit-learn
  Downloading scikit_learn-0.23.2-cp38-cp38-manylinux1_x86_64.whl (6.8 MB)
Collecting scipy
  Downloading scipy-1.5.3-cp38-cp38-manylinux1_x86_64.whl (25.8 MB)
Collecting nltk
  Downloading nltk-3.5.zip (1.4 MB)
Collecting uvloop>=0.14.0; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
  Downloading uvloop-0.14.0-cp38-cp38-manylinux2010_x86_64.whl (4.7 MB)
Collecting websockets==8.*
  Downloading websockets-8.1-cp38-cp38-manylinux2010_x86_64.whl (78 kB)
Collecting click==7.*
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting h11<0.10,>=0.8
  Downloading h11-0.9.0-py2.py3-none-any.whl (53 kB)
Collecting httptools==0.1.*; sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
  Downloading httptools-0.1.1-cp38-cp38-manylinux1_x86_64.whl (227 kB)
Collecting idna>=2.0.0
  Downloading idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting dnspython>=1.15.0
  Downloading dnspython-2.0.0-py3-none-any.whl (208 kB)
Collecting graphql-relay<3,>=2
  Downloading graphql_relay-2.0.1-py3-none-any.whl (20 kB)
Collecting aniso8601<=7,>=3
  Downloading aniso8601-7.0.0-py2.py3-none-any.whl (42 kB)
Collecting graphql-core<3,>=2.1
  Downloading graphql_core-2.3.2-py2.py3-none-any.whl (252 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
Collecting cffi>=1.1
  Downloading cffi-1.14.3-cp38-cp38-manylinux1_x86_64.whl (410 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.8/site-packages (from protobuf->transformers[torch]) (50.3.2)
Collecting pyparsing>=2.0.2
  Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)
Collecting joblib
  Downloading joblib-0.17.0-py3-none-any.whl (301 kB)
Requirement already satisfied: future in /usr/local/lib/python3.8/site-packages (from torch>=1.0; extra == "torch"->transformers[torch]) (0.18.2)
Collecting httpx<0.17,>=0.15
  Downloading httpx-0.16.1-py3-none-any.whl (65 kB)
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-2.1.0-py3-none-any.whl (12 kB)
Collecting promise<3,>=2.2
  Downloading promise-2.3.tar.gz (19 kB)
Collecting rx<2,>=1.6
  Downloading Rx-1.6.1-py2.py3-none-any.whl (179 kB)
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
Collecting httpcore==0.12.*
  Downloading httpcore-0.12.0-py3-none-any.whl (53 kB)
Collecting rfc3986[idna2008]<2,>=1.3
  Downloading rfc3986-1.4.0-py2.py3-none-any.whl (31 kB)
Collecting sniffio
  Downloading sniffio-1.2.0-py3-none-any.whl (10 kB)
Building wheels for collected packages: tortoise-orm,python-multipart,sentence-transformers,pyyaml,sacremoses,pypika,psycopg2,nltk,promise
  Building wheel for tortoise-orm (setup.py): started
  Building wheel for tortoise-orm (setup.py): finished with status 'done'
  Created wheel for tortoise-orm: filename=tortoise_orm-0.16.17-py3-none-any.whl size=108764 sha256=3c59fa9be2043e0a283f0ba0aa90762ab45e3e873054956a614ddd26693a3f82
  Stored in directory: /root/.cache/pip/wheels/f9/04/24/195d24c0a127b8298b5aed16cc0d6b0a737501c1392b331099
  Building wheel for python-multipart (setup.py): started
  Building wheel for python-multipart (setup.py): finished with status 'done'
  Created wheel for python-multipart: filename=python_multipart-0.0.5-py3-none-any.whl size=31670 sha256=d88b52d83fcdacc1e3766b1f70974dadba0810ae7a4ccb044d07b0fd7ccad505
  Stored in directory: /root/.cache/pip/wheels/9e/fc/1c/cf980e6413d3ee8e70cd8f39e2366b0f487e3e221aeb452eb0
  Building wheel for sentence-transformers (setup.py): started
  Building wheel for sentence-transformers (setup.py): finished with status 'done'
  Created wheel for sentence-transformers: filename=sentence_transformers-0.3.8-py3-none-any.whl size=101996 sha256=0613ddbb80a2f8919670cb8d44dd36da64c0ba1148cd5897bc37acd2cd23812f
  Stored in directory: /root/.cache/pip/wheels/95/eb/10/39e6fdf924ec09c8f177547a8b3976c624632e180d36e1cb56
  Building wheel for pyyaml (setup.py): started
  Building wheel for pyyaml (setup.py): finished with status 'done'
  Created wheel for pyyaml: filename=PyYAML-5.3.1-cp38-cp38-linux_x86_64.whl size=572460 sha256=fe06c85293d0da96cd6549d2a4a58943be2fe83fd3b49aca52dd4fda53d83b37
  Stored in directory: /root/.cache/pip/wheels/13/90/db/290ab3a34f2ef0b5a0f89235dc2d40fea83e77de84ed2dc05c
  Building wheel for sacremoses (setup.py): started
  Building wheel for sacremoses (setup.py): finished with status 'done'
  Created wheel for sacremoses: filename=sacremoses-0.0.43-py3-none-any.whl size=893259 sha256=2719f54ea8eb2169e3adaac106ee9bcfb745ebd760fc5501ff5409b7ae05e7ed
  Stored in directory: /root/.cache/pip/wheels/7b/78/f4/27d43a65043e1b75dbddaa421b573eddc67e712be4b1c80677
  Building wheel for pypika (setup.py): started
  Building wheel for pypika (setup.py): finished with status 'done'
  Created wheel for pypika: filename=PyPika-0.43.0-py2.py3-none-any.whl size=46526 sha256=e925a4b5f0259a4a0a9c1edde2db202e25badc79af45b44ec407e1e3b10e4659
  Stored in directory: /root/.cache/pip/wheels/a1/3c/30/39e72a8618e7f74681b093f39fc7df9db5a5d9a5343598a75f
  Building wheel for psycopg2 (setup.py): started
  Building wheel for psycopg2 (setup.py): finished with status 'done'
  Created wheel for psycopg2: filename=psycopg2-2.8.6-cp38-cp38-linux_x86_64.whl size=501094 sha256=d985613330e1098ab8993a77e2de35b79f5f4cdee8394303d60b2981383c15ab
  Stored in directory: /root/.cache/pip/wheels/70/5e/69/8a020d78c09043156a7df0b64529e460fbd922ca065c4b795c
  Building wheel for nltk (setup.py): started
  Building wheel for nltk (setup.py): finished with status 'done'
  Created wheel for nltk: filename=nltk-3.5-py3-none-any.whl size=1434675 sha256=ac4d0bceab3793ae0476363feeb4cf56db8ecd34106377f6ed1a355f701c4328
  Stored in directory: /root/.cache/pip/wheels/ff/d5/7b/f1fb4e1e1603b2f01c2424dd60fbcc50c12ef918bafc44b155
  Building wheel for promise (setup.py): started
  Building wheel for promise (setup.py): finished with status 'done'
  Created wheel for promise: filename=promise-2.3-py3-none-any.whl size=21494 sha256=c801735e97a177280e9650c6fe518ab355ff8f8d77753d31c8b9c61d404d0117
  Stored in directory: /root/.cache/pip/wheels/54/aa/01/724885182f93150035a2a91bce34a12877e8067a97baaf5dc8
Successfully built tortoise-orm python-multipart sentence-transformers pyyaml sacremoses pypika psycopg2 nltk promise
Installing collected packages: pydantic,starlette,MarkupSafe,jinja2,orjson,uvloop,websockets,click,h11,httptools,uvicorn,async-exit-stack,idna,dnspython,email-validator,six,rx,promise,graphql-core,graphql-relay,aniso8601,graphene,certifi,chardet,urllib3,requests,aiofiles,ujson,itsdangerous,async-generator,fastapi,pycparser,cffi,bcrypt,passlib,regex,tqdm,filelock,protobuf,sentencepiece,pyparsing,packaging,joblib,tokenizers,transformers,ecdsa,pyasn1,rsa,cryptography,python-jose,iso8601,typing-extensions,aiosqlite,aerich,tortoise-orm,makefun,pyjwt,sniffio,httpcore,rfc3986,httpx,httpx-oauth,fastapi-users,sqlalchemy,asyncpg,databases,PyMySQL,aiomysql,threadpoolctl,scipy,scikit-learn,sentence-transformers
ERROR: After October 2020 you may experience errors when installing or updating packages. This is because pip will change the way that it resolves dependency conflicts.

We recommend you use --use-feature=2020-resolver to test your packages with the new resolver before it becomes the default.

sentence-transformers 0.3.8 requires transformers<3.4.0,>=3.1.0,but you'll have transformers 3.4.0 which is incompatible.
Successfully installed MarkupSafe-1.1.1 PyMySQL-0.9.2 aerich-0.3.2 aiofiles-0.6.0 aiomysql-0.0.20 aiosqlite-0.16.0 aniso8601-7.0.0 async-exit-stack-1.0.1 async-generator-1.10 asyncpg-0.21.0 bcrypt-3.2.0 certifi-2020.6.20 cffi-1.14.3 chardet-3.0.4 click-7.1.2 cryptography-3.2.1 databases-0.4.0 dnspython-2.0.0 ecdsa-0.14.1 email-validator-1.1.1 fastapi-0.61.1 fastapi-users-3.0.6 filelock-3.0.12 graphene-2.1.8 graphql-core-2.3.2 graphql-relay-2.0.1 h11-0.9.0 httpcore-0.12.0 httptools-0.1.1 httpx-0.16.1 httpx-oauth-0.3.4 idna-2.10 iso8601-0.1.13 itsdangerous-1.1.0 jinja2-2.11.2 joblib-0.17.0 makefun-1.9.4 nltk-3.5 orjson-3.4.3 packaging-20.4 passlib-1.7.4 promise-2.3 protobuf-3.13.0 psycopg2-2.8.6 pyasn1-0.4.8 pycparser-2.20 pydantic-1.7.2 pyjwt-1.7.1 pyparsing-2.4.7 pypika-0.43.0 python-jose-3.2.0 python-multipart-0.0.5 pyyaml-5.3.1 regex-2020.10.28 requests-2.24.0 rfc3986-1.4.0 rsa-4.6 rx-1.6.1 sacremoses-0.0.43 scikit-learn-0.23.2 scipy-1.5.3 sentence-transformers-0.3.8 sentencepiece-0.1.94 six-1.15.0 sniffio-1.2.0 sqlalchemy-1.3.20 starlette-0.13.6 threadpoolctl-2.1.0 tokenizers-0.9.2 tortoise-orm-0.16.17 tqdm-4.51.0 transformers-3.4.0 typing-extensions-3.7.4.3 ujson-3.2.0 urllib3-1.25.11 uvicorn-0.11.8 uvloop-0.14.0 websockets-8.1
Removing intermediate container 495de7e00ea1
 ---> 1f5ebe87ad1b
Step 6/7 : COPY ./app /app
 ---> 1a8304d31427
Step 7/7 : CMD uvicorn --host=0.0.0.0 app.main:app
 ---> Running in 312a5918910b
Removing intermediate container 312a5918910b
 ---> f40ca2cf01f4
Successfully built f40ca2cf01f4
Successfully tagged discusearch_web:latest
Creating network "discusearch_mynetwork" with driver "bridge"
Pulling db (postgres:11)...
11: Pulling from library/postgres
babf97a3f00a: Pull complete
0526c44df6ea: Pull complete
b2466ee00e96: Pull complete
77c605d60192: Pull complete
76b14ab41842: Pull complete
440f557fff31: Pull complete
30bba27806f4: Pull complete
a4e155509054: Pull complete
4eb8e47accdf: Pull complete
de89dffa0b49: Pull complete
9b7294df4e25: Pull complete
1ddd01426f4a: Pull complete
b846471366bf: Pull complete
ee5883575014: Pull complete
Digest: sha256:d441bf645a1dcd2b4429d916c276d4c01299ee16b7a0e0f3d0baa846cbd4ee07
Status: Downloaded newer image for postgres:11
Creating discusearch_db_1 ... done
Creating DiscuSearchFastAPI ... done
Attaching to discusearch_db_1,DiscuSearchFastAPI
db_1   | The files belonging to this database system will be owned by user "postgres".
db_1   | This user must also own the server process.
db_1   | 
db_1   | The database cluster will be initialized with locale "en_US.utf8".
db_1   | The default database encoding has accordingly been set to "UTF8".
db_1   | The default text search configuration will be set to "english".
db_1   | 
db_1   | Data page checksums are disabled.
db_1   | 
db_1   | fixing permissions on existing directory /var/lib/postgresql/data ... ok
db_1   | creating subdirectories ... ok
db_1   | selecting default max_connections ... 100
db_1   | selecting default shared_buffers ... 128MB
db_1   | selecting default timezone ... Etc/UTC
db_1   | selecting dynamic shared memory implementation ... posix
db_1   | creating configuration files ... ok
db_1   | running bootstrap script ... ok
db_1   | performing post-bootstrap initialization ... ok
db_1   | syncing data to disk ... ok
db_1   | 
db_1   | WARNING: enabling "trust" authentication for local connections
db_1   | You can change this by editing pg_hba.conf or using the option -A,or
db_1   | --auth-local and --auth-host,the next time you run initdb.
db_1   | 
db_1   | Success. You can now start the database server using:
db_1   | 
db_1   |     pg_ctl -D /var/lib/postgresql/data -l logfile start
db_1   | 
db_1   | waiting for server to start....2020-11-02 04:20:16.680 UTC [45] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2020-11-02 04:20:16.707 UTC [46] LOG:  database system was shut down at 2020-11-02 04:20:16 UTC
db_1   | 2020-11-02 04:20:16.712 UTC [45] LOG:  database system is ready to accept connections
db_1   |  done
db_1   | server started
db_1   | CREATE DATABASE
db_1   | 
db_1   | 
db_1   | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db_1   | 
db_1   | 2020-11-02 04:20:17.135 UTC [45] LOG:  received fast shutdown request
db_1   | waiting for server to shut down....2020-11-02 04:20:17.136 UTC [45] LOG:  aborting any active transactions
db_1   | 2020-11-02 04:20:17.144 UTC [45] LOG:  background worker "logical replication launcher" (PID 52) exited with exit code 1
db_1   | 2020-11-02 04:20:17.147 UTC [47] LOG:  shutting down
db_1   | 2020-11-02 04:20:17.157 UTC [45] LOG:  database system is shut down
db_1   |  done
db_1   | server stopped
db_1   | 
db_1   | PostgreSQL init process complete; ready for start up.
db_1   | 
db_1   | 2020-11-02 04:20:17.271 UTC [1] LOG:  listening on IPv4 address "0.0.0.0",port 5432
db_1   | 2020-11-02 04:20:17.272 UTC [1] LOG:  listening on IPv6 address "::",port 5432
db_1   | 2020-11-02 04:20:17.274 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1   | 2020-11-02 04:20:17.292 UTC [63] LOG:  database system was shut down at 2020-11-02 04:20:17 UTC
db_1   | 2020-11-02 04:20:17.299 UTC [1] LOG:  database system is ready to accept connections
DiscuSearchFastAPI | INFO:     Started server process [6]
DiscuSearchFastAPI | INFO:     Waiting for application startup.
DiscuSearchFastAPI | ERROR:    Traceback (most recent call last):
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py",line 526,in lifespan
DiscuSearchFastAPI |     async for item in self.lifespan_context(app):
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py",line 467,in default_lifespan
DiscuSearchFastAPI |     await self.startup()
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/starlette/routing.py",line 502,in startup
DiscuSearchFastAPI |     await handler()
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/tortoise/contrib/fastapi/__init__.py",line 92,in init_orm
DiscuSearchFastAPI |     await Tortoise.init(config=config,config_file=config_file,db_url=db_url,modules=modules)
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/tortoise/__init__.py",line 555,in init
DiscuSearchFastAPI |     await cls._init_connections(connections_config,_create_db)
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/tortoise/__init__.py",line 385,in _init_connections
DiscuSearchFastAPI |     await connection.create_connection(with_db=True)
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/tortoise/backends/asyncpg/client.py",line 94,in create_connection
DiscuSearchFastAPI |     self._pool = await asyncpg.create_pool(None,password=self.password,**self._template)
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/pool.py",line 398,in _async__init__
DiscuSearchFastAPI |     await self._initialize()
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/pool.py",line 426,in _initialize
DiscuSearchFastAPI |     await first_ch.connect()
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/pool.py",line 125,in connect
DiscuSearchFastAPI |     self._con = await self._pool._get_new_connection()
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/pool.py",line 468,in _get_new_connection
DiscuSearchFastAPI |     con = await connection.connect(
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/connection.py",line 1718,in connect
DiscuSearchFastAPI |     return await connect_utils._connect(
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/connect_utils.py",line 674,in _connect
DiscuSearchFastAPI |     raise last_error
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/connect_utils.py",line 663,in _connect
DiscuSearchFastAPI |     con = await _connect_addr(
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/site-packages/asyncpg/connect_utils.py",line 632,in _connect_addr
DiscuSearchFastAPI |     tr,pr = await asyncio.wait_for(
DiscuSearchFastAPI |   File "/usr/local/lib/python3.8/asyncio/tasks.py",line 498,in wait_for
DiscuSearchFastAPI |     raise exceptions.TimeoutError()
DiscuSearchFastAPI | asyncio.exceptions.TimeoutError
DiscuSearchFastAPI | 
DiscuSearchFastAPI | ERROR:    Application startup failed. Exiting.
DiscuSearchFastAPI | INFO:     Started server process [6]
DiscuSearchFastAPI | INFO:     Waiting for application startup.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...