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

New feature to allow the program environment to be loaded from an ext… #1431

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

wynnw
Copy link

@wynnw wynnw commented Apr 30, 2021

…ernal file or program.

  • This allows supervisord to be used in conjunction with any secrets
    pattern using a root-only file or a program that can provide environment
    variables that a program should have. It can be set globally in the
    supervisord section, or per program in a program section. The new
    options are environment_file or environment_loader. They are optional,
    and errors in one of them will prevent startup. They can be set in the
    [supervisord] section and then will be passed down to the programs, or
    in the program definitions. The file/loader is checked right before the
    calls to spawn() in order to avoid problems with calling a subprocess
    after the child fork, and to allow restarts to reload those environment
    values.
  • Updated the docs for these new options
  • Updated the tests to add a new test to check these new options.

From researching the history of things similar to this feature, I'm pretty sure the supervisor team will reject this and doesn't want it. But, it's a critical feature I need to move forward with supervisor. I've been a happy user for years now, but in needing to modernize some old stacks I need functionality like this. Lots of others agree, so hopefully this will be useful to them as well. I'll be running this fork for the foreseeable future and others are welcome to grab it and use it. Supervisor is pretty much feature complete for me so I'll only update it as necessary. The changes are pretty simple and easy to maintain, so hopefully this will be accepted. I did figure out how to add tests and run them with tox and they are all passing on both python 2.7 and 3.8.

…ernal file or program.

- This allows supervisord to be used in conjunction with any secrets
pattern using a root-only file or a program that can provide environment
variables that a program should have. It can be set globally in the
supervisord section, or per program in a program section. The new
options are environment_file or environment_loader. They are optional,
and errors in one of them will prevent startup. They can be set in the
[supervisord] section and then will be passed down to the programs, or
in the program definitions. The file/loader is checked right before the
calls to spawn() in order to avoid problems with calling a subprocess
after the child fork, and to allow restarts to reload those environment
values.
- Updated the docs for these new options
- Updated the tests to add a new test to check these new options.
@wynnw wynnw force-pushed the feature/4.2.2-environment-file branch from 22c7919 to f204ba1 Compare April 30, 2021 20:26
@wynnw wynnw force-pushed the feature/4.2.2-environment-file branch from f204ba1 to 8f1675a Compare April 30, 2021 21:00
supervisor/options.py Outdated Show resolved Hide resolved
- Remove the blocking call to subprocess.check_output in the main
supervisord process. Instead make that call in the child process
immediately after the initial fork, before doing any changes to the
process config and state. This keeps the blocking call out of the danger
zone, while still keeping the simple design.
@wynnw wynnw force-pushed the feature/4.2.2-environment-file branch from 63bed00 to a95213f Compare April 30, 2021 22:08
@wynnw wynnw requested a review from mnaberez April 30, 2021 22:16
@wynnw
Copy link
Author

wynnw commented Jul 9, 2021

This has been sitting around for a while - I believe I've implemented all the changes you required. Is there anything else you'd like to see with this?

@mnaberez
Copy link
Member

This has been sitting around for a while - I believe I've implemented all the changes you required. Is there anything else you'd like to see with this?

Hi, there has not been a lot of activity in this repository lately at all. The comments above were things that jumped out at me after a very brief look at the code. This PR is still pending review and consideration, and there are others ahead of it. I have a few others that I need to look at first, but there are other committers in this repository who could also look.

@mnaberez mnaberez requested review from mnaberez and removed request for mnaberez July 10, 2021 19:45
@mnaberez mnaberez dismissed their stale review July 10, 2021 19:47

Removing myself so others may review as well

@wynnw
Copy link
Author

wynnw commented Oct 5, 2021

I'm still eager to see this merged and released in a 4.2.3 supervisord release. If this project is dying, I understand - no one has much time for projects like this. If there are other changes that need to be made, I'm happy to do them. I'll keep running my fork for now.

…patibility

- Handle env files formatted like dotenv files where values can be
  quoted. We'll unquote those, preserving embedded whitespace, and also
  expand newline literals into actual newlines for double quoted
  strings. This allows supervisors to reuse the dotenv files created
  nodejs projects.
- Handle env files with empty and malformed lines. Just skip those and
  ignore them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants