Files
online-backend/Makefile
GuwandykA 28509eb4ca
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
Add backups, currencies and dashboard APIs, and scope access by guard_name.
Web users may only CRUD their own records, operators stay in assigned branches, and admin/manager/superadmin keep full access.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-31 18:14:47 +05:00

42 lines
1.6 KiB
Makefile
Executable File

# Dependencies
dependencies:
docker-compose -f ./deployment/dependencies/docker-compose.yaml up -d
# Database
create-migration:
migrate create -ext sql -dir db/migrations -tz Local init
# --- for Macos
migrate:
migrate -database 'postgres://bank_admin:bank%40%2323%23%40_password@localhost:5424/bank_db?sslmode=disable' -path db/migrations up
migrate-rollback:
migrate -database 'postgres://bank_admin:bank%40%2323%23%40_password@localhost:5424/bank_db?sslmode=disable' -path db/migrations down
seed:
docker exec -i main-db psql -U bank_admin -d bank_db -f - < db/mock/seed.sql
# ---- for linux
# migrate:
# migrate -database 'postgresql://bank_admin:bank%40%2323%23%40_password@localhost:5454/bank_db?sslmode=disable' -path db/migrations up
# migrate-rollback:
# migrate -database 'postgresql://bank_admin:bank%40%2323%23%40_password@localhost:5454/bank_db?sslmode=disable' -path db/migrations down
# ---------------------------------------------------------------------------
# Deploy: build + upload only (PM2-ni serwerde özüň restart et)
# ---------------------------------------------------------------------------
DEPLOY_HOST ?= ubuntu@216.250.10.141
DEPLOY_DIR ?= /home/ubuntu
BINARY ?= myapp
.PHONY: build-linux deploy swagger
swagger:
swag init -g app.go
build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o $(BINARY) ./app.go
deploy: build-linux
ssh $(DEPLOY_HOST) 'mkdir -p $(DEPLOY_DIR)'
scp ./$(BINARY) $(DEPLOY_HOST):$(DEPLOY_DIR)/$(BINARY).new
ssh $(DEPLOY_HOST) 'cd $(DEPLOY_DIR) && chmod +x $(BINARY).new && mv $(BINARY).new $(BINARY)'