From 67cbdf0a0f970bef8d4df9ee93d6e5ca7ccce00f Mon Sep 17 00:00:00 2001 From: Luis Belloch Date: Mon, 5 Feb 2018 20:35:30 +0100 Subject: [PATCH] Added minio to infra samples --- infra/minio/config/config.json | 17 +++++++++++++++ infra/minio/config/config.json.old | 29 +++++++++++++++++++++++++ infra/minio/config/share/downloads.json | 4 ++++ infra/minio/config/share/uploads.json | 4 ++++ infra/minio/data | 1 + infra/minio/docker-compose.yml | 20 +++++++++++++++++ infra/minio/mc | 12 ++++++++++ infra/minio/mirror.sh | 6 +++++ 8 files changed, 93 insertions(+) create mode 100644 infra/minio/config/config.json create mode 100644 infra/minio/config/config.json.old create mode 100644 infra/minio/config/share/downloads.json create mode 100644 infra/minio/config/share/uploads.json create mode 120000 infra/minio/data create mode 100644 infra/minio/docker-compose.yml create mode 100755 infra/minio/mc create mode 100755 infra/minio/mirror.sh diff --git a/infra/minio/config/config.json b/infra/minio/config/config.json new file mode 100644 index 0000000..a516f74 --- /dev/null +++ b/infra/minio/config/config.json @@ -0,0 +1,17 @@ +{ + "version": "8", + "hosts": { + "local": { + "url": "http://localhost:9000", + "accessKey": "JX6SNZEW2CLYM66UDHT7", + "secretKey": "NHtuFRcy8XnRuqbASsHTK65oxYMQ7sNvwTnA1oX0", + "api": "S3v4" + }, + "minio": { + "url": "http://minio:9000", + "accessKey": "JX6SNZEW2CLYM66UDHT7", + "secretKey": "NHtuFRcy8XnRuqbASsHTK65oxYMQ7sNvwTnA1oX0", + "api": "s3v4" + } + } +} diff --git a/infra/minio/config/config.json.old b/infra/minio/config/config.json.old new file mode 100644 index 0000000..5557e0b --- /dev/null +++ b/infra/minio/config/config.json.old @@ -0,0 +1,29 @@ +{ + "version": "8", + "hosts": { + "gcs": { + "url": "https://storage.googleapis.com", + "accessKey": "YOUR-ACCESS-KEY-HERE", + "secretKey": "YOUR-SECRET-KEY-HERE", + "api": "S3v2" + }, + "local": { + "url": "http://localhost:9000", + "accessKey": "", + "secretKey": "", + "api": "S3v4" + }, + "play": { + "url": "https://play.minio.io:9000", + "accessKey": "Q3AM3UQ867SPQQA43P2F", + "secretKey": "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", + "api": "S3v4" + }, + "s3": { + "url": "https://s3.amazonaws.com", + "accessKey": "YOUR-ACCESS-KEY-HERE", + "secretKey": "YOUR-SECRET-KEY-HERE", + "api": "S3v4" + } + } +} \ No newline at end of file diff --git a/infra/minio/config/share/downloads.json b/infra/minio/config/share/downloads.json new file mode 100644 index 0000000..75362d1 --- /dev/null +++ b/infra/minio/config/share/downloads.json @@ -0,0 +1,4 @@ +{ + "version": "1", + "shares": {} +} \ No newline at end of file diff --git a/infra/minio/config/share/uploads.json b/infra/minio/config/share/uploads.json new file mode 100644 index 0000000..75362d1 --- /dev/null +++ b/infra/minio/config/share/uploads.json @@ -0,0 +1,4 @@ +{ + "version": "1", + "shares": {} +} \ No newline at end of file diff --git a/infra/minio/data b/infra/minio/data new file mode 120000 index 0000000..b8fb52e --- /dev/null +++ b/infra/minio/data @@ -0,0 +1 @@ +../../data/ \ No newline at end of file diff --git a/infra/minio/docker-compose.yml b/infra/minio/docker-compose.yml new file mode 100644 index 0000000..504f769 --- /dev/null +++ b/infra/minio/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3' +services: + minio: + image: minio/minio + command: server /data + volumes: + - minio1:/data + networks: [block] + ports: + - 9000:9000 + environment: + MINIO_ACCESS_KEY: JX6SNZEW2CLYM66UDHT7 + MINIO_SECRET_KEY: NHtuFRcy8XnRuqbASsHTK65oxYMQ7sNvwTnA1oX0 + +networks: + block: + +volumes: + minio1: + diff --git a/infra/minio/mc b/infra/minio/mc new file mode 100755 index 0000000..fe357a0 --- /dev/null +++ b/infra/minio/mc @@ -0,0 +1,12 @@ +#!/bin/bash +set -eou pipefail + +readonly MC=(docker run -v "$(PWD)/data":/data -v "$(PWD)/config":/root/.mc --network="host" -ti minio/mc) + +if [[ $# -lt 1 ]]; then + >&2 ${MC[@]} + exit 1 +fi + +${MC[@]} $@ + diff --git a/infra/minio/mirror.sh b/infra/minio/mirror.sh new file mode 100755 index 0000000..a2ba029 --- /dev/null +++ b/infra/minio/mirror.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -eou pipefail +readonly BUCKET=local/data +./mc mb -p "${BUCKET}" +./mc mirror --remove data "${BUCKET}" +