ajnisbet / opentopodata

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

make run errors #77

Closed jayGG83 closed 1 year ago

jayGG83 commented 1 year ago

Hello,

I tried to build/run the project in my aws ec2 server and got this error messages:

docker run --rm -it --volume "/home/jeremiah/mushroom/opentopodata/data:/app/data:ro" -p 5000:5000 opentopodata:`cat VERSION` 
2023-05-09 07:50:29,418 INFO Set uid to user 0 succeeded
2023-05-09 07:50:29,420 INFO supervisord started with pid 1
2023-05-09 07:50:30,423 INFO spawned: 'memcached' with pid 10
2023-05-09 07:50:30,425 INFO spawned: 'nginx' with pid 11
2023-05-09 07:50:30,427 INFO spawned: 'uwsgi' with pid 12
2023-05-09 07:50:30,432 INFO spawned: 'warm_cache' with pid 13
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:30 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
python: can't open file '/app/docker/warm_cache.py': [Errno 13] Permission denied
*** Python threads support is disabled. You can enable it with --enable-threads ***
2023-05-09 07:50:30,487 INFO exited: warm_cache (exit status 2; not expected)
Python main interpreter initialized at 0x563990143740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 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 ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:31,491 INFO success: memcached entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-05-09 07:50:31,491 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-05-09 07:50:31,491 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-05-09 07:50:31,493 INFO spawned: 'warm_cache' with pid 25
2023-05-09 07:50:31,494 INFO exited: uwsgi (exit status 22; not expected)
python: can't open file '/app/docker/warm_cache.py': [Errno 13] Permission denied
2023-05-09 07:50:31,534 INFO spawned: 'uwsgi' with pid 26
2023-05-09 07:50:31,535 INFO exited: warm_cache (exit status 2; not expected)
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:31 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x56238ea6e740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 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 ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:32,583 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-05-09 07:50:32,583 INFO exited: uwsgi (exit status 22; not expected)
2023-05-09 07:50:33,586 INFO spawned: 'uwsgi' with pid 27
2023-05-09 07:50:33,588 INFO spawned: 'warm_cache' with pid 28
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:33 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x559dd6599740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 cores
*** Operational MODE: preforking ***
failed to open python file /app/opentopodata/api.py
python: can't open file '/app/docker/warm_cache.py': [Errno 13] Permission denied
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. GAME OVER ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:33,647 INFO exited: warm_cache (exit status 2; not expected)
2023-05-09 07:50:33,648 INFO exited: uwsgi (exit status 22; not expected)
2023-05-09 07:50:34,650 INFO spawned: 'uwsgi' with pid 29
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:34 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x561a10f25740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 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 ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:34,678 INFO exited: uwsgi (exit status 22; not expected)
2023-05-09 07:50:36,683 INFO spawned: 'uwsgi' with pid 30
2023-05-09 07:50:36,688 INFO spawned: 'warm_cache' with pid 31
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:36 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
python: can't open file '/app/docker/warm_cache.py': [Errno 13] Permission denied
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x562b18aaa740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 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 ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:36,740 INFO exited: uwsgi (exit status 22; not expected)
2023-05-09 07:50:36,740 INFO exited: warm_cache (exit status 2; not expected)
2023-05-09 07:50:37,741 INFO gave up: warm_cache entered FATAL state, too many start retries too quickly
2023-05-09 07:50:39,745 INFO spawned: 'uwsgi' with pid 32
[uWSGI] getting INI configuration from /app/docker/uwsgi.ini
*** Starting uWSGI 2.0.21 (64bit) on [Tue May  9 07:50:39 2023] ***
compiled with version: 10.2.1 20210110 on 08 May 2023 16:41:29
os: Linux-5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023
nodename: 6cde6eb06964
machine: x86_64
clock source: unix
detected number of CPU cores: 2
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.9.16 (main, May  3 2023, 09:54:39)  [GCC 10.2.1 20210110]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x55be9b113740
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 20 seconds
mapped 403029 bytes (393 KB) for 2 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 ***
VACUUM: unix socket /tmp/uwsgi.sock removed.
2023-05-09 07:50:39,798 INFO exited: uwsgi (exit status 22; not expected)
2023-05-09 07:50:39,803 INFO gave up: uwsgi entered FATAL state, too many start retries too quickly

I tried various thing, but none of them worked:

Any ideas? Thanks in advace

ajnisbet commented 1 year ago

Sorry you're dealing with this: docker file permission issues are frustrating! And thanks for the detailed error explanation.

The first thing to try is adding yourself to the docker group:

sudo usermod -aG docker $(whoami)

then logging out & in again for the changes to work.

Otherwise could you share the outputs of these commands to help get to the bottom of things:

jayGG83 commented 1 year ago

Thanks for the reply. Currently my user is already in the docker group. Regarding the commands, here are the results:

-rw-rw---- 1 jeremiah jeremiah 1.1K May  9 09:49 LICENSE.md
-rw-rw---- 1 jeremiah jeremiah 1.6K May  9 09:49 Makefile
-rw-rw---- 1 jeremiah jeremiah 3.6K May  9 09:49 README.md
-rw-rw---- 1 jeremiah jeremiah    5 May  9 09:49 VERSION
drwxrwx--- 2 jeremiah jeremiah 4.0K May  9 09:49 data
drwxrwx--- 2 jeremiah jeremiah 4.0K May  9 10:06 docker
drwxrwx--- 7 jeremiah jeremiah 4.0K May  9 09:49 docs
-rw-rw---- 1 jeremiah jeremiah  757 May  9 09:49 example-config.yaml
-rw-rw---- 1 jeremiah jeremiah 1.6K May  9 09:49 mkdocs.yml
drwxrwx--- 2 jeremiah jeremiah 4.0K May  9 09:49 opentopodata
-rw-rw---- 1 jeremiah jeremiah  138 May  9 09:49 requirements.in
-rw-rw---- 1 jeremiah jeremiah 2.3K May  9 09:49 requirements.txt
drwxrwx--- 3 jeremiah jeremiah 4.0K May  9 09:49 tests
uid=1003(jeremiah) gid=1004(jeremiah) groups=1004(jeremiah),999(docker)
ajnisbet commented 1 year ago

Hmm, there's a couple of things I can think of:

One is that you have -rw-rw---- (660) permissions on the files: because the docker container runs with a different uid you'll probably need -rw-r--r--. You should be able to do this with chmod 644.

You could also try adding --user 1003:1004 to the docker run command.

jayGG83 commented 1 year ago

Thanks. I'll try and let you know. Regards