33install : bins
44
55# Rebuild binaries (used by Dockerfile).
6- bins : temporal-server temporal-cassandra-tool temporal-sql-tool tdbg
6+ bins : temporal-server temporal-cassandra-tool temporal-sql-tool temporal-elasticsearch-tool tdbg
77
88# Install all tools, recompile proto files, run all possible checks and tests (long but comprehensive).
99all : clean proto bins check test
@@ -270,6 +270,9 @@ $(STAMPDIR)/protoc-gen-go-helpers-$(GO_API_VER): | $(STAMPDIR) $(LOCALBIN)
270270 @touch $@
271271$(PROTOC_GEN_GO_HELPERS ) : $(STAMPDIR ) /protoc-gen-go-helpers-$(GO_API_VER )
272272
273+ $(LOCALBIN ) /protoc-gen-go-chasm : $(LOCALBIN ) cmd/tools/protoc-gen-go-chasm/main.go go.mod go.sum
274+ @go build -o $@ ./cmd/tools/protoc-gen-go-chasm
275+
273276# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
274277# $1 - target path with name of binary (ideally with version)
275278# $2 - package url which can be installed
@@ -300,7 +303,7 @@ $(CHASM_BINPB): $(API_BINPB) $(INTERNAL_BINPB) $(CHASM_PROTO_FILES)
300303 @printf $(COLOR ) " Generate CHASM proto image..."
301304 @protoc --descriptor_set_in=$(API_BINPB ) :$(INTERNAL_BINPB ) -I=. $(CHASM_PROTO_FILES ) -o $@
302305
303- protoc : $(PROTOGEN ) $(MOCKGEN ) $(GOIMPORTS ) $(PROTOC_GEN_GO ) $(PROTOC_GEN_GO_GRPC ) $(PROTOC_GEN_GO_HELPERS ) $(API_BINPB )
306+ protoc : $(PROTOGEN ) $(MOCKGEN ) $(GOIMPORTS ) $(PROTOC_GEN_GO ) $(PROTOC_GEN_GO_GRPC ) $(PROTOC_GEN_GO_HELPERS ) $(API_BINPB ) $( LOCALBIN ) /protoc-gen-go-chasm
304307 @go run ./cmd/tools/protogen \
305308 -root=$(ROOT ) \
306309 -proto-out=$(PROTO_OUT ) \
@@ -309,6 +312,7 @@ protoc: $(PROTOGEN) $(MOCKGEN) $(GOIMPORTS) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRP
309312 -protogen-bin=$(PROTOGEN ) \
310313 -goimports-bin=$(GOIMPORTS ) \
311314 -mockgen-bin=$(MOCKGEN ) \
315+ -protoc-gen-go-chasm-bin=$(LOCALBIN ) /protoc-gen-go-chasm \
312316 -protoc-gen-go-bin=$(PROTOC_GEN_GO ) \
313317 -protoc-gen-go-grpc-bin=$(PROTOC_GEN_GO_GRPC ) \
314318 -protoc-gen-go-helpers-bin=$(PROTOC_GEN_GO_HELPERS ) \
@@ -334,6 +338,7 @@ clean-bins:
334338 @rm -f temporal-cassandra-tool
335339 @rm -f tdbg
336340 @rm -f temporal-sql-tool
341+ @rm -f temporal-elasticsearch-tool
337342
338343temporal-server : $(ALL_SRC )
339344 @printf $(COLOR ) " Build temporal-server with CGO_ENABLED=$( CGO_ENABLED) for $( GOOS) /$( GOARCH) ..."
@@ -351,6 +356,10 @@ temporal-sql-tool: $(ALL_SRC)
351356 @printf $(COLOR ) " Build temporal-sql-tool with CGO_ENABLED=$( CGO_ENABLED) for $( GOOS) /$( GOARCH) ..."
352357 CGO_ENABLED=$(CGO_ENABLED ) go build $(BUILD_TAG_FLAG ) -o temporal-sql-tool ./cmd/tools/sql
353358
359+ temporal-elasticsearch-tool : $(ALL_SRC )
360+ @printf $(COLOR ) " Build temporal-elasticsearch-tool with CGO_ENABLED=$( CGO_ENABLED) for $( GOOS) /$( GOARCH) ..."
361+ CGO_ENABLED=$(CGO_ENABLED ) go build $(BUILD_TAG_FLAG ) -o temporal-elasticsearch-tool ./cmd/tools/elasticsearch
362+
354363temporal-server-debug : $(ALL_SRC )
355364 @printf $(COLOR ) " Build temporal-server-debug with CGO_ENABLED=$( CGO_ENABLED) for $( GOOS) /$( GOARCH) ..."
356365 CGO_ENABLED=$(CGO_ENABLED ) go build $(BUILD_TAG_FLAG ) ,TEMPORAL_DEBUG -o temporal-server-debug ./cmd/server
@@ -519,22 +528,17 @@ install-schema-postgresql12: temporal-sql-tool
519528 ./temporal-sql-tool -u $(SQL_USER ) --pw $(SQL_PASSWORD ) -p 5432 --pl postgres12 --db $(VISIBILITY_DB ) setup-schema -v 0.0
520529 ./temporal-sql-tool -u $(SQL_USER ) --pw $(SQL_PASSWORD ) -p 5432 --pl postgres12 --db $(VISIBILITY_DB ) update-schema -d ./schema/postgresql/v12/visibility/versioned
521530
522- install-schema-es :
531+ install-schema-es : temporal-elasticsearch-tool
523532 @printf $(COLOR ) " Install Elasticsearch schema..."
524- curl --fail -X PUT " http://127.0.0.1:9200/_cluster/settings" -H " Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/cluster_settings_v7.json --write-out " \n"
525- curl --fail -X PUT " http://127.0.0.1:9200/_template/temporal_visibility_v1_template" -H " Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out " \n"
526- # No --fail here because create index is not idempotent operation.
527- curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_dev" --write-out "\n"
528- # curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_secondary" --write-out "\n"
533+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 setup-schema
534+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev
529535
530- install-schema-es-secondary :
536+ install-schema-es-secondary : temporal-elasticsearch-tool
531537 @printf $(COLOR ) " Install Elasticsearch schema..."
532- curl --fail -X PUT " http://127.0.0.1:8200/_cluster/settings" -H " Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/cluster_settings_v7.json --write-out " \n"
533- curl --fail -X PUT " http://127.0.0.1:8200/_template/temporal_visibility_v1_template" -H " Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out " \n"
534- # No --fail here because create index is not idempotent operation.
535- curl -X PUT "http://127.0.0.1:8200/temporal_visibility_v1_secondary" --write-out "\n"
538+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:8200 setup-schema
539+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:8200 create-index --index temporal_visibility_v1_secondary
536540
537- install-schema-xdc : temporal-cassandra-tool
541+ install-schema-xdc : temporal-cassandra-tool temporal-elasticsearch-tool
538542 @printf $(COLOR ) " Install Cassandra schema (active)..."
539543 ./temporal-cassandra-tool drop -k temporal_cluster_a -f
540544 ./temporal-cassandra-tool create -k temporal_cluster_a --rf 1
@@ -554,15 +558,15 @@ install-schema-xdc: temporal-cassandra-tool
554558 ./temporal-cassandra-tool -k temporal_cluster_c update-schema -d ./schema/cassandra/temporal/versioned
555559
556560 @printf $(COLOR) "Install Elasticsearch schemas..."
557- curl --fail -X PUT " http://127.0.0.1:9200/_cluster/settings" -H "Content-Type: application/json" --data-binary @./ schema/elasticsearch/visibility/cluster_settings_v7.json --write-out "\n"
558- curl --fail -X PUT "http://127.0.0.1:9200/_template/temporal_visibility_v1_template" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out "\n"
559- # No --fail here because create index is not idempotent operation.
560- curl -X DELETE http://localhost :9200/temporal_visibility_v1_dev_cluster_a
561- curl -X DELETE http://localhost :9200/temporal_visibility_v1_dev_cluster_b
562- curl -X DELETE http://localhost:9200/temporal_visibility_v1_dev_cluster_c
563- curl -X PUT " http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_a" --write-out "\n"
564- curl -X PUT " http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_b" --write-out "\n"
565- curl -X PUT " http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_c" --write-out "\n"
561+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 setup- schema
562+ # Delete indices if they exist (drop-index fails silently if index doesn't exist)
563+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 drop-index -- index temporal_visibility_v1_dev_cluster_a --fail
564+ ./temporal-elasticsearch-tool -ep http://127.0.0.1 :9200 drop-index --index temporal_visibility_v1_dev_cluster_b --fail
565+ ./temporal-elasticsearch-tool -ep http://127.0.0.1 :9200 drop-index --index temporal_visibility_v1_dev_cluster_c --fail
566+ # Create indices
567+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_a
568+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_b
569+ ./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_c
566570
567571# #### Run server #####
568572DOCKER_COMPOSE_FILES := -f ./develop/docker-compose/docker-compose.yml -f ./develop/docker-compose/docker-compose.$(GOOS ) .yml
@@ -652,7 +656,7 @@ update-dependencies-major: $(GOMAJOR)
652656
653657go-generate : $(MOCKGEN ) $(GOIMPORTS ) $(STRINGER ) $(GOWRAP )
654658 @printf $(COLOR ) " Process go:generate directives..."
655- @go generate ./...
659+ @PATH= " $( ROOT ) / $( LOCALBIN ) : $( PATH ) " go generate ./...
656660
657661ensure-no-changes :
658662 @printf $(COLOR ) " Check for local changes..."
0 commit comments