ajnisbet / opentopodata

Open alternative to the Google Elevation API!
https://www.opentopodata.org
MIT License
312 stars 69 forks source link

failed to open python file /app/opentopodata/api.py #96

Closed jsgonsette closed 2 months ago

jsgonsette commented 3 months ago

I followed the documentation to run the server in local, but the server cannot start, both on Windows and Linux. My command:

docker run --rm -it --volume "/mnt/e/Maps/SRTM:/app/data:ro" -p 5000:5000 -e N_UWSGI_THREADS=8 opentopodata sh -c "/usr/bin/supervisord -c /app/docker/supervisord.conf"

The logs I obtained:

2024-05-13 08:31:46,507 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-13 08:31:46,507 WARN exited: uwsgi (exit status 22; not expected)
2024-05-13 08:31:47,510 INFO spawned: 'uwsgi' with pid 465
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.24 (64bit) on [Mon May 13 08:31:47 2024] ***
compiled with version: 12.2.0 on 13 May 2024 07:34:48
os: Linux-5.15.146.1-microsoft-standard-WSL2 #1 SMP Thu Jan 11 04:09:03 UTC 2024
nodename: 455649784e99
machine: x86_64
clock source: unix
detected number of CPU cores: 24
current working directory: /app
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 3
setgid() to 33
setuid() to 33
Python version: 3.11.8 (main, Mar 12 2024, 11:52:02) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7f83bc3d7218
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 1209087 bytes (1180 KB) for 8 cores
*** Operational MODE: preforking ***
failed to open python file /app/opentopodata/api.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. GAME OVER ***

Obviously the application complains about failed to open python file /app/opentopodata/api.py Any idea what I did wrong ?

ajnisbet commented 3 months ago

Hmm, this could be a file permission issue.

If you run ls -lh opentopodata/api.py on the host machine you should get something like -rw-r--r--.

And if that looks ok, could you try the same command inside the docker container with something like

docker run --rm -it opentopodata  ls -lh /app/opentopodata/api.py
jsgonsette commented 3 months ago

I tried those commands and I found out that the docker was obviously corrupted somehow. I restarted everything from scratch and now it works. Thanks

ajnisbet commented 2 months ago

Thanks for following up! This is helpful for people with the same problem in the future!