mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
Switch Serverless from using BoltDB to Postgres as metadata store. Previously, the controller stored all metadata to BoltDB. This implements SQLDB (currently Postgres flavored) as the backing store for metadata. This will allow us to have multiple instances of the controller running for HA, and to easily inspect and repair the contents of the metadata store. Unfortunately, it was not straightforward to keep the BoltDB implementation working alongside the SQL one, so it will be removed in a later patch. Once that's done, the SQL implementation should allow for a number of simplifications of the schemar and balancer interfaces. Database migration is built directly into the application by embedding the migration files and logic from the `soda` command line tool. When connecting to the RDBMS, the app will always attempt to create the necessary database and apply any outstanding migrations. Integration tests truncate all tables upon start, but *not* at the end, so the state of the database can be inspected after integration tests. Had to refactor some of the controller's background tasks to make sure they get properly shut down on controller exit.
96 lines
2.8 KiB
Makefile
96 lines
2.8 KiB
Makefile
.PHONY: test testv test-integration testv-integration
|
|
|
|
MCLOUD_ENV ?= sandbox
|
|
MCLOUD_ENV_FILE=.env.$(MCLOUD_ENV)
|
|
-include $(MCLOUD_ENV_FILE)
|
|
|
|
|
|
GO=go
|
|
|
|
test:
|
|
$(GO) test ./... -short
|
|
|
|
testv:
|
|
$(GO) test -v ./... -short
|
|
|
|
test-integration:
|
|
mkdir -p ../coverage-from-docker
|
|
$(GO) test ./test/dax -count 1 -timeout 20m -run TestDAXIntegration/$(RUN)
|
|
|
|
testv-integration:
|
|
$(GO) test -v ./test/dax -count 1 -timeout 20m -run TestDAXIntegration/$(RUN)
|
|
|
|
######################## Postgres Backend Stuff #########################
|
|
|
|
run-postgres:
|
|
mkdir -p $(HOME)/pgdata
|
|
docker run -p 5432:5432 -v $(HOME)/pgdata:/var/lib/postgresql/data:Z -e POSTGRES_PASSWORD=testpass --user=$(shell id -u) postgres:14.7 -c log_min_duration_statement=0
|
|
|
|
############################### AWS STUFF ###############################
|
|
|
|
AWS_REGION ?=
|
|
AWS_PROFILE ?=
|
|
|
|
AWS = aws --profile=$(AWS_PROFILE) --region=$(AWS_REGION)
|
|
|
|
# After pushing new images, use "make redeploy-ecs" to redeploy all DAX services.
|
|
redeploy-ecs: redeploy-svc-mds redeploy-svc-computer redeploy-svc-queryer
|
|
|
|
redeploy-svc-%:
|
|
$(AWS) ecs update-service --cluster DAX --service $*-$(MCLOUD_ENV)-ecs-service --force-new-deployment --no-cli-pager
|
|
|
|
|
|
# Scale changes the desired count of the computer service. e.g. "make scale N=4"
|
|
scale:
|
|
$(AWS) ecs update-service --cluster DAX --service computer-$(MCLOUD_ENV)-ecs-service --desired-count=$(N) --no-cli-pager
|
|
|
|
|
|
I ?= 0
|
|
# Get a shell on a running contianer. e.g. "make mds-shell", "make datagen-shell", etc.
|
|
%-shell:
|
|
$(eval TASK_ARN := $(shell $(AWS) ecs list-tasks --cluster=DAX --family=$*-family | jq -r .taskArns[$(I)]))
|
|
$(AWS) ecs execute-command --cluster=DAX --task=$(TASK_ARN) --command=/bin/sh --interactive
|
|
|
|
datagen: task-arn-datagen
|
|
$(eval TASK_ARN := $(shell $(AWS) ecs list-tasks --cluster=DAX --family=$*-family | jq -r .taskArns[$(I)]))
|
|
$(AWS) ecs run-task --cluster=DAX --task-definition=$(TASK_ARN) --cli-input-json=file://./datagen_task_input.json --no-cli-pager --enable-execute-command
|
|
|
|
|
|
####################### docker-compose stuff ##############################3
|
|
|
|
|
|
dc-reset: dc-prereqs dc-down
|
|
rm -rf ./dax-data/{snapshotter,writelogger}/*
|
|
|
|
dc-build:
|
|
cd .. && $(MAKE) build-for-quick
|
|
docker-compose build
|
|
|
|
dc-up:
|
|
docker-compose up -d
|
|
|
|
dc-down:
|
|
docker-compose down
|
|
|
|
dc-full-reup: dc-reset dc-build dc-up
|
|
|
|
dc-logs:
|
|
docker-compose logs -f
|
|
|
|
dc-logs-%:
|
|
docker-compose logs -f $*
|
|
|
|
dc-prereqs:
|
|
mkdir -p ../.quick
|
|
|
|
dc-cli:
|
|
featurebase cli --host localhost --port 8080 --org-id=testorg --db-id=testdb
|
|
|
|
# This is just an example. For it to work, you'll first need to:
|
|
# featurebase cli --host localhost --port 8080 --org-id=testorg --db-id=testdb
|
|
# create table keysidstbl2 (_id string, slice idset);
|
|
dc-datagen:
|
|
docker-compose run datagen --end-at=500 --pilosa.batch-size=500 --featurebase.table-name=keysidstbl2
|
|
|
|
dc-exec-%:
|
|
docker-compose exec $* /bin/sh
|