Compare commits

...

6 Commits

Author SHA1 Message Date
Minio Trusted 1b472dae78 Bump to new release. 2017-04-28 17:58:49 -07:00
Krishna Srinivas eb50175ad9 gateway: reject bad path segments in URL (#4202) 2017-04-28 17:26:13 -07:00
Krishna Srinivas e85349381e gateway: Fix help message for gateway (#4201) 2017-04-28 17:26:00 -07:00
Krishna Srinivas 06bc68a4b3 gateway: Fix help message for custom Azure Blob Storage endpoint. (#4113) 2017-04-28 17:23:41 -07:00
Krishna Srinivas fb506c7fca gateway: Support for custom endpoint. (#4086) 2017-04-28 17:23:23 -07:00
Harshavardhana 8a7cffe7b8 docs: macOS brew now refers to Minio fork (#4059) 2017-04-25 11:01:51 -07:00
6 changed files with 116 additions and 21 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ RUN \
apk add --no-cache --virtual .build-deps git go musl-dev && \
go get -v -d github.com/minio/minio && \
cd /go/src/github.com/minio/minio && \
go install -v -ldflags "-X github.com/minio/minio/cmd.Version=2017-04-25T01:27:49Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2017-04-25T01-27-49Z -X github.com/minio/minio/cmd.CommitID=710db6bdadb1b228bf6dee7e2a6958000091125b" && \
go install -v -ldflags "-X github.com/minio/minio/cmd.Version=2017-04-29T00:40:27Z -X github.com/minio/minio/cmd.ReleaseTag=RELEASE.2017-04-29T00-40-27Z -X github.com/minio/minio/cmd.CommitID=eb50175ad911d496bf583a599de89547f0c9be89" && \
rm -rf /go/pkg /go/src /usr/local/go && apk del .build-deps
EXPOSE 9000
+3 -3
View File
@@ -18,19 +18,19 @@ docker run -p 9000:9000 minio/minio:edge server /export
```
Please visit Minio Docker quickstart guide for more [here](https://docs.minio.io/docs/minio-docker-quickstart-guide)
## OS X
## macOS
### Homebrew
Install minio packages using [Homebrew](http://brew.sh/)
```sh
brew install minio
brew install minio/stable/minio
minio server ~/Photos
```
### Binary Download
| Platform| Architecture | URL|
| ----------| -------- | ------|
|Apple OS X|64-bit Intel|https://dl.minio.io/server/minio/release/darwin-amd64/minio|
|Apple macOS|64-bit Intel|https://dl.minio.io/server/minio/release/darwin-amd64/minio |
```sh
chmod 755 minio
./minio server ~/Photos
+5 -3
View File
@@ -123,9 +123,11 @@ func azureToObjectError(err error, params ...string) error {
}
// Inits azure blob storage client and returns AzureObjects.
func newAzureLayer(account, key string) (GatewayLayer, error) {
useHTTPS := true
c, err := storage.NewClient(account, key, storage.DefaultBaseURL, globalAzureAPIVersion, useHTTPS)
func newAzureLayer(endPoint string, account, key string, secure bool) (GatewayLayer, error) {
if endPoint == "" {
endPoint = storage.DefaultBaseURL
}
c, err := storage.NewClient(account, key, endPoint, globalAzureAPIVersion, secure)
if err != nil {
return AzureObjects{}, err
}
+55 -12
View File
@@ -18,7 +18,9 @@ package cmd
import (
"fmt"
"net/url"
"os"
"strings"
"github.com/gorilla/mux"
"github.com/minio/cli"
@@ -29,11 +31,14 @@ var gatewayTemplate = `NAME:
{{.HelpName}} - {{.Usage}}
USAGE:
{{.HelpName}} {{if .VisibleFlags}}[FLAGS]{{end}} BACKEND
{{.HelpName}} {{if .VisibleFlags}}[FLAGS]{{end}} BACKEND [ENDPOINT]
{{if .VisibleFlags}}
FLAGS:
{{range .VisibleFlags}}{{.}}
{{end}}{{end}}
BACKEND:
azure: Microsoft Azure Blob Storage. Default ENDPOINT is https://core.windows.net
ENVIRONMENT VARIABLES:
ACCESS:
MINIO_ACCESS_KEY: Username or access key of your storage backend.
@@ -41,21 +46,22 @@ ENVIRONMENT VARIABLES:
EXAMPLES:
1. Start minio gateway server for Azure Blob Storage backend.
$ export MINIO_ACCESS_KEY=azureaccountname
$ export MINIO_SECRET_KEY=azureaccountkey
$ {{.HelpName}} azure
2. Start minio gateway server bound to a specific ADDRESS:PORT.
$ {{.HelpName}} --address 192.168.1.101:9000 azure
`
var gatewayCmd = cli.Command{
Name: "gateway",
Usage: "Start object storage gateway server.",
Usage: "Start object storage gateway.",
Action: gatewayMain,
CustomHelpTemplate: gatewayTemplate,
Flags: append(serverFlags, cli.BoolFlag{
Name: "quiet",
Usage: "Disable startup banner.",
}),
Flags: append(serverFlags,
cli.BoolFlag{
Name: "quiet",
Usage: "Disable startup banner.",
},
),
HideHelpCommand: true,
}
@@ -83,11 +89,11 @@ func mustGetGatewayCredsFromEnv() (accessKey, secretKey string) {
//
// - Azure Blob Storage.
// - Add your favorite backend here.
func newGatewayLayer(backendType, accessKey, secretKey string) (GatewayLayer, error) {
func newGatewayLayer(backendType, endPoint, accessKey, secretKey string, secure bool) (GatewayLayer, error) {
if gatewayBackend(backendType) != azureBackend {
return nil, fmt.Errorf("Unrecognized backend type %s", backendType)
}
return newAzureLayer(accessKey, secretKey)
return newAzureLayer(endPoint, accessKey, secretKey, secure)
}
// Initialize a new gateway config.
@@ -125,6 +131,28 @@ func newGatewayConfig(accessKey, secretKey, region string) error {
return nil
}
// Return endpoint.
func parseGatewayEndpoint(arg string) (endPoint string, secure bool, err error) {
schemeSpecified := len(strings.Split(arg, "://")) > 1
if !schemeSpecified {
// Default connection will be "secure".
arg = "https://" + arg
}
u, err := url.Parse(arg)
if err != nil {
return "", false, err
}
switch u.Scheme {
case "http":
return u.Host, false, nil
case "https":
return u.Host, true, nil
default:
return "", false, fmt.Errorf("Unrecognized scheme %s", u.Scheme)
}
}
// Handler for 'minio gateway'.
func gatewayMain(ctx *cli.Context) {
if !ctx.Args().Present() || ctx.Args().First() == "help" {
@@ -153,7 +181,20 @@ func gatewayMain(ctx *cli.Context) {
// First argument is selected backend type.
backendType := ctx.Args().First()
newObject, err := newGatewayLayer(backendType, accessKey, secretKey)
// Second argument is endpoint. If no endpoint is specified then the
// gateway implementation should use a default setting.
endPoint, secure, err := parseGatewayEndpoint(ctx.Args().Get(1))
if err != nil {
console.Fatalf("Unable to parse endpoint. Error: %s", err)
}
// Create certs path for SSL configuration.
err = createConfigDir()
if err != nil {
console.Fatalf("Unable to create configuration directory. Error: %s", err)
}
newObject, err := newGatewayLayer(backendType, endPoint, accessKey, secretKey, secure)
if err != nil {
console.Fatalf("Unable to initialize gateway layer. Error: %s", err)
}
@@ -164,6 +205,8 @@ func gatewayMain(ctx *cli.Context) {
registerGatewayAPIRouter(router, newObject)
var handlerFns = []HandlerFunc{
// Validate all the incoming paths.
setPathValidityHandler,
// Limits all requests size to a maximum fixed limit
setRequestSizeLimitHandler,
// Adds 'crossdomain.xml' policy handler to serve legacy flash clients.
+50
View File
@@ -0,0 +1,50 @@
/*
* Minio Cloud Storage, (C) 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cmd
import "testing"
// Test parseGatewayEndpoint
func TestParseGatewayEndpoint(t *testing.T) {
testCases := []struct {
arg string
endPoint string
secure bool
errReturned bool
}{
{"http://127.0.0.1:9000", "127.0.0.1:9000", false, false},
{"https://127.0.0.1:9000", "127.0.0.1:9000", true, false},
{"http://play.minio.io:9000", "play.minio.io:9000", false, false},
{"https://play.minio.io:9000", "play.minio.io:9000", true, false},
{"ftp://127.0.0.1:9000", "", false, true},
{"ftp://play.minio.io:9000", "", false, true},
{"play.minio.io:9000", "play.minio.io:9000", true, false},
}
for i, test := range testCases {
endPoint, secure, err := parseGatewayEndpoint(test.arg)
errReturned := err != nil
if endPoint != test.endPoint ||
secure != test.secure ||
errReturned != test.errReturned {
t.Errorf("Test %d: expected %s,%t,%t got %s,%t,%t",
i+1, test.endPoint, test.secure, test.errReturned,
endPoint, secure, errReturned)
}
}
}
+2 -2
View File
@@ -1,8 +1,8 @@
%define tag RELEASE.2017-04-25T01-27-49Z
%define tag RELEASE.2017-04-29T00-40-27Z
%define subver %(echo %{tag} | sed -e 's/[^0-9]//g')
# git fetch https://github.com/minio/minio.git refs/tags/RELEASE.2017-04-25T01-27-49Z
# git rev-list -n 1 FETCH_HEAD
%define commitid 710db6bdadb1b228bf6dee7e2a6958000091125b
%define commitid 0e6a222c4e0647880ed6a9f1900eb8ce69a5b33b
Summary: Cloud Storage Server.
Name: minio
Version: 0.0.%{subver}