-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support Injecting Secrets into Apps Running in the Cloud #14612
Conversation
3fcff82
to
e51a6cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's finally coming <3
f34bd5f
to
b2c75eb
Compare
This needs documentation @Felonious-Spellfire |
eafc08b
to
d1dcf86
Compare
61c91db
to
5d286d0
Compare
8751291
to
f9529e5
Compare
4a6c0c2
to
abfd373
Compare
abfd373
to
b3d0cab
Compare
e1acedd
to
e807d20
Compare
@hhsecond The |
e807d20
to
d7829ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds a new '--secret' flag to 'lightning run app': lightning run app --cloud --secret MY_SECRET=my-secret-name app.py When the Lightning App runs in the cloud, the 'MY_SECRET' environment variable will be populated with the value of the referenced Secret. The value of the Secret is encrypted in the database, and will only be decrypted and accessible to the Flow/Work processes in the cloud.
d7829ce
to
60f4013
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encrypted Secrets | ||
################# | ||
|
||
We understand that many Apps require access to private data like API keys, access tokens, database passwords, or other credentials. And that you need to protect this data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove "We understand", just say "Many apps require access..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my PR. The structure was completely changed
|
||
We understand that many Apps require access to private data like API keys, access tokens, database passwords, or other credentials. And that you need to protect this data. | ||
|
||
Secrets provie a secure way to make private data like API keys or passwords accessible to your app, without hardcoding. You can use secrets to authenticate third-party services/solutions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my PR. The structure was completely changed and this typo came across when it was.
******************* | ||
Overview of Secrets | ||
******************* | ||
|
||
The ``--secret`` option has been added to the **lightning run app** command. ``--secret`` can be used by itself or alongside ``--env``. | ||
|
||
When a Lightning App (App) **runs in the cloud**, the Secret can be exposed to the App using environment variables. | ||
The value of the Secret is encrypted in the Lightning.ai database, and is only decrypted and accessible to | ||
LightningFlow (Flow) or LightningWork (Work) processes in the cloud (when you use the ``--cloud`` option running your App). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review my PR. The structure was completely changed
---- | ||
|
||
********************* | ||
Use Encrypted Secrets |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is specific to lightning cloud, we should say "Add secrets to Lightning Cloud"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna disagree on this. It's called out that this is only available in the cloud in several places. What we want to point out is how they should be using the feature correctly.
Use Encrypted Secrets | ||
********************* | ||
|
||
First, a Secret must be created using the admin web UI. Once you create a Secret, you can bind it to any of your Apps. You do not need to create a new Secret for each App if the Secret value is the same. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 1- Log into lighning.ai to add your secrets.
Avatar > Profile > secrets > add a secret
Add a screenshot/gif of how to do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
First, a Secret must be created using the admin web UI. Once you create a Secret, you can bind it to any of your Apps. You do not need to create a new Secret for each App if the Secret value is the same. | ||
|
||
.. note:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 2- Add a secret
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
In the example below, we already used the admin UI to create a Secret named ``my-secret`` with the value ``some-value``` and will bind it to the environment variable ``MY_APP_SECRET`` within our App. The binding is accomplished by using the ``--secret`` option when running the App from the Lightning CLI. | ||
|
||
The ``--secret``` option works similar to ``--env``, but instead of providing a value, you provide the name of the Secret which will be replaced with with the value that you want to bind to the environment variable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 3- Add env variable to your app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
The ``--secret``` option works similar to ``--env``, but instead of providing a value, you provide the name of the Secret which will be replaced with with the value that you want to bind to the environment variable: | ||
|
||
.. code:: bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Step 4- add the secret to the lighnging app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nohalon |
Adds a new '--secret' flag to 'lightning run app': lightning run app --cloud --secret MY_SECRET=my-secret-name app.py When the Lightning App runs in the cloud, the 'MY_SECRET' environment variable will be populated with the value of the referenced Secret. The value of the Secret is encrypted in the database, and will only be decrypted and accessible to the Flow/Work processes in the cloud. Co-authored-by: Sherin Thomas <[email protected]> Co-authored-by: Noha Alon <[email protected]> Co-authored-by: thomas chaton <[email protected]> (cherry picked from commit 71719b9)
Adds a new '--secret' flag to 'lightning run app': lightning run app --cloud --secret MY_SECRET=my-secret-name app.py When the Lightning App runs in the cloud, the 'MY_SECRET' environment variable will be populated with the value of the referenced Secret. The value of the Secret is encrypted in the database, and will only be decrypted and accessible to the Flow/Work processes in the cloud. Co-authored-by: Sherin Thomas <[email protected]> Co-authored-by: Noha Alon <[email protected]> Co-authored-by: thomas chaton <[email protected]> (cherry picked from commit 71719b9)
* Support Injecting Secrets into Apps Running in the Cloud (#14612) Adds a new '--secret' flag to 'lightning run app': lightning run app --cloud --secret MY_SECRET=my-secret-name app.py When the Lightning App runs in the cloud, the 'MY_SECRET' environment variable will be populated with the value of the referenced Secret. The value of the Secret is encrypted in the database, and will only be decrypted and accessible to the Flow/Work processes in the cloud. Co-authored-by: Sherin Thomas <[email protected]> Co-authored-by: Noha Alon <[email protected]> Co-authored-by: thomas chaton <[email protected]> (cherry picked from commit 71719b9) * secrets docs (#14951) * secrets docs * Update docs/source-app/glossary/secrets.rst Co-authored-by: Yurij Mikhalevich <[email protected]> * Apply suggestions from code review Co-authored-by: Adrian Wälchli <[email protected]> * Update secrets.rst * links Co-authored-by: Yurij Mikhalevich <[email protected]> Co-authored-by: Jirka Borovec <[email protected]> Co-authored-by: Adrian Wälchli <[email protected]> Co-authored-by: Jirka <[email protected]> (cherry picked from commit 8715cd0) # Conflicts: # docs/source-app/glossary/secrets.rst * Add support for command descriptions (#15193) (cherry picked from commit 4acb10f) * docs: temp drop S3 from index (#15099) Co-authored-by: awaelchli <[email protected]> (cherry picked from commit 05d91c8) * version 0.7.0 * chlog join 0.6.3 & 0.7 Co-authored-by: Alec Merdler <[email protected]> Co-authored-by: edenlightning <[email protected]> Co-authored-by: Ethan Harris <[email protected]>
What does this PR do?
Adds a new '--secret' flag to 'lightning run app':
lightning run app --cloud --secret MY_SECRET=my-secret-name app.py
When the Lightning App runs in the cloud, the
'MY_SECRET'
environment variable will be populated with the value of the
referenced Secret. The value of the Secret is encrypted in the
database, and will only be decrypted and accessible to the
Flow/Work processes in the cloud.
Before submitting
PR review
Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃