以前有写过关于minio 的通知事件的,但是是基于kafka 的,而且时间已经很长了,以下是基于新版本minio 的一个demo
集成的webhook,同时开启了额console 方便管理
version: "3"
services:
webhook:
image: jeffail/benthos
volumes:
- "./webhook.yaml:/benthos.yaml"
ports:
- "4195:4195"
s3:
image: minio/minio
environment:
- "MINIO_ACCESS_KEY=minio"
- "MINIO_SECRET_KEY=minio123"
- "MINIO_NOTIFY_WEBHOOK_ENABLE_MYDEMO=on"
- "MINIO_NOTIFY_WEBHOOK_ENDPOINT_MYDEMO=http://webhook:4195"
- "MINIO_NOTIFY_WEBHOOK_AUTH_TOKEN_MYDEMO=demos"
- "MINIO_NOTIFY_WEBHOOK_QUEUE_DIR_MYDEMO=/"
- "MINIO_NOTIFY_WEBHOOK_QUEUE_LIMIT_MYDEMO=10000"
- "MINIO_NOTIFY_WEBHOOK_COMMENT_MYDEMO=DEMO"
command: server /data --console-address ":9001"
ports:
- "9000:9000"
- "9001:9001"
webhook 配置
input:
type: broker
broker:
inputs:
- type: http_server
http_server:
path: /
processors:
- type: text
text:
operator: prepend
value: "get message: "
output:
type: stdout
docker-compose up -d
创建bucket 配置event
事件配置
test bucket 添加文件测试效果
docker-compose logs -f webhook
以上是一个简单的测试,minio 是越来越强大了,灵活的配置,兼容s3做的很不错,值得使用
https://docs.min.io/minio/baremetal/reference/minio-server/minio-server.html#minio-server-envvar-bucket-notification-webhook
https://docs.min.io/minio/baremetal/monitoring/bucket-notifications/publish-events-to-webhook.html#minio-bucket-notifications-publish-webhook
https://docs.min.io/minio/baremetal/monitoring/bucket-notifications/bucket-notifications.html
https://github.com/rongfengliang/minio-webhook