Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facilita START / STOP do projeto com regras no Makefile #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
.DEFAULT_GOAL := help

CONFIG_PATH ?= ./local/config.yaml

CMD_NATS_SERVER_START_BIN := nats-server -a 127.0.0.1 -js &
CMD_NATS_SERVER_STOP_BIN := killall nats-server

CMD_CREATE_PAYMENT_STREAM := nats stream create payments --subjects "payment.process" --storage memory --replicas 1 --retention=limits --discard=old --max-msgs 1_000_000 --max-msgs-per-subject 100_000 --max-bytes 4GiB --max-age 1d --max-msg-size 10MiB --dupe-window 2m --allow-rollup --no-deny-delete --no-deny-purge

CMD_ALL_IN_ONE_START := go run ./cmd/all-in-one/ -config $(CONFIG_PATH)

.PHONY: help
help:
@echo Para construir o projeto, execute:
Expand Down Expand Up @@ -42,6 +51,28 @@ build-subscriptions:
build-plans:
@goreleaser build -f=.goreleaser.yaml --snapshot --clean --single-target --id plans

.PHONY: start
start: start-bin

.PHONY: start-bin
start-bin:
@echo ;
@echo Starting 'nats-server '
$(CMD_NATS_SERVER_START_BIN)
@echo ;
@echo Creating Payment Stream
$(CMD_CREATE_PAYMENT_STREAM)
@echo ;
@echo 'Run project (all in one)'
$(CMD_ALL_IN_ONE_START)

.PHONY: stop
stop:
@echo Stop nats-server
$(CMD_NATS_SERVER_STOP_BIN)
@echo ;


.PHONY: install-tools
install-tools:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
Expand Down