2024-08-04 14:25:16 +00:00
|
|
|
STRIPE_SECRET=$(shell sed '2q;d' cred.txt)
|
2024-08-19 19:39:36 +00:00
|
|
|
STRIPE_KEY=$(shell sed '1q;d' cred.txt)
|
2024-08-04 14:25:16 +00:00
|
|
|
GOSTRIPE_PORT=4000
|
|
|
|
API_PORT=4001
|
2024-08-06 19:18:32 +00:00
|
|
|
DSN=vinchent:secret@tcp(localhost:3306)/widgets?parseTime=true&tls=false
|
2024-08-04 14:25:16 +00:00
|
|
|
|
|
|
|
## build: builds all binaries
|
2024-08-26 20:49:10 +00:00
|
|
|
build: clean build_front build_back build_invoice
|
2024-08-04 14:25:16 +00:00
|
|
|
@printf "All binaries built!\n"
|
|
|
|
|
|
|
|
## clean: cleans all binaries and runs go clean
|
|
|
|
clean:
|
|
|
|
@echo "Cleaning..."
|
|
|
|
@- rm -f dist/*
|
|
|
|
@go clean
|
|
|
|
@echo "Cleaned!"
|
|
|
|
|
2024-08-26 20:49:10 +00:00
|
|
|
## build_invoice: builds the invoice microservice
|
|
|
|
build_invoice:
|
|
|
|
@echo "Building invoice microservice..."
|
|
|
|
@go build -o dist/invoice ./cmd/micro/invoice
|
|
|
|
@echo "Invoice microservice built!"
|
|
|
|
|
2024-08-04 14:25:16 +00:00
|
|
|
## build_front: builds the front end
|
|
|
|
build_front:
|
|
|
|
@echo "Building front end..."
|
|
|
|
@go build -o dist/gostripe ./cmd/web
|
|
|
|
@echo "Front end built!"
|
|
|
|
|
|
|
|
## build_back: builds the back end
|
|
|
|
build_back:
|
|
|
|
@echo "Building back end..."
|
|
|
|
@go build -o dist/gostripe_api ./cmd/api
|
|
|
|
@echo "Back end built!"
|
|
|
|
|
|
|
|
## start: starts front and back end
|
2024-08-26 20:49:10 +00:00
|
|
|
start: start_front start_back start_invoice
|
2024-08-04 14:25:16 +00:00
|
|
|
|
2024-08-26 20:49:10 +00:00
|
|
|
## start_invoice: starts the invoice microservice
|
|
|
|
start_invoice: build_invoice
|
|
|
|
@echo "Starting the invoice microservice..."
|
|
|
|
@./dist/invoice &
|
|
|
|
@echo "invoice microservice running!"
|
|
|
|
|
2024-08-04 14:25:16 +00:00
|
|
|
## start_front: starts the front end
|
|
|
|
start_front: build_front
|
|
|
|
@echo "Starting the front end..."
|
|
|
|
@env STRIPE_KEY=${STRIPE_KEY} STRIPE_SECRET=${STRIPE_SECRET} ./dist/gostripe -port=${GOSTRIPE_PORT} -dsn="${DSN}" &
|
|
|
|
@echo "Front end running!"
|
|
|
|
|
|
|
|
## start_back: starts the back end
|
|
|
|
start_back: build_back
|
|
|
|
@echo "Starting the back end..."
|
|
|
|
@env STRIPE_KEY=${STRIPE_KEY} STRIPE_SECRET=${STRIPE_SECRET} ./dist/gostripe_api -port=${API_PORT} -dsn="${DSN}" &
|
|
|
|
@echo "Back end running!"
|
|
|
|
|
|
|
|
## stop: stops the front and back end
|
2024-08-26 20:49:10 +00:00
|
|
|
stop: stop_front stop_back stop_invoice
|
2024-08-04 14:25:16 +00:00
|
|
|
@echo "All applications stopped"
|
|
|
|
|
2024-08-26 20:49:10 +00:00
|
|
|
## stop_invoice: stops the invoice microservice
|
|
|
|
stop_invoice:
|
|
|
|
@echo "Stopping the invoice microservice..."
|
|
|
|
@-pkill -SIGTERM -f "invoice"
|
|
|
|
@echo "Stopped invoice microservice"
|
|
|
|
|
2024-08-04 14:25:16 +00:00
|
|
|
## stop_front: stops the front end
|
|
|
|
stop_front:
|
|
|
|
@echo "Stopping the front end..."
|
|
|
|
@-pkill -SIGTERM -f "gostripe -port=${GOSTRIPE_PORT}"
|
|
|
|
@echo "Stopped front end"
|
|
|
|
|
|
|
|
## stop_back: stops the back end
|
|
|
|
stop_back:
|
|
|
|
@echo "Stopping the back end..."
|
|
|
|
@-pkill -SIGTERM -f "gostripe_api -port=${API_PORT}"
|
|
|
|
@echo "Stopped back end"
|
|
|
|
|