Skip to content

Commit

Permalink
Add ellipses, DNS support (#4)
Browse files Browse the repository at this point in the history
- add support for Docker builds
- add support for build versions
- add support for CI/CD builds
  • Loading branch information
harshavardhana authored Mar 8, 2020
1 parent 47a3488 commit 5e5e5e6
Show file tree
Hide file tree
Showing 10 changed files with 572 additions and 30 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Go

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
build:
name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.13.x, 1.14.x]
os: [ubuntu-latest]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.21.0
$(go env GOPATH)/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
go test -v -race ./...
16 changes: 16 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
linters-settings:
misspell:
locale: US

linters:
disable-all: true
enable:
- typecheck
- goimports
- misspell
- govet
- golint
- ineffassign
- gosimple
- deadcode
- structcheck
66 changes: 55 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,72 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
project_name: sidekick

before:
hooks:
# you may remove this if you don't use vgo
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
-
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/minio/sidekick.ReleaseTag={{.Tag}} -X github.com/minio/sidekick.CommitID={{.FullCommit}} -X github.com/minio/sidekick.Version={{.Version}} -X github.com/minio/sidekick.ShortCommitID={{.ShortCommit}} -X github.com/minio/sidekick.ReleaseTime={{.Date}}
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
-
replacements:
darwin: Darwin
linux: Linux
windows: Windows
freebsd: FreeBSD
amd64: x86_64
format_overrides:
- goos: windows
format: zip
files:
- README.md
- LICENSE
- sidekick_logo.png
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
name_template: 'snapshot-{{ time "2006-01-02" }}'
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
nfpms:
-
vendor: MinIO, Inc.
homepage: https://github.com/minio/sidekick
maintainer: MinIO <[email protected]>
description: sidekick is a load-balancer run as a sidecar
license: GNU Affero General Public License v3.0
formats:
- deb
- rpm
replacements:
darwin: Darwin
linux: Linux
freebsd: FreeBSD
amd64: x86_64
dockers:
-
# GOOS of the built binary that should be used.
goos: linux
# GOARCH of the built binary that should be used.
goarch: amd64
dockerfile: Dockerfile.release
image_templates:
- "minio/sidekick:{{ .Tag }}"
- "minio/sidekick:latest"
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.13.8

ADD go.mod /go/src/github.com/minio/sidekick/go.mod
ADD go.sum /go/src/github.com/minio/sidekick/go.sum
WORKDIR /go/src/github.com/minio/sidekick/
# Get dependencies - will also be cached if we won't change mod/sum
RUN go mod download

ADD . /go/src/github.com/minio/sidekick/
WORKDIR /go/src/github.com/minio/sidekick/

ENV CGO_ENABLED=0

RUN go build -ldflags '-w -s' -a -o sidekick .

FROM scratch
MAINTAINER MinIO Development "[email protected]"
EXPOSE 8080

COPY --from=0 /go/src/github.com/minio/sidekick/sidekick /sidekick

ENTRYPOINT ["/sidekick"]
5 changes: 5 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM scratch
MAINTAINER MinIO Development "[email protected]"
EXPOSE 8080
COPY sidekick /sidekick
ENTRYPOINT ["/sidekick"]
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
![sidekick](sidekick_logo.png)

# Sidekick
Sidekick is a high-performance sidecar load-balancer. By attaching a tiny load balancer as a sidecar to each of the client application processes, you can eliminate the centralized loadbalancer bottleneck and DNS failover management. Sidekick automatically avoids sending traffic to the failed servers by checking their health via the readiness API and HTTP error returns.
*sidekick* is a high-performance sidecar load-balancer. By attaching a tiny load balancer as a sidecar to each of the client application processes, you can eliminate the centralized loadbalancer bottleneck and DNS failover management. *sidekick* automatically avoids sending traffic to the failed servers by checking their health via the readiness API and HTTP error returns.

## Usage
# Download
[Download Binary Releases](https://github.com/minio/sidekick/releases) for various platforms.

# Usage

```
USAGE:
sidekick [FLAGS] ENDPOINTs...
sidekick [FLAGS] ENDPOINT{1...N}
FLAGS:
--adsdress value, -a value listening address for sidekick (default: ":8080")
--address value, -a value listening address for sidekick (default: ":8080")
--health-path value, -p value health check path (default: "/health/ready")
--health-duration value, -d value health check duration (default: 5s)
--insecure, -i disable TLS certificate verification
Expand All @@ -29,7 +32,7 @@ $ sidekick http://myapp.myorg.dom

2. Load balance across 4 MinIO Servers (http://minio1:9000 to http://minio4:9000)
```
$ sidekick --health-path=/minio/health/ready http://minio1:9000 http://minio2:9000 http://minio3:9000 http://minio4:9000
$ sidekick --address :8000 http://minio{1...4}:9000
```

3. Load balance across 16 MinIO Servers (http://minio1:9000 to http://minio16:9000)
Expand Down
21 changes: 21 additions & 0 deletions build-constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) 2020 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.package main

package main

var (
// Version - the version being released (v prefix stripped)
Version = "(dev)"
)
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/minio/sidekick

go 1.13

require github.com/minio/cli v1.22.0
require (
github.com/minio/cli v1.22.0
github.com/minio/minio v0.0.0-20200306223245-52873ac3a39e
)
Loading

0 comments on commit 5e5e5e6

Please sign in to comment.