mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Add new Docker build process and continuous delivery
This commit is contained in:
parent
eff313d181
commit
dca19f7e94
8 changed files with 163 additions and 146 deletions
|
|
@ -5,7 +5,7 @@ executors:
|
|||
parameters:
|
||||
version:
|
||||
type: string
|
||||
default: "1.15.5"
|
||||
default: "1.15.8"
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium
|
||||
|
|
@ -17,7 +17,8 @@ executors:
|
|||
commands:
|
||||
add-github-auth:
|
||||
steps:
|
||||
- run: git config --global url."https://moleculacorp:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com".insteadOf "https://github.com"
|
||||
- run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||
- run: git config --global url."https://${GITHUB_USER}:${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/".insteadOf "git@github.com:"
|
||||
restore-mod-cache:
|
||||
steps:
|
||||
- restore_cache:
|
||||
|
|
@ -67,7 +68,7 @@ jobs:
|
|||
name: golang
|
||||
steps:
|
||||
- run: '[[ -n $CIRCLE_PULL_REQUEST ]] || circleci step halt || true' # Skip if this is not a pull request
|
||||
- run: curl https://moleculacorp:$GITHUB_PERSONAL_ACCESS_TOKEN@api.github.com/repos/molecula/pilosa/pulls/$(basename $CIRCLE_PULL_REQUEST) | jq "[.labels[] | .name | startswith(\"changelog\")] | any" -e
|
||||
- run: curl https://$GITHUB_USER:$GITHUB_PERSONAL_ACCESS_TOKEN@api.github.com/repos/molecula/pilosa/pulls/$(basename $CIRCLE_PULL_REQUEST) | jq "[.labels[] | .name | startswith(\"changelog\")] | any" -e
|
||||
test-build-arm:
|
||||
executor:
|
||||
name: golang
|
||||
|
|
@ -84,7 +85,7 @@ jobs:
|
|||
default: medium
|
||||
golang_version:
|
||||
type: string
|
||||
default: "1.15.5"
|
||||
default: "1.15.8"
|
||||
shard_width:
|
||||
type: string
|
||||
default: "20"
|
||||
|
|
@ -114,17 +115,6 @@ jobs:
|
|||
- checkout-plus
|
||||
- setup_remote_docker
|
||||
- run: make clustertests-build
|
||||
prerelease:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- run: make prerelease
|
||||
- store_artifacts:
|
||||
path: build
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: build
|
||||
release:
|
||||
executor:
|
||||
name: golang
|
||||
|
|
@ -132,28 +122,32 @@ jobs:
|
|||
- checkout-plus
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: make release
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker-release
|
||||
- store_artifacts:
|
||||
path: build
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: build
|
||||
prerelease-upload:
|
||||
docker:
|
||||
- image: circleci/python:2.7-jessie
|
||||
publish_release:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: sudo pip install awscli
|
||||
- run: make prerelease-upload
|
||||
- run: go get github.com/tcnksm/ghr
|
||||
- run: ghr -t ${GITHUB_PERSONAL_ACCESS_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${CIRCLE_TAG} ./build/
|
||||
docker-build:
|
||||
executor:
|
||||
name: golang
|
||||
steps:
|
||||
- checkout-plus
|
||||
- setup_remote_docker
|
||||
- run: make docker
|
||||
- setup_remote_docker:
|
||||
version: 19.03.13 # see https://support.circleci.com/hc/en-us/articles/360050934711
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker GO_VERSION=1.15.8
|
||||
- run: docker run pilosa:$(git describe --tags) help
|
||||
dockerhub-upload-unstable:
|
||||
executor:
|
||||
|
|
@ -163,7 +157,7 @@ jobs:
|
|||
- setup_remote_docker
|
||||
- run: make docker
|
||||
- run: docker run pilosa:$(git describe --tags) help
|
||||
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/pilosa:<< pipeline.git.branch >>
|
||||
dockerhub-upload-stable:
|
||||
executor:
|
||||
|
|
@ -173,7 +167,7 @@ jobs:
|
|||
- setup_remote_docker
|
||||
- run: make docker
|
||||
- run: docker run pilosa:$(git describe --tags) help
|
||||
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
|
||||
- run: echo -n $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/pilosa:<< pipeline.git.tag >>
|
||||
- run: make docker-tag-push DOCKER_TARGET=moleculacorp/pilosa:latest
|
||||
|
||||
|
|
@ -186,12 +180,15 @@ workflows:
|
|||
tags:
|
||||
only: /^v.*/
|
||||
- linter:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- check-license-headers:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- go-mod-tidy:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- check-changelog-label:
|
||||
|
|
@ -199,6 +196,7 @@ workflows:
|
|||
requires:
|
||||
- setup
|
||||
- test-build-arm:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- test:
|
||||
|
|
@ -209,7 +207,7 @@ workflows:
|
|||
- setup
|
||||
matrix:
|
||||
parameters:
|
||||
golang_version: ["1.14.12", "1.15.5"]
|
||||
golang_version: ["1.14.15", "1.15.8"]
|
||||
- test:
|
||||
name: << matrix.test_make_target >>
|
||||
resource_class: xlarge
|
||||
|
|
@ -221,22 +219,37 @@ workflows:
|
|||
test_make_target: ["test-race", "test-txstore-rbf", "test-txstore-rbf_bolt"]
|
||||
- test:
|
||||
name: test-shardwidth-22
|
||||
context: molecula
|
||||
shard_width: "22"
|
||||
resource_class: large
|
||||
requires:
|
||||
- setup
|
||||
- cluster-tests:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- docker-build:
|
||||
context: molecula
|
||||
requires:
|
||||
- setup
|
||||
- prerelease:
|
||||
- release:
|
||||
context: molecula
|
||||
requires:
|
||||
- linter
|
||||
- check-license-headers
|
||||
- test-golang-1.15.5
|
||||
- setup
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- publish_release:
|
||||
context: molecula
|
||||
requires:
|
||||
- release
|
||||
filters:
|
||||
tags:
|
||||
only: /^v.*/
|
||||
branches:
|
||||
ignore: /.*/
|
||||
- dockerhub-upload-unstable:
|
||||
context: molecula
|
||||
requires:
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
lattice
|
||||
lattice/.git
|
||||
lattice/node_modules
|
||||
lattice/build
|
||||
statik/statik.go
|
||||
build
|
||||
|
|
|
|||
41
Dockerfile
41
Dockerfile
|
|
@ -1,19 +1,46 @@
|
|||
FROM golang:1.14.10 as builder
|
||||
ARG GO_VERSION=latest
|
||||
|
||||
ARG BUILD_FLAGS
|
||||
#######################
|
||||
### Lattice builder ###
|
||||
#######################
|
||||
|
||||
FROM moleculacorp/nodejs:latest as lattice-builder
|
||||
WORKDIR /lattice
|
||||
|
||||
COPY lattice/package.json ./
|
||||
COPY lattice/yarn.lock ./
|
||||
RUN yarn install
|
||||
|
||||
COPY lattice ./
|
||||
RUN yarn build
|
||||
|
||||
######################
|
||||
### Pilosa builder ###
|
||||
######################
|
||||
|
||||
FROM golang:${GO_VERSION} as pilosa-builder
|
||||
ARG MAKE_FLAGS
|
||||
WORKDIR /pilosa
|
||||
|
||||
COPY . pilosa
|
||||
RUN go get github.com/rakyll/statik
|
||||
|
||||
RUN cd pilosa && make install FLAGS="-a -mod=vendor ${BUILD_FLAGS}" ${MAKE_FLAGS}
|
||||
COPY . ./
|
||||
COPY --from=lattice-builder /lattice/build /lattice
|
||||
RUN /go/bin/statik -src=/lattice -dest=/pilosa
|
||||
|
||||
FROM alpine:3.12.1
|
||||
RUN make build ${MAKE_FLAGS}
|
||||
|
||||
LABEL maintainer "dev@pilosa.com"
|
||||
#####################
|
||||
### Pilosa runner ###
|
||||
#####################
|
||||
|
||||
FROM alpine:3.13.2 as runner
|
||||
|
||||
LABEL maintainer "dev@molecula.com"
|
||||
|
||||
RUN apk add --no-cache curl jq
|
||||
|
||||
COPY --from=builder /go/bin/pilosa /pilosa
|
||||
COPY --from=pilosa-builder /pilosa/build/pilosa /
|
||||
|
||||
COPY LICENSE /LICENSE
|
||||
COPY NOTICE /NOTICE
|
||||
|
|
|
|||
132
Makefile
132
Makefile
|
|
@ -1,22 +1,24 @@
|
|||
.PHONY: build check-clean clean build-lattice cover cover-viz default docker docker-build docker-test docker-tag-push generate generate-protoc generate-pql generate-statik gometalinter install install-build-deps install-golangci-lint install-gometalinter install-protoc install-protoc-gen-gofast install-peg install-statik prerelease prerelease-upload release release-build test testv testv-race testvsub testvsub-race test-txstore-rbf lattice
|
||||
.PHONY: build check-clean clean build-lattice cover cover-viz default docker docker-build docker-test docker-tag-push generate generate-protoc generate-pql generate-statik gometalinter install install-build-deps install-golangci-lint install-gometalinter install-protoc install-protoc-gen-gofast install-peg install-statik release release-build test testv testv-race testvsub testvsub-race test-txstore-rbf lattice
|
||||
|
||||
CLONE_URL=github.com/pilosa/pilosa
|
||||
MOD_VERSION=v2
|
||||
VERSION := $(shell git describe --tags 2> /dev/null || echo unknown)
|
||||
LATTICE_COMMIT := $(shell git -C lattice rev-parse --short HEAD 2>/dev/null)
|
||||
VARIANT = Molecula
|
||||
VERSION_ID = $(VERSION)-$(GOOS)-$(GOARCH)
|
||||
BRANCH := $(if $(TRAVIS_BRANCH),$(TRAVIS_BRANCH),$(if $(CIRCLE_BRANCH),$(CIRCLE_BRANCH),$(shell git rev-parse --abbrev-ref HEAD)))
|
||||
GO=go
|
||||
GOOS=$(shell $(GO) env GOOS)
|
||||
GOARCH=$(shell $(GO) env GOARCH)
|
||||
BINOUT=build
|
||||
FLAGS=-o $(BINOUT)/pilosa
|
||||
VERSION_ID=$(if $(TRIAL_DEADLINE),trial-$(TRIAL_DEADLINE)-,)$(VERSION)-$(GOOS)-$(GOARCH)
|
||||
BRANCH := $(if $(CIRCLE_BRANCH),$(CIRCLE_BRANCH),$(shell git rev-parse --abbrev-ref HEAD))
|
||||
BRANCH_ID := $(BRANCH)-$(GOOS)-$(GOARCH)
|
||||
BUILD_TIME := $(shell date -u +%FT%T%z)
|
||||
SHARD_WIDTH = 20
|
||||
COMMIT := $(shell git describe --exact-match >/dev/null 2>&1 || git rev-parse --short HEAD)
|
||||
LDFLAGS="-X github.com/pilosa/pilosa/v2.Version=$(VERSION) -X github.com/pilosa/pilosa/v2.BuildTime=$(BUILD_TIME) -X github.com/pilosa/pilosa/v2.Variant=$(VARIANT) -X github.com/pilosa/pilosa/v2.Commit=$(COMMIT) -X github.com/pilosa/pilosa/v2.LatticeCommit=$(LATTICE_COMMIT) -X github.com/pilosa/pilosa/v2.TrialDeadline=$(TRIAL_DEADLINE)"
|
||||
TRIAL_STRING = $(if $(TRIAL_DEADLINE),"-trial-$(TRIAL_DEADLINE)","")
|
||||
GO_VERSION=1.14.10
|
||||
RELEASE ?= 0
|
||||
RELEASE_ENABLED = $(subst 0,,$(RELEASE))
|
||||
BUILD_TAGS += $(if $(RELEASE_ENABLED),release)
|
||||
GO_VERSION=1.15.8
|
||||
DOCKER_BUILD= # set to 1 to use `docker-build` instead of `build` when creating a release
|
||||
BUILD_TAGS += shardwidth$(SHARD_WIDTH)
|
||||
TEST_TAGS = roaringparanoia
|
||||
define LICENSE_HASH_CODE
|
||||
|
|
@ -43,15 +45,15 @@ clean:
|
|||
|
||||
# Set up vendor directory using `go mod vendor`
|
||||
vendor: go.mod
|
||||
go mod vendor
|
||||
$(GO) mod vendor
|
||||
|
||||
# Run test suite
|
||||
test:
|
||||
go test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v
|
||||
$(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v
|
||||
|
||||
# Run test suite with race flag
|
||||
test-race:
|
||||
CGO_ENABLED=1 go test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -race -timeout 60m -v
|
||||
CGO_ENABLED=1 $(GO) test ./... -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -race -timeout 60m -v
|
||||
|
||||
testv: topt testvsub
|
||||
|
||||
|
|
@ -66,7 +68,7 @@ testvsub:
|
|||
set -e; for i in boltdb ctl http pg pql rbf roaring server sql txkey; do \
|
||||
echo; echo "___ testing subpkg $$i"; \
|
||||
cd $$i; pwd; \
|
||||
go test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout 60m || break; \
|
||||
$(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -timeout 60m || break; \
|
||||
echo; echo "999 done testing subpkg $$i"; \
|
||||
cd ..; \
|
||||
done
|
||||
|
|
@ -75,7 +77,7 @@ testvsub-race:
|
|||
set -e; for i in boltdb ctl http pg pql rbf roaring server sql txkey; do \
|
||||
echo; echo "___ testing subpkg $$i -race"; \
|
||||
cd $$i; pwd; \
|
||||
CGO_ENABLED=1 go test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout 60m || break; \
|
||||
CGO_ENABLED=1 $(GO) test -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) -v -race -timeout 60m || break; \
|
||||
echo; echo "999 done testing subpkg $$i -race"; \
|
||||
cd ..; \
|
||||
done
|
||||
|
|
@ -84,7 +86,7 @@ tour:
|
|||
./tournament.sh
|
||||
|
||||
bench:
|
||||
go test ./... -bench=. -run=NoneZ -timeout=127m $(TESTFLAGS)
|
||||
$(GO) test ./... -bench=. -run=NoneZ -timeout=127m $(TESTFLAGS)
|
||||
|
||||
# Run test suite with coverage enabled
|
||||
cover:
|
||||
|
|
@ -93,18 +95,18 @@ cover:
|
|||
|
||||
# Run test suite with coverage enabled and view coverage results in browser
|
||||
cover-viz: cover
|
||||
go tool cover -html=build/coverage.out
|
||||
$(GO) tool cover -html=build/coverage.out
|
||||
|
||||
# Compile Pilosa
|
||||
build:
|
||||
go build -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa
|
||||
$(GO) build -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa
|
||||
|
||||
# Create a single release build under the build directory
|
||||
release-build:
|
||||
$(MAKE) $(if $(DOCKER_BUILD),docker-)build FLAGS="-o build/pilosa$(TRIAL_STRING)-$(VERSION_ID)/pilosa" RELEASE=1
|
||||
cp NOTICE README.md LICENSE build/pilosa$(TRIAL_STRING)-$(VERSION_ID)
|
||||
tar -cvz -C build -f build/pilosa$(TRIAL_STRING)-$(VERSION_ID).tar.gz pilosa$(TRIAL_STRING)-$(VERSION_ID)/
|
||||
@echo Created release build: build/pilosa$(TRIAL_STRING)-$(VERSION_ID).tar.gz
|
||||
$(MAKE) $(if $(DOCKER_BUILD),docker-)build FLAGS="-o build/pilosa-$(VERSION_ID)/pilosa"
|
||||
cp NOTICE README.md LICENSE build/pilosa$(VERSION_ID)
|
||||
tar -cvz -C build -f build/pilosa-$(VERSION_ID).tar.gz pilosa-$(VERSION_ID)/
|
||||
@echo Created release build: build/pilosa-$(VERSION_ID).tar.gz
|
||||
|
||||
# Error out if there are untracked changes in Git
|
||||
check-clean:
|
||||
|
|
@ -112,16 +114,16 @@ ifndef SKIP_CHECK_CLEAN
|
|||
$(if $(shell git status --porcelain),$(error Git status is not clean! Please commit or checkout/reset changes.))
|
||||
endif
|
||||
|
||||
# Create release build tarballs for all supported platforms. Linux compilation happens under Docker.
|
||||
release: check-clean generate-statik
|
||||
# Create release build tarballs for all supported platforms. DEPRECATED: Use `docker-release`
|
||||
release: check-clean generate-statik-docker
|
||||
$(MAKE) release-build GOOS=darwin GOARCH=amd64
|
||||
$(MAKE) release-build GOOS=linux GOARCH=amd64 $(if $(IS_MACOS),DOCKER_BUILD=1)
|
||||
$(MAKE) release-build GOOS=linux GOARCH=amd64
|
||||
|
||||
# Create release build tarballs for all supported platforms. Same as `release`, but without embedded Lattice UI.
|
||||
release-sans-ui: check-clean
|
||||
rm -f statik/statik.go
|
||||
$(MAKE) release-build GOOS=darwin GOARCH=amd64
|
||||
$(MAKE) release-build GOOS=linux GOARCH=amd64 $(if $(IS_MACOS),DOCKER_BUILD=1)
|
||||
$(MAKE) release-build GOOS=linux GOARCH=amd64
|
||||
|
||||
# try (e.g.) internal/clustertests/docker-compose-replication2.yml
|
||||
DOCKER_COMPOSE=internal/clustertests/docker-compose.yml
|
||||
|
|
@ -141,28 +143,21 @@ clustertests-build: vendor
|
|||
docker-compose -f $(DOCKER_COMPOSE) down -v
|
||||
docker-compose -f $(DOCKER_COMPOSE) up --exit-code-from=client1 --build
|
||||
|
||||
# Create prerelease builds
|
||||
prerelease:
|
||||
$(MAKE) release-build GOOS=linux GOARCH=amd64 VERSION_ID=$$\(BRANCH_ID\)
|
||||
$(if $(shell git describe --tags --exact-match HEAD),$(MAKE) release)
|
||||
|
||||
prerelease-upload:
|
||||
aws s3 sync build/ s3://build.pilosa.com/ --exclude "*" --include "*.tar.gz" --acl public-read
|
||||
|
||||
# Install Pilosa
|
||||
install:
|
||||
go install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa
|
||||
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa
|
||||
|
||||
install-bench:
|
||||
go install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-bench
|
||||
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-bench
|
||||
|
||||
# Ensure lattice is cloned and the pinned version is checked out
|
||||
lattice:
|
||||
git submodule update --init
|
||||
|
||||
# Build the lattice assets
|
||||
build-lattice: lattice require-yarn
|
||||
cd lattice && yarn install && yarn build
|
||||
build-lattice: lattice
|
||||
docker build -t lattice:build ./lattice
|
||||
export LATTICE=`docker create lattice:build`; docker cp $$LATTICE:/lattice/. ./lattice/build && docker rm $$LATTICE
|
||||
|
||||
# Upgrade lattice to the latest version
|
||||
upgrade-lattice: lattice
|
||||
|
|
@ -170,15 +165,19 @@ upgrade-lattice: lattice
|
|||
|
||||
# `go generate` protocol buffers
|
||||
generate-protoc: require-protoc require-protoc-gen-gofast
|
||||
go generate github.com/pilosa/pilosa/v2/internal
|
||||
$(GO) generate github.com/pilosa/pilosa/v2/internal
|
||||
|
||||
# `go generate` statik assets (lattice UI)
|
||||
generate-statik: build-lattice require-statik
|
||||
go generate github.com/pilosa/pilosa/v2/statik
|
||||
$(GO) generate github.com/pilosa/pilosa/v2/statik
|
||||
|
||||
# `go generate` statik assets (lattice UI) in Docker
|
||||
generate-statik-docker: build-lattice
|
||||
docker run --rm -t -v $(PWD):/pilosa golang:1.15.8 sh -c "go get github.com/rakyll/statik && /go/bin/statik -src=/pilosa/lattice/build -dest=/pilosa -f"
|
||||
|
||||
# `go generate` stringers
|
||||
generate-stringer:
|
||||
go generate github.com/pilosa/pilosa/v2
|
||||
$(GO) generate github.com/pilosa/pilosa/v2
|
||||
|
||||
generate-pql: require-peg
|
||||
cd pql && peg -inline pql.peg && cd ..
|
||||
|
|
@ -195,28 +194,49 @@ generate-proto-grpc: require-protoc require-protoc-gen-go
|
|||
# `go generate` all needed packages
|
||||
generate: generate-protoc generate-statik generate-stringer generate-pql
|
||||
|
||||
# Create release using Docker
|
||||
docker-release:
|
||||
$(MAKE) docker-build GOOS=linux GOARCH=amd64
|
||||
$(MAKE) docker-build GOOS=darwin GOARCH=amd64
|
||||
|
||||
# Build a release in Docker
|
||||
docker-build: vendor lattice
|
||||
docker build \
|
||||
--build-arg GO_VERSION=$(GO_VERSION) \
|
||||
--build-arg MAKE_FLAGS="TRIAL_DEADLINE=$(TRIAL_DEADLINE) GOOS=$(GOOS) GOARCH=$(GOARCH)" \
|
||||
--target pilosa-builder \
|
||||
--tag pilosa:build .
|
||||
docker create --name pilosa-build pilosa:build
|
||||
mkdir -p build/pilosa-$(VERSION_ID)
|
||||
docker cp pilosa-build:/pilosa/build/. ./build/pilosa-$(VERSION_ID)
|
||||
cp NOTICE LICENSE ./build/pilosa-$(VERSION_ID)
|
||||
docker rm pilosa-build
|
||||
tar -cvz -C build -f build/pilosa-$(VERSION_ID).tar.gz pilosa-$(VERSION_ID)/
|
||||
|
||||
# Create Docker image from Dockerfile
|
||||
docker: vendor
|
||||
docker build --build-arg BUILD_FLAGS="${FLAGS}" -t "pilosa:$(VERSION)" .
|
||||
docker-image: vendor lattice
|
||||
docker build \
|
||||
--build-arg GO_VERSION=$(GO_VERSION) \
|
||||
--build-arg MAKE_FLAGS="TRIAL_DEADLINE=$(TRIAL_DEADLINE)" \
|
||||
--tag pilosa:$(VERSION) .
|
||||
@echo Created docker image: pilosa:$(VERSION)
|
||||
|
||||
# Create docker image (alias)
|
||||
docker: docker-image # alias
|
||||
|
||||
# Tag and push a Docker image
|
||||
docker-tag-push: vendor
|
||||
docker tag "pilosa:$(VERSION)" $(DOCKER_TARGET)
|
||||
docker push $(DOCKER_TARGET)
|
||||
@echo Pushed docker image: $(DOCKER_TARGET)
|
||||
|
||||
# Compile Pilosa inside Docker container
|
||||
docker-build: vendor
|
||||
docker run --rm -v $(PWD):/go/src/$(CLONE_URL) -w /go/src/$(CLONE_URL) -e GOOS=$(GOOS) -e GOARCH=$(GOARCH) golang:$(GO_VERSION) make build FLAGS="$(FLAGS) -mod=vendor" RELEASE=$(RELEASE)
|
||||
|
||||
# Install diagnostic pilosa-keydump tool. Allows viewing the keys in a transaction-engine directory.
|
||||
pilosa-keydump:
|
||||
go install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-keydump
|
||||
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-keydump
|
||||
|
||||
# Install diagnostic pilosa-chk tool for string translations and fragment checksums.
|
||||
pilosa-chk:
|
||||
go install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-chk
|
||||
$(GO) install -tags='$(BUILD_TAGS)' -ldflags $(LDFLAGS) $(FLAGS) ./cmd/pilosa-chk
|
||||
|
||||
pilosa-fsck:
|
||||
cd ./cmd/pilosa-fsck && make install && make release
|
||||
|
|
@ -230,13 +250,13 @@ docker-test:
|
|||
# The \-\-\- FAIL avoids counting the extra two FAIL strings at then bottom of log.topt.
|
||||
topt:
|
||||
mv log.topt.roar log.topt.roar.prev || true
|
||||
$(eval SHELL:=/bin/bash) set -o pipefail; go test -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.roar
|
||||
$(eval SHELL:=/bin/bash) set -o pipefail; $(GO) test -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.roar
|
||||
@echo " log.topt.roar green: \c"; cat log.topt.roar | grep PASS |wc -l
|
||||
@echo " log.topt.roar red: \c"; cat log.topt.roar | grep '\-\-\- FAIL' | wc -l
|
||||
|
||||
topt-race:
|
||||
mv log.topt.race log.topt.race.prev || true
|
||||
$(eval SHELL:=/bin/bash) set -o pipefail; CGO_ENABLED=1 go test -race -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.race
|
||||
$(eval SHELL:=/bin/bash) set -o pipefail; CGO_ENABLED=1 $(GO) test -race -v -tags='$(BUILD_TAGS) $(TEST_TAGS)' $(TESTFLAGS) 2>&1 | tee log.topt.race
|
||||
@echo " log.topt.race green: \c"; cat log.topt.race | grep PASS |wc -l
|
||||
@echo " log.topt.race red: \c"; cat log.topt.race | grep '\-\-\- FAIL' | wc -l
|
||||
|
||||
|
|
@ -295,27 +315,27 @@ install-statik:
|
|||
go get -u github.com/rakyll/statik
|
||||
|
||||
install-stringer:
|
||||
GO111MODULE=off go get -u golang.org/x/tools/cmd/stringer
|
||||
GO111MODULE=off $(GO) get -u golang.org/x/tools/cmd/stringer
|
||||
|
||||
install-protoc-gen-gofast:
|
||||
GO111MODULE=off go get -u github.com/gogo/protobuf/protoc-gen-gofast
|
||||
GO111MODULE=off $(GO) get -u github.com/gogo/protobuf/protoc-gen-gofast
|
||||
|
||||
install-protoc-gen-go:
|
||||
GO111MODULE=off go get -u github.com/golang/protobuf/protoc-gen-go
|
||||
GO111MODULE=off $(GO) get -u github.com/golang/protobuf/protoc-gen-go
|
||||
|
||||
install-protoc:
|
||||
@echo This tool cannot automatically install protoc. Please download and install protoc from https://google.github.io/proto-lens/installing-protoc.html
|
||||
|
||||
install-peg:
|
||||
GO111MODULE=off go get github.com/pointlander/peg
|
||||
GO111MODULE=off $(GO) get github.com/pointlander/peg
|
||||
|
||||
install-golangci-lint:
|
||||
GO111MODULE=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
GO111MODULE=off $(GO) get github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
install-gometalinter:
|
||||
GO111MODULE=off go get -u github.com/alecthomas/gometalinter
|
||||
GO111MODULE=off $(GO) get -u github.com/alecthomas/gometalinter
|
||||
GO111MODULE=off gometalinter --install
|
||||
GO111MODULE=off go get github.com/remyoudompheng/go-misc/deadcode
|
||||
GO111MODULE=off $(GO) get github.com/remyoudompheng/go-misc/deadcode
|
||||
|
||||
test-txstore-rbf:
|
||||
PILOSA_TXSRC=rbf $(MAKE) testv-race
|
||||
|
|
|
|||
2
lattice
2
lattice
|
|
@ -1 +1 @@
|
|||
Subproject commit fa773628a276e2590785a87fbc236c7e88ea6284
|
||||
Subproject commit a7c05f2f6aa59d9723403f49de72f5ef0682018a
|
||||
|
|
@ -31,8 +31,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
defaultBindPort = "10101"
|
||||
defaultBindGRPCPort = "20101"
|
||||
defaultBindPort = "10101"
|
||||
defaultBindGRPCPort = "20101"
|
||||
defaultDiagnosticsInterval = 1 * time.Hour
|
||||
)
|
||||
|
||||
// TLSConfig contains TLS configuration
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2017 Pilosa Corp.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// +build !release
|
||||
//
|
||||
// This file sets defaults to be overridden by release.go
|
||||
|
||||
package server
|
||||
|
||||
import "time"
|
||||
|
||||
// defaultDiagnosticsInterval is the default sync frequency diagnostic metrics. A value of 0 disables diagnostics.
|
||||
const defaultDiagnosticsInterval = time.Duration(0)
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2017 Pilosa Corp.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// +build release
|
||||
//
|
||||
// This file sets release-specific variables.
|
||||
|
||||
package server
|
||||
|
||||
import "time"
|
||||
|
||||
// defaultDiagnosticsInterval is the default sync frequency diagnostic metrics.
|
||||
const defaultDiagnosticsInterval = 1 * time.Hour
|
||||
Loading…
Add table
Reference in a new issue