teleport/Makefile

173 lines
5.8 KiB
Makefile
Raw Normal View History

TCD_NODE1 := http://127.0.0.1:4001
ETCD_NODES := ${ETCD_NODE1}
2015-03-02 20:11:23 +00:00
ETCD_FLAGS := TELEPORT_TEST_ETCD_NODES=${ETCD_NODES}
OUT=out
export GO15VENDOREXPERIMENT=1
2015-03-02 20:11:23 +00:00
.PHONY: install test test-with-etcd remove-temp files test-package update test-grep-package cover-package cover-package-with-etcd run profile sloccount set-etcd install-assets docs-serve
2016-01-17 18:28:34 +00:00
#
2016-02-02 20:14:59 +00:00
# Default target: builds all 3 executables and plaaces them in a current directory
2016-01-17 18:28:34 +00:00
#
2016-02-09 06:29:15 +00:00
.PHONY: tctl
tctl:
go build -o $(OUT)/tctl -i github.com/gravitational/teleport/tool/tctl
.PHONY: teleport
teleport:
rm -rf /var/lib/teleport/assets
cp -r assets/web/assets /var/lib/teleport/
go build -o $(OUT)/teleport -i github.com/gravitational/teleport/tool/teleport
.PHONY: tsh
tsh:
go build -o $(OUT)/tsh -i github.com/gravitational/teleport/tool/tsh
.PHONY: all
all: teleport tctl tsh
2015-12-23 18:41:51 +00:00
2016-01-17 22:50:00 +00:00
install: remove-temp-files
go install github.com/gravitational/teleport/tool/teleport
go install github.com/gravitational/teleport/tool/tctl
go install github.com/gravitational/teleport/tool/tsh
clean:
rm -f $(OUT)
2016-01-17 22:50:00 +00:00
#
# this target is used by Jenkins for production builds
#
.PHONY: production
production: clean
$(MAKE) -C build.assets
test: install
go test -v github.com/gravitational/teleport/lib/... -cover
#go test -v -test.parallel=0 $(shell go list ./... | grep -v /vendor/) -cover
2015-03-02 20:11:23 +00:00
test-with-etcd: install
2016-01-20 15:52:25 +00:00
${ETCD_FLAGS} go test -v -test.parallel=0 $(shell go list ./... | grep -v /vendor/) -cover
2015-03-02 20:11:23 +00:00
2015-05-04 15:28:32 +00:00
remove-temp-files:
2015-03-02 20:11:23 +00:00
find . -name flymake_* -delete
2015-12-24 23:24:47 +00:00
test-package: remove-temp-files install
go test -v -test.parallel=0 ./$(p)
2015-03-02 20:11:23 +00:00
2015-12-24 23:24:47 +00:00
test-package-with-etcd: remove-temp-files install
${ETCD_FLAGS} go test -v -test.parallel=0 ./$(p)
2015-03-02 20:11:23 +00:00
update:
rm -rf Godeps/
find . -iregex .*go | xargs sed -i 's:".*Godeps/_workspace/src/:":g'
godep save -r ./...
2015-12-24 23:24:47 +00:00
test-grep-package: remove-temp-files install
2015-03-02 20:11:23 +00:00
go test -v ./$(p) -check.f=$(e)
2015-05-04 15:28:32 +00:00
cover-package: remove-temp-files
2015-03-02 20:11:23 +00:00
go test -v ./$(p) -coverprofile=/tmp/coverage.out
go tool cover -html=/tmp/coverage.out
2015-05-04 15:28:32 +00:00
cover-package-with-etcd: remove-temp-files
2015-03-02 20:11:23 +00:00
${ETCD_FLAGS} go test -v ./$(p) -coverprofile=/tmp/coverage.out
go tool cover -html=/tmp/coverage.out
pack-teleport: DIR := $(shell mktemp -d)
pack-teleport: pkg teleport
cp assets/build/orbit.manifest.json $(DIR)
mkdir -p $(DIR)/rootfs/usr/bin
2015-10-26 21:36:52 +00:00
mkdir -p $(DIR)/rootfs/usr/bin $(DIR)/rootfs/etc/web-assets/
cp -r ./assets/web/* $(DIR)/rootfs/etc/web-assets/
cp $(GOPATH)/bin/teleport $(DIR)/rootfs/usr/bin
cp $(GOPATH)/bin/tctl $(DIR)/rootfs/usr/bin
2015-11-12 04:25:34 +00:00
gravity package import $(DIR) $(PKG) --check-manifest
rm -rf $(DIR)
pkg:
@if [ "$$PKG" = "" ] ; then echo "ERROR: enter PKG parameter:\n\nmake publish PKG=<name>:<sem-ver>, e.g. teleport:0.0.1\n\n" && exit 255; fi
2015-11-07 04:55:12 +00:00
# run-embedded starts a auth server, ssh node and proxy that allows web access
# to all the nodes
run-embedded: install
teleport --config=examples/embedded.yaml
2015-11-07 04:55:12 +00:00
# run-node starts a ssh node
run-node: install
tctl token generate --output=/tmp/token --domain=localhost
2015-11-07 04:55:12 +00:00
teleport --config=examples/node.yaml
# run-connected-auth1 starts a auth server ready to connect with additional auth server
run-connected-auth1: install
teleport --config=examples/connected-auth1.yaml
# run-connected-auth2 starts a additional auth server, that connects to auth1
run-connected-auth2: install
teleport --config=examples/connected-auth2.yaml
2015-10-29 01:10:09 +00:00
# run-site-to-proxy starts a ssh node, auth server and reverse tunnel that connect outside of
# the organization server
2015-10-29 01:10:09 +00:00
run-site-to-proxy: install
rm -f /tmp/teleport.auth.sock
teleport --config=examples/embedded-proxy.yaml
# run proxy start s
run-proxy: install
rm -f /tmp/teleport.proxy.auth.sock
teleport --config=examples/proxy.yaml
trust-proxy:
# get user and host SSH certificates from proxy's organization, note that we are connecting to proxy's auth server
# that serves proxy's organization certs and not teleport's
tctl --auth=unix:///tmp/teleport.proxy.auth.sock user-ca pub-key > /tmp/user.pubkey
tctl --auth=unix:///tmp/teleport.proxy.auth.sock host-ca pub-key > /tmp/host.pubkey
# add proxy's certs to teleport as trusted remote certificate authorities
tctl remote-ca upsert --type=user --id=user.proxy.vendor.io --domain=proxy.vendor.io --path=/tmp/user.pubkey
tctl remote-ca upsert --type=host --id=host.proxy.vendor.io --domain=proxy.vendor.io --path=/tmp/host.pubkey
2015-09-14 22:40:34 +00:00
tctl remote-ca ls --type=user
tctl remote-ca ls --type=host
# now export teleport's host CA certificate and add it as a trusted cert for proxy
tctl host-ca pub-key > /tmp/teleport.pubkey
tctl --auth=unix:///tmp/teleport.proxy.auth.sock remote-ca upsert --type=host --id=host.auth.gravitational.io --domain=node1.gravitational.io --path=/tmp/teleport.pubkey
tctl --auth=unix:///tmp/teleport.proxy.auth.sock remote-ca ls --type=host
2015-06-29 02:44:07 +00:00
2015-03-02 20:11:23 +00:00
profile:
go tool pprof http://localhost:6060/debug/pprof/profile
sloccount:
find . -path ./Godeps -prune -o -name "*.go" -print0 | xargs -0 wc -l
docs-serve:
sleep 1 && sensible-browser http://127.0.0.1:32567 &
mkdocs serve
docs-update:
echo "# Auth Server Client\n\n" > docs/api.md
echo "[Source file](https://github.com/gravitational/teleport/blob/master/auth/clt.go)" >> docs/api.md
echo '```go' >> docs/api.md
godoc github.com/gravitational/teleport/auth Client >> docs/api.md
echo '```' >> docs/api.md
2016-01-21 06:29:57 +00:00
#
# Deploy teleport server to staging environment on AWS
2016-01-21 06:29:57 +00:00
# WARNING: this step is called by CI/CD. You must execute make production first
.PHONY: deploy
2016-01-21 06:29:57 +00:00
deploy:
ansible-playbook -i deploy/hosts deploy/deploy.yaml
# Prepare a brand new AWS machine to host Teleport (run provision once,
# then run deploy many times)
.PHONY: provision
provision:
ansible-playbook -i deploy/hosts deploy/provision.yaml
2016-01-17 23:14:04 +00:00
.PHONY: jenkins
jenkins:
curl -X POST -d TARGETENV=staging -d BRANCH=$$(git rev-parse --abbrev-ref HEAD) https://jenkins.gravitational.io/buildByToken/buildWithParameters?job=Teleport&token=ZeeYaeYuTh9quiu8eh3rieChohHoor8aib0oopoov0aewah8