-
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.
Example local object store for testing and development
- Loading branch information
1 parent
1e7bc60
commit 4132388
Showing
2 changed files
with
71 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Local Object Store | ||
|
||
## TL;DR | ||
|
||
``` | ||
export AWS_ACCESS_KEY_ID=AWSACCESSKEYID | ||
export AWS_SECRET_ACCESS_KEY=AWSSECRETACCESSKEY | ||
export AWS_ENDPOINT_URL=http://localhost:9000 | ||
docker compose up -d | ||
# list buckets (no buckets) | ||
aws s3api list-buckets | ||
# Make buckets | ||
aws s3api create-bucket --bucket alerts | ||
aws s3api create-bucket --bucket schema | ||
# Add objects | ||
aws s3 cp <alert_file> s3://alerts/ | ||
aws s3 cp <schema_file> s3://schema/ | ||
``` | ||
|
||
## Prereqs | ||
|
||
- AWS CLI tool (`brew install awscli`) | ||
- Docker | ||
|
||
## How | ||
|
||
- Minio is an object store server that provides the same API as Amazon S3, so it | ||
can be used as a drop-in replacement for S3 and other compatible object stores. | ||
|
||
- The AWS credentials (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY) map to minio | ||
settings for `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` | ||
|
||
- The `AWS_ENDPOINT_URL` variable tells *all* AWS API tools where to send their | ||
commands -- this includes the aws cli tool and `boto3`! | ||
|
||
- Use standard AWS CLI tools to create buckets and add data to Minio. | ||
|
||
- Leave it running and use boto3 with the same credentials & endpoint url. | ||
|
||
- `docker compose down` when you're done | ||
|
||
- Bind-mount a local directory to the Minio container's `/data/` location to pre-seed | ||
objects (directories are buckets). | ||
|
||
- You can also visit `http://localhost:9001` to see the Minio web console and browse | ||
around. |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
minio: | ||
image: quay.io/minio/minio | ||
command: | ||
- server | ||
- /data | ||
- --console-address | ||
- ":9001" | ||
environment: | ||
MINIO_ROOT_USER: AWSACCESSKEYID | ||
MINIO_ROOT_PASSWORD: AWSSECRETACCESSKEY | ||
ports: | ||
- "9000:9000" | ||
- "9001:9001" | ||
volumes: # pick one and only one of these | ||
- minio:/data # an initially empty Docker volume | ||
# - ./data:/data # the data directory right here | ||
# - /path/to/data:/data # any arbitrary path you like | ||
|
||
volumes: | ||
minio: |