Skip to content

Paste to gunicorn#440

Open
mvdbeek wants to merge 4 commits intogalaxyproject:masterfrom
mvdbeek:paste_to_gunicorn
Open

Paste to gunicorn#440
mvdbeek wants to merge 4 commits intogalaxyproject:masterfrom
mvdbeek:paste_to_gunicorn

Conversation

@mvdbeek
Copy link
Member

@mvdbeek mvdbeek commented Feb 27, 2026

PasteScript depends on pkg_resources (from setuptools), which is no longer bundled in modern Python, causing ModuleNotFoundError when running paster serve. Replace with gunicorn, a well-maintained WSGI server that supports the same features (HTTP serving, SSL, daemon mode).

  • Add pulsar/scripts/serve.py: gunicorn-based launcher with --daemon, --stop-daemon, --pid, and SSL support
  • Add pulsar-serve console_scripts entry point
  • Change web extra from Paste/PasteScript to gunicorn
  • Remove PasteDeploy from requirements.txt and Dockerfile
  • Update scripts/pulsar to default to gunicorn mode (with paster backward compat that prints deprecation warning)
  • Update scripts/pulsar.bat and run.bat to use pulsar-serve
  • Update pulsar-config template and defaults
  • Remove Paste directives from server.ini.sample and config/server.ini
  • Update documentation and install tests

PasteScript depends on pkg_resources (from setuptools), which is no
longer bundled in modern Python, causing ModuleNotFoundError when
running paster serve. Replace with gunicorn, a well-maintained WSGI
server that supports the same features (HTTP serving, SSL, daemon mode).

- Add pulsar/scripts/serve.py: gunicorn-based launcher with --daemon,
  --stop-daemon, --pid, and SSL support
- Add pulsar-serve console_scripts entry point
- Change web extra from Paste/PasteScript to gunicorn
- Remove PasteDeploy from requirements.txt and Dockerfile
- Update scripts/pulsar to default to gunicorn mode (with paster
  backward compat that prints deprecation warning)
- Update scripts/pulsar.bat and run.bat to use pulsar-serve
- Update pulsar-config template and defaults
- Remove Paste directives from server.ini.sample and config/server.ini
- Update documentation and install tests
Drop _generate_ssl_cert and the ssl_pem=* magic value. This was a
Paste-era convenience that added a pyOpenSSL dependency for little
benefit — users can generate their own certificates.
gunicorn's BaseApplication does not implement daemon mode (only the
Application subclass does), so setting daemon=True was silently
ignored and run() blocked forever.

Fix by implementing a standard double-fork daemonize before starting
gunicorn in foreground mode. Also increase worker timeout to 300s
for slow app initialization, and set OBJC_DISABLE_INITIALIZE_FORK_SAFETY
at module level for macOS compatibility.
Pulsar sends job parameters (command_line, dependencies_description,
etc.) as long query strings that exceed gunicorn's default 8190-byte
limit_request_line, causing 400 Bad Request errors. Set both
limit_request_line and limit_request_field_size to 0 (unlimited)
to match the old Paste server behavior.
@mvdbeek
Copy link
Member Author

mvdbeek commented Feb 27, 2026

Yay, green!

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

Successfully merging this pull request may close these issues.

2 participants