Skip to content

Conversation

asmacdo
Copy link
Contributor

@asmacdo asmacdo commented Aug 26, 2025

I needed this functionality for our deployment. I know some previous work has taken place on this, so I'm not certain if this is the direction upstream would like to go-- but if so I think this should ultimately be split into 3 PRs.

  • conda-store: When using the conda-store API we use the conda API client which needed a small extension for the endpoints we use here.
  • nebari script: Pretty much what is here with the API extensions removed
  • nebari-docs: Manual backup/restore docs to use this script.

Reference Issues or PRs

Related to conda-incubator/conda-store#889 (implements backup, and restore, but not archive)

What does this implement/fix?

backup retrieves a conda-lock file per environment in conda-store.
restore builds an environment per conda-lock file. (skips rebuilding existing by default)

TODO Documentation

Heres the docs for using this with our deployment, I can add this to nebari-docs in a separate PR if this feature is desired.

## Conda Store                                                                                                                             
                                                                                                                                           
Use the `conda-store-lifecycle.py` script to trigger backups and restores.                                                                 
                                                                                                                                           
You will need the following env vars:                                                                                                      
                                                                                                                                           
 - `CONDA_STORE_TOKEN`: see below                                                                                                          
 - `CONDA_STORE_URL`: (ie "https://hub-staging.dandiarchive.org/conda-store")                                                              
                                                                                                                                           
To get a CONDA_STORE_TOKEN:                                                                                                                
 - go to [conda-store admin ui](https://hub-staging.dandiarchive.org/conda-store/admin/) logged in as a user with the "superadmin" Keycloak
 - click "User", and then "Create Token".                                                                                                  
                                                                                                                                           
Execute from this dir:                                                                                                                     
                                                                                                                                           
```bash                                                                                                                                    
cd ops/backup                                                                                                                              
./conda-store-lifecycle.py backup --backup-dir hub-staging/conda/                                                                          

And to restore (idempotent, skips existing dirs)

./conda-store-lifecycle.py restore --backup-dir hub-staging/conda/                                                                         

_Put a `x` in the boxes that apply_

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds a feature)
- [ ] Breaking change (fix or feature that would cause existing features not to work as expected)
- [ ] Documentation Update
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no API changes)
- [ ] Build related changes
- [X] Other (please describe): Add a new script

## Documentation

- [ ] For new features or enhancements, a corresponding PR has been opened in the [documentation repository](https://github.com/nebari-dev/nebari-docs) (if applicable)
  - Link to docs PR:

## Testing

- [ ] Did you test the pull request locally?
- [ ] Did you add new tests?

## How to test this PR?

<!--
If relevant, please outline the steps required to test your contribution
and the expected outcomes from the proposed changes. Providing clear
testing instructions will help reviewers evaluate your contribution.
-->

## Any other comments?

<!--
Please be aware that we are a loose team of volunteers, so patience is necessary;
assistance handling other issues is very welcome.
We value all user contributions. If we are slow to review, either the pull request needs some benchmarking, tinkering,
convincing, etc., or the reviewers are likely busy. In either case,
we ask for your understanding during the
review process.
Thanks for contributing to Nebari 🙏🏼!
-->

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: integration/conda-store needs: review 👀 This PR is complete and ready for reviewing

Projects

Status: New 🚦

Development

Successfully merging this pull request may close these issues.

2 participants