Skip to content

Commit

Permalink
Example local object store for testing and development
Browse files Browse the repository at this point in the history
  • Loading branch information
tcjennings committed Dec 11, 2024
1 parent 1e7bc60 commit 4132388
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
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:

0 comments on commit 4132388

Please sign in to comment.