mljar / runmercury-website

RunMercury.com website with Mercury framework documentation
https://RunMercury.com
Apache License 2.0
6 stars 4 forks source link

Feedback for “Secrets Management” #27

Closed somdipdatta closed 6 months ago

somdipdatta commented 6 months ago

Is it possible to use environment secrets in requirements.txt, e.g. to install a package from a private package repository?

--extra-index-url os.environ.get("PKGIDX_URL_KEY")
mypackage
pplonski commented 6 months ago

Hi @somdipdatta,

I think there are two ways it can be done.

  1. You can install package in the notebook, just add code cell with pip command, something like below:
    import sys
    !{sys.executable} -m pip install git+https://{token}@gitprovider.com/user/project.git@{version}`
  2. We need to fix the order of package installation and secrets provision in the current code and then secrets will work in the requirements.txt. Current code: https://github.com/mljar/mercury/blob/909fb3fd1186fc4cefac086232183a2ebd80fc08/mercury/apps/nbworker/nb.py#L324-L325 I think we can fix this today and update workers code, I will let you know.

@apjanusz could you please take a look at this issue?

apjanusz commented 6 months ago

Hi @somdipdatta,

We fixed the problem and updated workers so everything should work. I tested it with private github repo using github token and everything worked. All you have to do is create a secret and include it in your requirements.txt as ${secret_name}. In moment i will update docs :)

Peace

somdipdatta commented 6 months ago

@pplonski @apjanusz Thanks for your quick action. I just tried it out, works as described!

apjanusz commented 6 months ago

@somdipdatta no problem :) Here's a link to our docs: https://runmercury.com/docs/pip-install-requirements/ God bless you!