pbogre / jetlog

Personal flight tracker and viewer
https://github.com/pbogre/jetlog
GNU General Public License v2.0
199 stars 9 forks source link

Additional Installation Requirements #6

Closed adamzvolanek closed 3 months ago

adamzvolanek commented 3 months ago

Adding some text and comments to the readme.md and docker-compose.yaml file. Namely about the need to populate the /data directory with the items in the https://github.com/pbogre/jetlog/tree/main/data directory.

pbogre commented 3 months ago

Thanks for the PR! However, the files in the data directory from the repo are present in the docker image (see line 43 of Dockerfile), so there's no need to also put them in the actual data directory that is mounted as a volume. You should be able to find these files in the running container at /app/data, if that's not the case, this is a problem I should fix.

adamzvolanek commented 3 months ago

Thanks for the PR! However, the files in the data directory from the repo are present in the docker image (see line 43 of Dockerfile), so there's no need to also put them in the actual data directory that is mounted as a volume. You should be able to find these files in the running container at /app/data, if that's not the case, this is a problem I should fix.

I went ahead and removed the appdata files:

Linux 6.1.99-Unraid.
root@dev-laptop:~# cd /mnt/user/appdata
root@dev-laptop:/mnt/user/appdata# ls
cloud/      core/       docs/    internal/
root@dev-laptop:/mnt/user/appdata# ls internal
jetlog/
root@dev-laptop:/mnt/user/appdata# rm -rf internal/jetlog
root@dev-laptop:/mnt/user/appdata# ls internal

Screenshot_20240726-060706.png

However then fails out there after citing it cannot create the DB file. I can get the logs later because on mobile I cannot copy them fast enough.

Decided to spin up desktop. After the last line of the error, the container stops.

error log ```bash File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 467, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/app/server/main.py", line 1, in from server.routers import flights, airports, statistics, geography File "/app/server/routers/flights.py", line 1, in from server.database import database File "/app/server/database.py", line 89, in database = Database(DATA_PATH) ^^^^^^^^^^^^^^^^^^^ self.connection = sqlite3.connect(db_path) File "/app/server/database.py", line 49, in __init__ ^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: unable to open database file Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/local/lib/python3.11/site-packages/uvicorn/__main__.py", line 4, in uvicorn.main() Database file not found, creating it... File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 416, in main run( File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 587, in run server.run() File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 61, in run return asyncio.run(self.serve(sockets=sockets)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 68, in serve config.load() File "/usr/local/lib/python3.11/site-packages/uvicorn/config.py", line 467, in load self.loaded_app = import_from_string(self.app) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/uvicorn/importer.py", line 21, in import_from_string module = importlib.import_module(module_str) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/app/server/main.py", line 1, in from server.routers import flights, airports, statistics, geography File "/app/server/routers/flights.py", line 1, in from server.database import database File "/app/server/database.py", line 89, in database = Database(DATA_PATH) ^^^^^^^^^^^^^^^^^^^ File "/app/server/database.py", line 49, in __init__ self.connection = sqlite3.connect(db_path) ^^^^^^^^^^^^^^^^^^^^^^^^ sqlite3.OperationalError: unable to open database file Database file not found, creating it... ```
pbogre commented 3 months ago

Yeah unfortunately this is due to an ownership error in the volume your provided. Have a look at #5 for more details

adepssimius commented 3 months ago

I am having issues with this as well. Trying to run this as a non-root user security context in kubernetes fails with the default command since gosu needs to be run as root. I don't like to allow containers to run with the root user if they don't need to.

If I set the security context user as nonroot, then gosu fails. If I set the security context user as root so gosu will work (again not my favorite), then the volume owner is set to root and I can't get the DB to create. I don't have other options that I know of.

pbogre commented 3 months ago

I see that you opened and closed an issue about this problem (#30). Does this mean it's no longer a problem, or should I still look into this?

If the container cannot start as non-root, I see that as a problem. I'll open an issue about that so we can move this discussion there.