Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example local object store for testing and development #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docker/README.md
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.
21 changes: 21 additions & 0 deletions docker/docker-compose.yml
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:
Loading