Skip to content
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

gunicorn on native installation #473

Open
lgwapnitsky opened this issue Feb 24, 2024 · 2 comments
Open

gunicorn on native installation #473

lgwapnitsky opened this issue Feb 24, 2024 · 2 comments

Comments

@lgwapnitsky
Copy link

I'm trying to run the command as the other user did, but am still running into the same issue. The reason I'm running on native is that I"ve had some issues running Docker in LXC on Proxmox, and am trying to use minimal disk resources.

Thank you

          1. I used the command of the following type: gunicorn --chdir/Home/XXX/Tubesync/Tubesync/-B 192.168.10.2:8001 WSGI &
  1. Edited in the settings.py file the line ALLOWED_HOSTS by adding its IP address.
  2. Launched the command ./manage.py process_tasks &
    I did not use the reverse proxy. Everything worked on the i386 system. Please close the question.

Originally posted by @HeadMountainRain in #304 (comment)

@lgwapnitsky
Copy link
Author

error output:

(ts-venv) tubesync@tubesync:/opt/tubesync/tubesync/tubesync$ gunicorn --chdir  /opt/tubesync/tubesync/tubesync/ -b 127.0.0.1 wsgi
[2024-02-24 21:20:50 +0000] [10674] [INFO] Starting gunicorn 21.2.0
[2024-02-24 21:20:50 +0000] [10674] [INFO] Listening at: http://127.0.0.1:8000 (10674)
[2024-02-24 21:20:50 +0000] [10674] [INFO] Using worker: sync
[2024-02-24 21:20:50 +0000] [10675] [INFO] Booting worker with pid: 10675
[2024-02-24 21:20:51 +0000] [10675] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/tubesync/tubesync/tubesync/wsgi.py", line 8, in <module>
    _application = get_wsgi_application()
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/tubesync/ts-venv/lib/python3.11/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tubesync'
[2024-02-24 21:20:51 +0000] [10675] [INFO] Worker exiting (pid: 10675)
[2024-02-24 21:20:51 +0000] [10674] [ERROR] Worker (pid:10675) exited with code 3
[2024-02-24 21:20:51 +0000] [10674] [ERROR] Shutting down: Master
[2024-02-24 21:20:51 +0000] [10674] [ERROR] Reason: Worker failed to boot.

@meeb
Copy link
Owner

meeb commented Feb 26, 2024

This is a path issue, the 'tubesync' Django app isn't importable from the path as used by gunicorn.

Just to mention, you're really not going to save any resources here at all by running it manually vs the container. The only thing the container runs in addition to what you're manually running here is nginx (in 'light' mode which uses a few mb of ram) and the very lightweight S6 init system. It really is easier to run in the container. By the time you've built all the dependencies to run tubesync your base install will be larger than the container anyway, Python is pretty sprawling with libraries.

If you persist with attempting to run this manually you'll need to fix the path for gunicorn. Internally tubesync runs this command:

gunicorn -c /path/to/tubesync/gunicorn.py --capture-output tubesync.wsgi:application

With the gunicorn config:

https://github.com/meeb/tubesync/blob/main/tubesync/tubesync/gunicorn.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants