Skip to content

Commit

Permalink
Merge pull request #9 from yeti-platform/exports
Browse files Browse the repository at this point in the history
Exports
  • Loading branch information
tomchop authored Oct 15, 2024
2 parents fa266ca + a5384cf commit 3f5849a
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 17 deletions.
12 changes: 12 additions & 0 deletions content/docs/configuring/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: "Configuration options"
date: 2024-10-15
draft: false
cascade: { type: "docs" }
weight: 99
---

Documentation on different configuration options.

- **[File Storage Clients & Export configuration](export-configuration):** How
to configure exports using File Storage Clients
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
title: File Storage Clients & Export Configuration
date: 2024-09-23T9:14:05Z
draft: true
draft: false
weight: 1
---

This section describes what file storage clients are, how to configure them, and how they relate to exports in `yeti`.
This section describes what file storage clients are, how to configure them, and
how they relate to exports in `yeti`.

## What does a File Storage Client Look Like?

Expand All @@ -31,11 +32,14 @@ class FileStorageClient:
...
```

Implementing a class with the above spec and then including it in the `core/clients/file_storage/classes/` directory `yeti` will immediately begin using your new client.
Implementing a class with the above spec and then including it in the
`core/clients/file_storage/classes/` directory `yeti` will immediately begin
using your new client.

## How Does Yeti Decide What File Storage Clients to Use?

Descision making for File Storage Client are done via the `PREFIX` you provide for your class.
Decision making for File Storage Client are done via the `PREFIX` you provide
for your class.

Thus far there are only two support clients: local storage (default) and S3.

Expand All @@ -46,17 +50,23 @@ s3_client = get_client("s3://bucketname/prefix")
local_storage_client = get_client("/opt/yeti/exports")
```

In the above example two clients are created:
The first implemented S3 Client matches the prefix `s3://` and will intialize a `boto` client to interact with S3 compatable bucket.
The second client setups up a local storage client which will interact with the local disk of the system. All paths that do not match one an existing prefix of one the client will default to using the local storage client.
In the above example two clients are created: The first implemented S3 Client
matches the prefix `s3://` and will initialize a `boto` client to interact with
S3 compatible bucket. The second client setups up a local storage client which
will interact with the local disk of the system. All paths that do not match one
an existing prefix of one the client will default to using the local storage
client.

### How to Configure a File Storage Client?

Currently, the only use for File Storage Cloient is for storage of export tasks as configured through the `system.export_path` config value.
Currently, the only use for File Storage Client is for storage of export tasks
as configured through the `system.export_path` config value.

In order to provide flexible support for clients like `boto3`, environment variable are used for configuration and permissioning.
In order to provide flexible support for clients like `boto3`, environment
variable are used for configuration and permissioning.

These environment variables can be injected several different ways, but the easiest is just including them in the `docker-compose.yaml`
These environment variables can be injected several different ways, but the
easiest is just including them in the `docker-compose.yaml`

```diff
services:
Expand All @@ -78,17 +88,22 @@ services:
command: ['tasks']
```

** Note: For S3 there are several different environment variables to configure everything from different providers to how authentication to the buckets are done and much more. Shown above is just a common pattern, not an all-encompassing one.
\*\* Note: For S3 there are several different environment variables to configure
everything from different providers to how authentication to the buckets are
done and much more. Shown above is just a common pattern, not an
all-encompassing one.

The you can include your secret credentials in a `.env` file.

## Clients

The following are a list of file storage clients and general configuration required for them:
The following are a list of file storage clients and general configuration
required for them:

### Local Storage

`local_storage` is the default client used. If none of the loaded Client Prefixes match the path you provide, then `local_storage` will be used.
`local_storage` is the default client used. If none of the loaded Client
Prefixes match the path you provide, then `local_storage` will be used.

Example:

Expand All @@ -100,9 +115,12 @@ local_storage_client = get_client("/opt/yeti/exports")

### S3

Amazon S3 (Simple Storage Service) is a scalable object storage service used for storing and retrieving any amount of data at any time and is a common spec used by other cloud providers and file storage services.
Amazon S3 (Simple Storage Service) is a scalable object storage service used for
storing and retrieving any amount of data at any time and is a common spec used
by other cloud providers and file storage services.

If you configured path starts with: `s3://` then the `S3StorageClient` will be loaded:
If you configured path starts with: `s3://` then the `S3StorageClient` will be
loaded:

```python
from core.clients.file_storage import get_client
Expand All @@ -112,7 +130,8 @@ local_storage_client = get_client("s3://bucket-name/path/")

#### S3 Bucket Configuration

Add respective configuration for accessing your bucket as an environment variable; this is easiest done in `docker-compose.yaml`:
Add respective configuration for accessing your bucket as an environment
variable; this is easiest done in `docker-compose.yaml`:

```diff
services:
Expand All @@ -136,7 +155,8 @@ services:

#### Install the `s3` Extra

As `s3` is an optional feature; you will need to included installation of it's dependencies.
As `s3` is an optional feature; you will need to included installation of it's
dependencies.

This can be done by adding `--extras s3` to your existing poetry install:

Expand Down

0 comments on commit 3f5849a

Please sign in to comment.