Closed blenzi closed 2 months ago
Hey there :)
Thanks for reporting this! So I can see two topics here:
Let me know if there are still some dark areas :)
Thanks for the reply @frgfm .
(pyro-api) blenzi@dphpmcc213:pyro-api$ docker compose ps
WARN[0000] The "QARNOT_TOKEN" variable is not set. Defaulting to a blank string.
WARN[0000] The "BUCKET_NAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "BUCKET_MEDIA_FOLDER" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_ENDPOINT_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_ACCESS_KEY" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_SECRET_KEY" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_REGION" variable is not set. Defaulting to a blank string.
WARN[0000] The "SENTRY_DSN" variable is not set. Defaulting to a blank string.
WARN[0000] The "SENTRY_SERVER_NAME" variable is not set. Defaulting to a blank string.
NAME COMMAND SERVICE STATUS PORTS
pyro-api_backend_1 "uvicorn app.main:ap…" backend running 0.0.0.0:8080->8080/tcp
pyro-api_db_1 "docker-entrypoint.s…" db running 0.0.0.0:5432->5432/tcp
pyro-api_proxy_1 "/docker-entrypoint.…" proxy running 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp
(pyro-api) blenzi@dphpmcc213:pyro-api$ docker compose logs --follow
WARN[0000] The "QARNOT_TOKEN" variable is not set. Defaulting to a blank string.
WARN[0000] The "BUCKET_NAME" variable is not set. Defaulting to a blank string.
WARN[0000] The "BUCKET_MEDIA_FOLDER" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_ENDPOINT_URL" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_ACCESS_KEY" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_SECRET_KEY" variable is not set. Defaulting to a blank string.
WARN[0000] The "S3_REGION" variable is not set. Defaulting to a blank string.
WARN[0000] The "SENTRY_DSN" variable is not set. Defaulting to a blank string.
WARN[0000] The "SENTRY_SERVER_NAME" variable is not set. Defaulting to a blank string.
backend_1 | INFO: Will watch for changes in these directories: ['/app']
backend_1 | INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
backend_1 | INFO: Started reloader process [1] using WatchGod
backend_1 | Process SpawnProcess-1:
backend_1 | Traceback (most recent call last):
backend_1 | File "/usr/local/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
backend_1 | self.run()
backend_1 | File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
backend_1 | self._target(*self._args, **self._kwargs)
backend_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
backend_1 | target(sockets=sockets)
backend_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 60, in run
backend_1 | return asyncio.run(self.serve(sockets=sockets))
backend_1 | File "/usr/local/lib/python3.8/asyncio/runners.py", line 43, in run
backend_1 | return loop.run_until_complete(main)
backend_1 | File "uvloop/loop.pyx", line 1501, in uvloop.loop.Loop.run_until_complete
backend_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/server.py", line 67, in serve
backend_1 | config.load()
backend_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/config.py", line 479, in load
backend_1 | self.loaded_app = import_from_string(self.app)
backend_1 | File "/usr/local/lib/python3.8/site-packages/uvicorn/importer.py", line 21, in import_from_string
backend_1 | module = importlib.import_module(module_str)
backend_1 | File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
backend_1 | return _bootstrap._gcd_import(name[level:], package, level)
backend_1 | File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
backend_1 | File "<frozen importlib._bootstrap>", line 991, in _find_and_load
backend_1 | File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
backend_1 | File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
backend_1 | File "<frozen importlib._bootstrap_external>", line 783, in exec_module
backend_1 | File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
backend_1 | File "./app/main.py", line 15, in <module>
backend_1 | from app.api.routes import (
backend_1 | File "./app/api/routes/media.py", line 21, in <module>
backend_1 | from app.services import bucket_service, resolve_bucket_key
backend_1 | File "./app/services/__init__.py", line 1, in <module>
backend_1 | from .services import *
backend_1 | File "./app/services/services.py", line 11, in <module>
backend_1 | bucket_service = QarnotBucket()
backend_1 | File "./app/services/bucket/s3.py", line 28, in __init__
backend_1 | self._connect_to_storage()
backend_1 | File "./app/services/bucket/qarnot.py", line 25, in _connect_to_storage
backend_1 | self._s3 = Connection(client_token=cfg.QARNOT_TOKEN)._s3client
backend_1 | File "/usr/local/lib/python3.8/site-packages/qarnot/connection.py", line 188, in __init__
backend_1 | user = self.user_info
backend_1 | File "/usr/local/lib/python3.8/site-packages/qarnot/connection.py", line 329, in user_info
backend_1 | resp = self._get(get_url('user'))
backend_1 | File "/usr/local/lib/python3.8/site-packages/qarnot/_retry.py", line 29, in _with_retry
backend_1 | raise UnauthorizedException()
backend_1 | qarnot.exceptions.UnauthorizedException
db_1 |
proxy_1 | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
proxy_1 | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
proxy_1 | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
proxy_1 | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
proxy_1 | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
proxy_1 | /docker-entrypoint.sh: Configuration complete; ready for start up
db_1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
db_1 |
db_1 | 2022-11-09 22:47:46.049 UTC [1] LOG: starting PostgreSQL 12.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit
db_1 | 2022-11-09 22:47:46.049 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
db_1 | 2022-11-09 22:47:46.049 UTC [1] LOG: listening on IPv6 address "::", port 5432
db_1 | 2022-11-09 22:47:46.051 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
db_1 | 2022-11-09 22:47:46.068 UTC [21] LOG: database system was shut down at 2022-11-08 22:51:55 UTC
db_1 | 2022-11-09 22:47:46.072 UTC [1] LOG: database system is ready to accept connections
Oh if that's about the order of sections in the README, that could be an improvement. The thing is that quick tour should provide a quick overlook, and subtle setup/tricks come later (such as the setup of storage connection).
So are we talking about a documentation problem? or an actual codebase bug?
If that works for you, it is probably only a documentation problem, although I cannot test it :)
What do you mean?
My point is that:
So, what do you mean by "I cannot test it"? With the .env
set, you can't run the service? :thinking: (it's also a major issue considering the CI is doing it at every PR, so if a user cannot, there is a misalignment between the CI & the actual behaviour)
I created an account in Qarnot and now I can run it and see the API doc. The next step would be to know how to authenticate and use the API.
So yes, it is a documentation issue, and it would be nice to guide the developers, either inverting the sections or adding a link to anticipate how the configuration works. Plus explicitly saying what is needed (accounts, ...) and how to run.
Closing this since this has been solved :)
As noted in #231, the README suggests that cloning the package and calling
make run
should start the API but:The test performed in the CI also succeeds locally:
but unless I missed it, that is no check of the content with
curl
or similar. The output ofmake run
is below and looks similar to that of the CI (ex.: step 3 of https://github.com/pyronear/pyro-api/actions/runs/3348292566/jobs/5547200913). @frgfm, could it be that you have those variables set locally so you have access to QARNOT ?