-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,65 @@ | ||
# Host Makefile. | ||
# Devcontainer Makefile. | ||
|
||
include Makefile.include | ||
|
||
ifeq ($(PROFILES),) | ||
PROFILES := 'pmm' | ||
endif | ||
release-dev-managed: ## Build pmm-managed | ||
make -C managed release-dev | ||
|
||
env-up: ## Start devcontainer | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose up -d | ||
release-dev-agent: ## Build pmm-agent | ||
make -C agent release-dev | ||
|
||
env-up-rebuild: env-update-image ## Rebuild and start devcontainer. Useful for custom $PMM_SERVER_IMAGE | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose up --build -d | ||
release-vmproxy: ## Build vmproxy | ||
make -C vmproxy release | ||
|
||
env-update-image: ## Pull latest dev image | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose pull | ||
# used by host Makefile | ||
_bash: | ||
/bin/bash | ||
|
||
env-compose-up: env-update-image | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose up --detach --renew-anon-volumes --remove-orphans | ||
PMM_RELEASE_PATH ?= ./bin | ||
|
||
env-devcontainer: | ||
docker exec -it --workdir=/root/go/src/github.com/percona/pmm pmm-server .devcontainer/setup.py | ||
run-managed: release-dev-managed ## Replace pmm-managed from build, restart and tail logs | ||
supervisorctl stop pmm-managed | ||
cp $(PMM_RELEASE_PATH)/pmm-managed /usr/sbin/pmm-managed | ||
supervisorctl start pmm-managed & | ||
supervisorctl tail -f pmm-managed | ||
|
||
env-down: ## Stop devcontainer | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose down --remove-orphans | ||
run-managed-ci: release-dev-managed ## Replace pmm-managed from build, restart (used in CI) | ||
supervisorctl stop pmm-managed | ||
cp $(PMM_RELEASE_PATH)/pmm-managed /usr/sbin/pmm-managed | ||
supervisorctl start pmm-managed | ||
|
||
env-remove: | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker compose down --volumes --remove-orphans | ||
run-agent: release-dev-agent ## Replace pmm-agent from build and restart | ||
supervisorctl stop pmm-agent | ||
cp $(PMM_RELEASE_PATH)/pmm-agent /usr/sbin/pmm-agent | ||
supervisorctl start pmm-agent | ||
|
||
TARGET ?= _bash | ||
run-vmproxy: release-vmproxy | ||
supervisorctl stop vmproxy | ||
cp $(PMM_RELEASE_PATH)/vmproxy /usr/sbin/vmproxy | ||
supervisorctl start vmproxy | ||
|
||
env: ## Run `make TARGET` in devcontainer (`make env TARGET=help`); TARGET defaults to bash | ||
COMPOSE_PROFILES=$(PROFILES) \ | ||
docker exec -it --workdir=/root/go/src/github.com/percona/pmm pmm-server make $(TARGET) | ||
run-all: run-agent run-managed ## Run pmm-managed and pmm-agent | ||
|
||
update-dbaas-catalog: ## Update the DBaaS catalog from the latest production branch (percona-platform). | ||
wget https://raw.githubusercontent.com/percona/dbaas-catalog/percona-platform/percona-dbaas-catalog.yaml -O managed/data/crds/olm/percona-dbaas-catalog.yaml | ||
run: ## Deprecated | ||
echo "Deprecated: please use run-all" | ||
|
||
# TODO https://jira.percona.com/browse/PMM-3484, see maincover_test.go | ||
# run-race-cover: install-race ## Run pmm-managed with race detector and collect coverage information. | ||
# go test -coverpkg="github.com/percona/pmm/managed/..." \ | ||
# -tags maincover \ | ||
# $(PMM_LD_FLAGS) \ | ||
# -race -c -o bin/pmm-managed.test | ||
# bin/pmm-managed.test -test.coverprofile=cover.out -test.run=TestMainCover $(RUN_FLAGS) | ||
|
||
psql: ## Open database for the pmm-managed instance in psql shell | ||
env PGPASSWORD=pmm-managed psql -U pmm-managed pmm-managed | ||
|
||
psql-test: ## Open database used in unit tests in psql shell | ||
env psql -U postgres pmm-managed-dev | ||
|
||
dlv/attach: ## Attach Delve to `pmm-managed` | ||
dlv --listen=:2345 --headless=true --api-version=2 --accept-multiclient attach $(shell pgrep pmm-managed) | ||
|
||
refresh-swagger: ## Refresh swagger files | ||
cp /root/go/src/github.com/percona/pmm/api/swagger/swagger.json /usr/share/pmm-managed/swagger/swagger.json | ||
cp /root/go/src/github.com/percona/pmm/api/swagger/swagger-dev.json /usr/share/pmm-managed/swagger/swagger-dev.json |