-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (49 loc) · 1.96 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
include .env
run:
@go run cmd/http/main.go
migrate:
@go run cmd/http/main.go migrate
seed:
@go run cmd/http/main.go seed
#run dev server docker compose with specific env file up
dev_server_up:
@docker-compose -f docker-compose.dev.yml --env-file .env.development up -d
#remove dev docker-compose running server
dev_server_down:
@docker-compose -f docker-compose.dev.yml down
#run production server docker compose with specific env file up
production_server_up:
@docker-compose -f docker-compose.prod.yml --env-file .env.production up -d
#remove production docker-compose running server
production_server_down:
@docker-compose -f docker-compose.prod.yml down
date:
@date +%Y%m%d%H%M%S
migration-up:
@sql-migrate up -env=production -config=internal/database/mysql/dbconfig.yml
migration-down:
@sql-migrate down -env=production -config=internal/database/mysql/dbconfig.yml -limit=1
migration-status:
@sql-migrate status -env=production -config=internal/database/mysql/dbconfig.yml
#doc: https://github.com/golang-migrate/migrate
#generate dbconfig.yml
# this dbconfig.yml file is necessary when you want use sql-migrator pkg to migration-up and down
generate-sql-migrator-dbconfig:
@echo "production:\
\n dialect: mysql\
\n datasource: ${MYSQL_USER}:${MYSQL_PASSWORD}@(${MYSQL_HOSTNAME}:${MYSQL_PORT})/${MYSQL_DB}?parseTime=true\
\n dir: internal/database/mysql/migrations #migration director\
\n table: migrations" > internal/database/mysql/dbconfig.yml
# start schedule system using asynq pkg
start-schedule:
@go run ./cmd/job/scheduler/main.go
# start worker which is responsible to execute tasks
start-worker:
@go run ./cmd/job/worker/main.go
# start minio server
minio_run :
@docker run -p 9000:9000 -p 9001:9001 --name my_golang_minio \
-v /data:/data \
-e "MINIO_ROOT_USER=vivify" \
-e "MINIO_ROOT_PASSWORD=vivify" \
minio/minio:RELEASE.2024-05-01T01-11-10Z server /data --console-address ":9001"