2020-06-09 17:15:34 +08:00
|
|
|
GOPKG ?= moul.io/sshportal
|
|
|
|
GOBINS ?= .
|
|
|
|
DOCKER_IMAGE ?= moul/sshportal
|
|
|
|
|
|
|
|
VERSION ?= `git describe --tags --always`
|
|
|
|
VCS_REF ?= `git rev-parse --short HEAD`
|
|
|
|
GO_INSTALL_OPTS = -ldflags="-X main.GitSha=$(VCS_REF) -X main.GitTag=$(VERSION)"
|
2020-07-05 03:31:28 +08:00
|
|
|
PORT ?= 2222
|
2017-11-14 07:38:23 +08:00
|
|
|
|
2020-06-09 17:15:34 +08:00
|
|
|
include rules.mk
|
2017-11-14 08:13:51 +08:00
|
|
|
|
2020-06-09 17:15:34 +08:00
|
|
|
DB_VERSION ?= v$(shell grep -E 'ID: "[0-9]+",' pkg/bastion/dbinit.go | tail -n 1 | cut -d'"' -f2)
|
|
|
|
AES_KEY ?= my-dummy-aes-key
|
2017-11-15 18:24:57 +08:00
|
|
|
|
|
|
|
.PHONY: integration
|
|
|
|
integration:
|
2018-01-01 16:07:19 +08:00
|
|
|
cd ./examples/integration && make
|
2017-11-15 18:24:57 +08:00
|
|
|
|
2017-11-14 08:13:51 +08:00
|
|
|
.PHONY: _docker_install
|
|
|
|
_docker_install:
|
2018-11-16 17:24:18 +08:00
|
|
|
CGO_ENABLED=1 $(GO) build -ldflags '-extldflags "-static" $(LDFLAGS)' -tags netgo -v -o /go/bin/sshportal
|
2017-10-31 16:31:36 +08:00
|
|
|
|
|
|
|
.PHONY: dev
|
|
|
|
dev:
|
2018-11-16 17:24:18 +08:00
|
|
|
-$(GO) get github.com/githubnemo/CompileDaemon
|
2018-02-28 21:35:06 +08:00
|
|
|
CompileDaemon -exclude-dir=.git -exclude=".#*" -color=true -command="./sshportal server --debug --bind-address=:$(PORT) --aes-key=$(AES_KEY) $(EXTRA_RUN_OPTS)" .
|
2017-11-13 17:13:17 +08:00
|
|
|
|
2017-11-14 16:57:21 +08:00
|
|
|
.PHONY: backup
|
|
|
|
backup:
|
|
|
|
mkdir -p data/backups
|
2020-06-09 17:15:34 +08:00
|
|
|
cp sshportal.db data/backups/$(shell date +%s)-$(DB_VERSION)-sshportal.sqlite
|
2017-12-16 02:48:47 +08:00
|
|
|
|
|
|
|
doc:
|
|
|
|
dot -Tsvg ./.assets/overview.dot > ./.assets/overview.svg
|
|
|
|
dot -Tsvg ./.assets/cluster-mysql.dot > ./.assets/cluster-mysql.svg
|
2017-12-17 17:08:44 +08:00
|
|
|
dot -Tsvg ./.assets/flow-diagram.dot > ./.assets/flow-diagram.svg
|
2019-02-01 19:56:07 +08:00
|
|
|
dot -Tpng ./.assets/overview.dot > ./.assets/overview.png
|
|
|
|
dot -Tpng ./.assets/cluster-mysql.dot > ./.assets/cluster-mysql.png
|
|
|
|
dot -Tpng ./.assets/flow-diagram.dot > ./.assets/flow-diagram.png
|
2019-06-24 16:46:35 +08:00
|
|
|
|
|
|
|
.PHONY: goreleaser
|
|
|
|
goreleaser:
|
|
|
|
GORELEASER_GITHUB_TOKEN=$(GORELEASER_GITHUB_TOKEN) GITHUB_TOKEN=$(GITHUB_TOKEN) goreleaser --rm-dist
|
|
|
|
|
|
|
|
.PHONY: goreleaser-dry-run
|
|
|
|
goreleaser-dry-run:
|
|
|
|
goreleaser --snapshot --skip-publish --rm-dist
|