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

[PULP-205] Allow multiple bind addresses on entrypoints #6063

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES/6053.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allowed to bind api and content workers to multiple addresses.
You can specify `--bind` multiple times on the `pulpcore-{api,content}` entrypoints.
5 changes: 3 additions & 2 deletions pulpcore/app/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def load(self):
# https://github.com/benoitc/gunicorn/blob/master/gunicorn/config.py


@click.option("--bind", "-b", default="[::]:24817")
@click.option("--bind", "-b", default=["[::]:24817"], multiple=True)
@click.option("--workers", "-w", type=int)
# @click.option("--threads", "-w", type=int) # We don't use a threaded worker...
@click.option("--name", "-n", "proc_name")
Expand Down Expand Up @@ -136,5 +136,6 @@ def load(self):
@click.option("--user", "-u")
@click.option("--group", "-g")
@click.command()
def main(**options):
def main(bind, **options):
options["bind"] = list(bind)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is bind not automatically turned into a list with multiple=True and the default being a list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, sadly we get a tuple and gunicorn doesn't like that.

PulpcoreApiApplication(options).run()
5 changes: 3 additions & 2 deletions pulpcore/content/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def load(self):
return pulpcore.content.server


@click.option("--bind", "-b", default="[::]:24816")
@click.option("--bind", "-b", default=["[::]:24816"], multiple=True)
@click.option("--workers", "-w", type=int)
# @click.option("--threads", "-w", type=int) # We don't use a threaded worker...
@click.option("--name", "-n", "proc_name")
Expand All @@ -40,5 +40,6 @@ def load(self):
@click.option("--user", "-u")
@click.option("--group", "-g")
@click.command()
def main(**options):
def main(bind, **options):
options["bind"] = list(bind)
PulpcoreContentApplication(options).run()