forked from shinybrar/skaha
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(module): added support for private container registries
- Loading branch information
Showing
18 changed files
with
410 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,60 @@ | ||
# Get Started | ||
|
||
### Installation (Quick Start) | ||
## Installation (Quick Start) | ||
|
||
!!! note "" | ||
|
||
Skaha requires Python 3.7 or higher. | ||
Skaha requires Python 3.8+. | ||
|
||
!!! code "" | ||
|
||
```bash | ||
pip install skaha | ||
``` | ||
|
||
### Before you start | ||
## Before you Begin | ||
|
||
Before you can use skaha, you need to have a valid CANFAR account and have access to the Skaha Science Platform. | ||
If you don't have a CANFAR account, you can register for one [here](https://canfar.net). Once you have a CANFAR account, | ||
you can request access to the Skaha Science Platform from CANFAR Personel. | ||
Before you can use the Skaha python package, you need a valid CANFAR account and access to the Skaha Science Platform. | ||
To create a new account, you can register [here](https://canfar.net). | ||
|
||
### Authentication | ||
|
||
Skaha uses a X509 security certificate for interactions with the CANFAR Science Platform. You need to have a valid certificate | ||
in order to use skaha. | ||
Skaha uses a X509 security certificate for interactions with the CANFAR Science Platform. | ||
You need to have a valid certificate in order to authenticate with the platform. | ||
|
||
#### Generating a certificate | ||
|
||
When you install skaha, a command line tool called `cadc-get-cert` is also installed. This tool can be used to generate | ||
a certificate for you. You can run the following command to generate a certificate: | ||
Installing the skaha package will also install a command line tool called `cadc-get-cert`. | ||
This tool can be used to generate a certificate with the following command: | ||
|
||
```bash title="Generate a certificate" | ||
cadc-get-cert -u <your-username> | ||
Password: <your-password> | ||
```bash | ||
cadc-get-cert -u <your-username> | ||
Password: <your-password> | ||
|
||
DONE. 10 day certificate saved in /home/<your-username>/.ssl/cadcproxy.pem | ||
``` | ||
DONE. 10 day certificate saved in /home/<your-username>/.ssl/cadcproxy.pem | ||
``` | ||
|
||
This will generate a certificate for you and store it in `~/.ssl/cadcproxy.pem`. | ||
|
||
By default, skaha will only look at the `$HOME/.ssl/cadcproxy.pem` location for your certificate. | ||
If you want to use a different location, you can pass the path to the certificate to any Skaha Object when you create it. | ||
|
||
```python title="Using a different certificate location" | ||
from skaha.session import Session | ||
|
||
session = Session(certificate="/path/to/certificate.pem") | ||
``` | ||
|
||
### Contributing | ||
By default, skaha looks at the location `$HOME/.ssl/cadcproxy.pem` for your certificate. | ||
Alternatively, you can specify the location of your certificate when creating a new session. | ||
|
||
We use [poetry](https://python-poetry.org/) to manage our dependencies. To install poetry, run the following command: | ||
```python | ||
from skaha.session import Session | ||
|
||
```bash title="Install poetry" | ||
pip install poetry>=1.2.2 | ||
``` | ||
|
||
Now you can get started to contribute to skaha: | ||
|
||
```bash title="Clone the repository and run tests" | ||
git clone https://github.com/chimefrb/skaha.git | ||
cd skaha | ||
poetry install | ||
poetry run pytest | ||
``` | ||
session = Session(certificate="/path/to/certificate.pem") | ||
``` | ||
|
||
!!! Note "Note" | ||
To run tests, you need a valid CANFAR security certificate and access to the Skaha Science Platform. | ||
### Container Registry Access | ||
|
||
#### Pre-commit | ||
In order to access private container images from the CANFAR Harbor Registry, you need to provide your harbor `username` and the `CLI Secret` through a `ContainerRegistry` object. | ||
|
||
We have a configuration file for [pre-commit](https://pre-commit.com/) that will run a series of checks on your code before | ||
you commit it. To install pre-commit, run the following command: | ||
```python | ||
from skaha.models import ContainerRegistry | ||
from skaha.session import Session | ||
|
||
```bash title="Install pre-commit" | ||
poetry run pre-commit install | ||
``` | ||
registry = ContainerRegistry(username="username", password="sUp3rS3cr3t") | ||
session = Session(registry=registry) | ||
``` | ||
|
||
### Licensing | ||
This code is licensed under the [MIT License](https://en.wikipedia.org/wiki/MIT_License). See the [LICENSE](https://github.com/CHIMEFRB/skaha/blob/main/LICENSE) file for more information. | ||
Passing the `ContainerRegistry` object passes the base64 encoded `username:secret` to the Skaha server for authentication under the `X-Skaha-Registry-Auth` header. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.