@contiamo/dev
Version:
Dev enviromnent for contiamo
88 lines (74 loc) • 3.21 kB
Plain Text
STUNNEL_KEY_FILE = config/pg-stunnel/cert/tls.key
.PHONY: help
help:
@echo "Contiamo local development environment."
@echo
@echo "Commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
@echo 'To get started,'
@echo ' - run `make docker-auth` to configure Docker to pull images from Google Container Repository'
@echo ' - run `make build` to configure Docker to pull images from Google Container Repository'
TIMEOUT=5
.PHONY: changelog
changelog: ## Print git hitstory based changelog
@git --no-pager log --no-merges --pretty=format:"%h : %s (by %an)" $(shell git describe --tags --abbrev=0)...HEAD
@echo ""
.PHONY: clean
clean: ## Stop the environment and remove volumes
docker-compose down -v -t ${TIMEOUT}
.PHONY: docker-auth
docker-auth:
gcloud auth login
gcloud auth configure-docker
.PHONY: pull
pull: ## Pull the latest Docker images
@docker-compose pull datastore ui auth pantheon profiler hub graphql
@echo "Successfully pulled images. Checking that git here is up to date..."
@git fetch
@if ! git merge-base --is-ancestor origin/master HEAD; \
then echo; echo " ⚠️ You are not up to date with remote master. Consider running git pull."; echo; false; \
else echo "Up to date."; fi
.PHONY: repro
repro: ## Compute the exact image digests that are used in the current setup.
@docker-compose config --resolve-image-digests \
| scripts/yaml2json.sh \
| jq -r '{version, services: (.services|map_values({image}))}' \
| scripts/json2yaml.sh
.PHONY: build
build:
cd pantheon-redir && docker build -t eu.gcr.io/dev-and-test-env/pantheon:redir .
.PHONY: get-pg-key
get-pg-key:
kubectl get secret wildcard.dev.contiamo.io-tls -o json |jq -r '.data["tls.key"] | @base64d' > "${STUNNEL_KEY_FILE}"
.PHONY: start
start: ## Run the local dev environment on http://localhost:9898
@docker-compose up -d -t ${TIMEOUT} --force-recreate --remove-orphans \
&& echo "" \
&& printf '%-10s %s\n' 'Tracing ui:' 'http://localhost:16686/search' \
&& printf '%-10s %s\n' 'Dev ui:' 'http://localhost:9898/contiamo/profile' \
&& printf '%-10s %s\n' 'Email:' 'lemon@example.com' \
&& printf '%-10s %s\n' 'Password:' 'localdev' \
&& if test -f "${STUNNEL_KEY_FILE}"; \
then printf '%-10s %s\n' "stunnel:" "✅ configured for pg protocol at localhost:5435" ; \
else printf '%-10s %s\n' "stunnel:" "❌ not configured"; fi
.PHONY: pantheon-start
pantheon-start: ## Run the local dev environment on http://localhost:9898, redirecting to local Pantheon
@env PANTHEON_TAG=redir make start
@echo
@echo "Ingress is proxying"
@echo " - http://localhost:9898/pantheon/api/v1/* to http://localhost:4300/api/v1/* ."
@echo " - http://localhost:9898/pantheon/jdbc/* to http://localhost:8765/* ."
.PHONY: stop
stop: ## Stop the running docker container
docker-compose down -t ${TIMEOUT}
.PHONY: test
test: ## run the Hub API end-to-end tests
docker run \
--net dev_default \
-e BASE_URL=http://nginx \
-v $(shell pwd)/tests/integration:/test \
-v /tmp/go-pkg:/go/pkg \
-v /tmp/go-build:/root/.cache/go-build \
-w /test \
golang:1.13 go test -v -count 1 ./...