-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on Docker Boot #38
Comments
Long story short, it boils down to incorrect permissions on the volume where the sqlite database file is stored.
but that is likely throwing errors because ro is valid and rw is valid, but I don't think rwx is valid A way to work around this is to set the db folder to have the correct permissions. There are many ways to accomplish this, but the following command should work best and be least amount of changed permissions.
Everything should boot up at this point. More discussion here: There's a PR waiting that addresses this: |
@tigunia-martin thanks for the fix, I think it's easier to change permissions on the folder: Works for me and should for others too. This can be done through entrypoint.sh as well, as extra one command line. |
|
Error from log container:
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 153, in execute_script
async with self.acquire_connection() as connection:
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/client.py", line 220, in aenter
await self.ensure_connection()
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/client.py", line 216, in ensure_connection
await self.client.create_connection(with_db=True)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 69, in create_connection
await self._connection._connect()
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 137, in _connect
self.connection = await future
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 102, in run
result = function()
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 397, in connector
return sqlite3.connect(loc, **kwargs)
sqlite3.OperationalError: unable to open database file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 645, in lifespan
async with self.lifespan_context(app):
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 540, in aenter
await self.router.startup()
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 622, in startup
await handler()
File "/app/main.py", line 41, in startup_event
await initialize_app(app)
File "/app/app_setup.py", line 10, in initialize_app
await setup_database()
File "/app/app_setup.py", line 29, in setup_database
await Tortoise.generate_schemas()
File "/app/venv/lib/python3.9/site-packages/tortoise/init.py", line 636, in generate_schemas
await generate_schema_for_client(connection, safe)
File "/app/venv/lib/python3.9/site-packages/tortoise/utils.py", line 31, in generate_schema_for_client
await generator.generate_from_string(schema)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/schema_generator.py", line 448, in generate_from_string
await self.client.execute_script(creation_string)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 36, in translate_exceptions
raise OperationalError(exc)
tortoise.exceptions.OperationalError: unable to open database file
[2023-05-17 18:21:24 +0000] [7] [ERROR] Application startup failed. Exiting.
[2023-05-17 18:21:24 +0000] [7] [INFO] Worker exiting (pid: 7)
[2023-05-17 18:21:24 +0000] [1] [INFO] Shutting down: Master
[2023-05-17 18:21:24 +0000] [1] [INFO] Reason: Worker failed to boot.
[2023-05-17 18:21:31 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2023-05-17 18:21:31 +0000] [1] [INFO] Listening at: http://0.0.0.0:8000 (1)
[2023-05-17 18:21:31 +0000] [1] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2023-05-17 18:21:31 +0000] [7] [INFO] Booting worker with pid: 7
[2023-05-17 18:21:31 +0000] [7] [INFO] Started server process [7]
[2023-05-17 18:21:31 +0000] [7] [INFO] Waiting for application startup.
[2023-05-17 18:21:32 +0000] [7] [ERROR] Traceback (most recent call last):
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 34, in translate_exceptions
return await func(self, query, *args)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 153, in execute_script
async with self.acquire_connection() as connection:
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/client.py", line 220, in aenter
await self.ensure_connection()
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/client.py", line 216, in ensure_connection
await self.client.create_connection(with_db=True)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 69, in create_connection
await self._connection._connect()
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 137, in _connect
self._connection = await future
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 102, in run
result = function()
File "/app/venv/lib/python3.9/site-packages/aiosqlite/core.py", line 397, in connector
return sqlite3.connect(loc, **kwargs)
sqlite3.OperationalError: unable to open database file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 645, in lifespan
async with self.lifespan_context(app):
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 540, in aenter
await self.router.startup()
File "/app/venv/lib/python3.9/site-packages/starlette/routing.py", line 622, in startup
await handler()
File "/app/main.py", line 41, in startup_event
await initialize_app(app)
File "/app/app_setup.py", line 10, in initialize_app
await setup_database()
File "/app/app_setup.py", line 29, in setup_database
await Tortoise.generate_schemas()
File "/app/venv/lib/python3.9/site-packages/tortoise/init.py", line 636, in generate_schemas
await generate_schema_for_client(connection, safe)
File "/app/venv/lib/python3.9/site-packages/tortoise/utils.py", line 31, in generate_schema_for_client
await generator.generate_from_string(schema)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/base/schema_generator.py", line 448, in generate_from_string
await self.client.execute_script(creation_string)
File "/app/venv/lib/python3.9/site-packages/tortoise/backends/sqlite/client.py", line 36, in translate_exceptions
raise OperationalError(exc)
tortoise.exceptions.OperationalError: unable to open database file
[2023-05-17 18:21:32 +0000] [7] [ERROR] Application startup failed. Exiting.
[2023-05-17 18:21:32 +0000] [7] [INFO] Worker exiting (pid: 7)
[2023-05-17 18:21:32 +0000] [1] [INFO] Shutting down: Master
[2023-05-17 18:21:32 +0000] [1] [INFO] Reason: Worker failed to boot.
My Docker Compose is:
The text was updated successfully, but these errors were encountered: