winiar93 / FastEstate

scraper of otodom.pl
MIT License
3 stars 1 forks source link

Can't run fastapi #2

Closed Potracheno closed 1 year ago

Potracheno commented 1 year ago

docker-compose up

Starting postgres ... done Starting mssql ... done Starting pgadmin ... done Starting fastapi ... done Attaching to postgres, mssql, pgadmin, fastapi mssql | SQL Server 2019 will run as non-root by default. mssql | This container is running as user mssql. mssql | To learn more visit https://go.microsoft.com/fwlink/?linkid=2099216. mssql | Waiting for MS SQL to be available ⏳ pgadmin | postfix/postlog: starting the Postfix mail system postgres | postgres | PostgreSQL Database directory appears to contain a database; Skipping initialization postgres | postgres | 2023-07-25 14:22:38.084 UTC [1] LOG: starting PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit postgres | 2023-07-25 14:22:38.084 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 postgres | 2023-07-25 14:22:38.084 UTC [1] LOG: listening on IPv6 address "::", port 5432 postgres | 2023-07-25 14:22:38.097 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" postgres | 2023-07-25 14:22:38.109 UTC [29] LOG: database system was shut down at 2023-07-25 14:22:21 UTC postgres | 2023-07-25 14:22:38.118 UTC [1] LOG: database system is ready to accept connections fastapi | Traceback (most recent call last): fastapi | File "/usr/local/bin/uvicorn", line 8, in fastapi | sys.exit(main()) fastapi | File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1157, in call fastapi | return self.main(args, kwargs) fastapi | File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1078, in main fastapi | rv = self.invoke(ctx) fastapi | File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1434, in invoke fastapi | return ctx.invoke(self.callback, ctx.params) fastapi | File "/usr/local/lib/python3.8/site-packages/click/core.py", line 783, in invoke fastapi | return __callback(args, **kwargs) fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 416, in main fastapi | run( fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/main.py", line 587, in run fastapi | server.run() fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 61, in run fastapi | return asyncio.run(self.serve(sockets=sockets)) fastapi | File "/usr/local/lib/python3.8/asyncio/runners.py", line 43, in run fastapi | return loop.run_until_complete(main) fastapi | File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete fastapi | return future.result() fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 68, in serve fastapi | config.load() fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 467, in load fastapi | self.loaded_app = import_from_string(self.app) fastapi | File "/usr/local/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string fastapi | module = importlib.import_module(module_str) fastapi | File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module fastapi | return _bootstrap._gcd_import(name[level:], package, level) fastapi | File "", line 1014, in _gcd_import fastapi | File "", line 991, in _find_and_load fastapi | File "", line 975, in _find_and_load_unlocked fastapi | File "", line 671, in _load_unlocked fastapi | File "", line 783, in exec_module fastapi | File "", line 219, in _call_with_frames_removed fastapi | File "/main.py", line 5, in fastapi | from sql_models import FlatOffers fastapi | File "/sql_models.py", line 7, in fastapi | from sqlmodel import Column, Field, SQLModel fastapi | File "/usr/local/lib/python3.8/site-packages/sqlmodel/init.py", line 137, in fastapi | from .main import SQLModel as SQLModel fastapi | File "/usr/local/lib/python3.8/site-packages/sqlmodel/main.py", line 27, in fastapi | from pydantic.errors import ConfigError, DictError fastapi | File "/usr/local/lib/python3.8/site-packages/pydantic/_migration.py", line 294, in wrapper fastapi | raise PydanticImportError(f'{import_path} has been removed in V2.') fastapi | pydantic.errors.PydanticImportError: pydantic.errors:ConfigError has been removed in V2. fastapi | fastapi | For further information visit https://errors.pydantic.dev/2.0.3/u/import-error fastapi exited with code 1 mssql | 2023-07-25 14:22:39.58 Server Setup step is copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf'. 2023-07-25 14:22:39.61 Server ERROR: Setup FAILED copying system data file 'C:\templatedata\master.mdf' to '/var/opt/mssql/data/master.mdf': 5(Access is denied.) ERROR: BootstrapSystemDataDirectories() failure (HRESULT 0x80070005) pgadmin | [2023-07-25 14:22:41 +0000] [1] [INFO] Starting gunicorn 20.1.0 pgadmin | [2023-07-25 14:22:41 +0000] [1] [INFO] Listening at: http://[::]:80 (1) pgadmin | [2023-07-25 14:22:41 +0000] [1] [INFO] Using worker: gthread pgadmin | [2023-07-25 14:22:41 +0000] [81] [INFO] Booting worker with pid: 81

PS I guess better add versions to requirements.txt

winiar93 commented 1 year ago

Hello, thank You for participation 👍 Tried to run docker-compose up after removing whole images and volumes, there was no problem on my side. To provide more details, I am using docker dosktop v.4.17.0 under windows 11. Additionally, ran it on macos Ventura without any problem.

As You mentioned, in last commits I added versions to requirements.txt and also depends_on mssql under web service.

Moreover we can read here '/var/opt/mssql/data/master.mdf': 5(Access is denied.) I found similar issue here -> https://stackoverflow.com/questions/65601077/unable-to-run-sql-server-2019-docker-with-volumes-and-get-error-setup-failed-co

Let me know if that helped.

This is how it looks on my side. image

winiar93 commented 1 year ago

PS also You can remove part with mssql, it's not required to start app. Basically postgres and fastapi containers are core of it.

Potracheno commented 1 year ago

I run it under Linux. I did pull request #3