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

Resolve chicken-vs-egg scenario of initial Heroku deployment vs initial DANDI Infrastructure deployment #195

Open
aaronkanzer opened this issue Nov 5, 2024 · 7 comments

Comments

@aaronkanzer
Copy link
Member

aaronkanzer commented Nov 5, 2024

Girder is the basis for the DANDI Archive API -- https://github.com/dandi/dandi-infrastructure/blob/master/terraform/api.tf#L5-L6.

A chicken vs. egg scenario occurs when using Girder for Heroku deployments of DANDI Archive, as DANDI Archive must be deployed at least once, applying its relevant Procfile to Heroku, as noted here in the Girder docs, prior to Heroku dyno configuration being recognized in corresponding dandi-infrastructure Terraform code.

However, when initially deploying the DANDI Archive, certain environment variables must be set -- in the Django settings file here -- these values are set by the Terraform values set here -- thus, it is impossible to provide a clean, initial terraform apply, causing a chicken vs. egg scenario where DANDI Archive needs to be deployed before dandi-infrastructure, but can't because of missing env vars set via Girder.

This ticket captures this issue -- there are be step-wise mechanisms to get around this (e.g. LINC Archive/infrastructure's prior trial-and-error), albeit potentially messy and confusing to a new user.

Cc @satra @kabilar @yarikoptic @waxlamp

@yarikoptic
Copy link
Member

yarikoptic commented Nov 5, 2024

Yikes, I was not aware of this intricacy. Thank you @aaronkanzer for filing the issue.
For starter -- do we need that Girder for Heroku (source = "girder/girder4/heroku") or could it be some more plain django for Heroku ? I am yet to fully grasp the situation here

@aaronkanzer
Copy link
Member Author

aaronkanzer commented Nov 5, 2024

Yikes, I was not aware of this intricacy. Thank you @aaronkanzer for filing the issue. For starter -- do we need that Girder for Heroku (source = "girder/girder4/heroku") or could it be some more plain django for Heroku ? I am yet to fully grasp the situation here

@yarikoptic

In this case, Girder provisions much of the foundational resources that DANDI Archive relies on -- for starters, see here. We can always take the parts of Girder we like upstream and remove the reference to the module, but that could introduce different complexities.

The core concept to keep in mind here (with Terraform modules in general), is that Terraform is designed to not have modules and resources defined upstream overwritten downstream -- upstream is immutable. Thus, any extension of Terraform is purely extension, not overwriting.

I don't think this is a blocker by any means (we were able to deploy LINC Archive well enough, you could also theoretically switch environ_required=False for all the corresponding settings.py env vars in DANDI Archive); however, it depends on our appetite for following docs / step-wise approach vs. more automation -- food for thought....

@kabilar
Copy link
Member

kabilar commented Nov 5, 2024

Thanks @aaronkanzer. This is good to know. For LINC, what manual steps did you have to take to get around this circular dependency? I may have missed it in dandi/handbook#104.

@aaronkanzer
Copy link
Member Author

Thanks @aaronkanzer. This is good to know. For LINC, what manual steps did you have to take to get around this circular dependency? I may have missed it in dandi/handbook#104.

@kabilar -- definitely going to add handbook docs regarding this -- for LINC, I went into the Heroku app and populated the env vars manually in the Heroku console -- just a quick fix, but another manual step (see screenshot below -- red square is just hiding the env vars)

Image

@kabilar
Copy link
Member

kabilar commented Nov 5, 2024

@kabilar -- definitely going to add handbook docs regarding this -- for LINC, I went into the Heroku app and populated the env vars manually in the Heroku console -- just a quick fix, but another manual step (see screenshot below -- red square is just hiding the env vars)

Thanks. I would suggest that we keep this as a manual step for now. To resolve this circular dependency, I agree that we should update the Girder Readme and DANDI Handbook.

@aaronkanzer
Copy link
Member Author

aaronkanzer commented Nov 5, 2024

Girder Readme

@kabilar this isnt so much a problem with Girder, rather, it is the environ_required=True kwarg passed in the settings.py of DANDI Archive (https://github.com/dandi/dandi-archive/blob/master/dandiapi/settings.py#L88-L112)

If environ_required was set to False, than this chicken vs. egg scenario would be resolved

@kabilar
Copy link
Member

kabilar commented Nov 5, 2024

@kabilar this isnt so much a problem with Girder, rather, it is the environ_required=True kwarg passed in the settings.py of DANDI Archive (https://github.com/dandi/dandi-archive/blob/master/dandiapi/settings.py#L88-L112)

If environ_required was set to False, than this chicken vs. egg scenario would be resolved

Thanks. Is it possible to not hardcode this argument? I am not sure where mutate_configuration gets called.

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

No branches or pull requests

3 participants