第一版完成
This commit is contained in:
59
hack/config.yaml
Normal file
59
hack/config.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
# 服务配置
|
||||
server:
|
||||
address: ":8080"
|
||||
serverRoot: "resource/public"
|
||||
indexFiles: ["index.html"]
|
||||
accessLogEnabled: true
|
||||
errorLogEnabled: true
|
||||
pprofEnabled: true
|
||||
|
||||
# 数据库配置
|
||||
database:
|
||||
default:
|
||||
host: "127.0.0.1"
|
||||
port: "3306"
|
||||
user: "root"
|
||||
pass: "root"
|
||||
name: "cc_cms_gf"
|
||||
type: "mysql"
|
||||
role: "master"
|
||||
debug: true
|
||||
prefix: ""
|
||||
dryRun: false
|
||||
maxIdle: 10
|
||||
maxOpen: 100
|
||||
maxLifetime: "30s"
|
||||
|
||||
# Redis配置
|
||||
redis:
|
||||
default:
|
||||
address: "127.0.0.1:6379"
|
||||
db: 0
|
||||
pass: ""
|
||||
maxIdle: 10
|
||||
maxActive: 100
|
||||
idleTimeout: "60s"
|
||||
maxConnLifetime: "60s"
|
||||
|
||||
# JWT配置
|
||||
jwt:
|
||||
signingKey: "cms_jwt_signing_key_2024"
|
||||
expire: 7200 # 2小时,单位秒
|
||||
|
||||
# 日志配置
|
||||
logger:
|
||||
path: "storage/logs"
|
||||
level: "all"
|
||||
stdout: true
|
||||
rotateSize: "100M"
|
||||
rotateExpire: "7d"
|
||||
rotateBackupLimit: 10
|
||||
rotateBackupExpire: "30d"
|
||||
rotateBackupCompress: 9
|
||||
rotateCheckInterval: "1h"
|
||||
|
||||
# 文件上传配置
|
||||
upload:
|
||||
path: "storage/uploads"
|
||||
maxSize: "10M"
|
||||
allowedTypes: ["jpg", "jpeg", "png", "gif", "pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "zip", "rar"]
|
||||
20
hack/hack-cli.mk
Normal file
20
hack/hack-cli.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
# Install/Update to the latest CLI tool.
|
||||
.PHONY: cli
|
||||
cli:
|
||||
@set -e; \
|
||||
wget -O gf \
|
||||
https://github.com/gogf/gf/releases/latest/download/gf_$(shell go env GOOS)_$(shell go env GOARCH) && \
|
||||
chmod +x gf && \
|
||||
./gf install -y && \
|
||||
rm ./gf
|
||||
|
||||
|
||||
# Check and install CLI tool.
|
||||
.PHONY: cli.install
|
||||
cli.install:
|
||||
@set -e; \
|
||||
gf -v > /dev/null 2>&1 || if [[ "$?" -ne "0" ]]; then \
|
||||
echo "GoFame CLI is not installed, start proceeding auto installation..."; \
|
||||
make cli; \
|
||||
fi;
|
||||
75
hack/hack.mk
Normal file
75
hack/hack.mk
Normal file
@@ -0,0 +1,75 @@
|
||||
.DEFAULT_GOAL := build
|
||||
|
||||
# Update GoFrame and its CLI to latest stable version.
|
||||
.PHONY: up
|
||||
up: cli.install
|
||||
@gf up -a
|
||||
|
||||
# Build binary using configuration from hack/config.yaml.
|
||||
.PHONY: build
|
||||
build: cli.install
|
||||
@gf build -ew
|
||||
|
||||
# Parse api and generate controller/sdk.
|
||||
.PHONY: ctrl
|
||||
ctrl: cli.install
|
||||
@gf gen ctrl
|
||||
|
||||
# Generate Go files for DAO/DO/Entity.
|
||||
.PHONY: dao
|
||||
dao: cli.install
|
||||
@gf gen dao
|
||||
|
||||
# Parse current project go files and generate enums go file.
|
||||
.PHONY: enums
|
||||
enums: cli.install
|
||||
@gf gen enums
|
||||
|
||||
# Generate Go files for Service.
|
||||
.PHONY: service
|
||||
service: cli.install
|
||||
@gf gen service
|
||||
|
||||
|
||||
# Build docker image.
|
||||
.PHONY: image
|
||||
image: cli.install
|
||||
$(eval _TAG = $(shell git rev-parse --short HEAD))
|
||||
ifneq (, $(shell git status --porcelain 2>/dev/null))
|
||||
$(eval _TAG = $(_TAG).dirty)
|
||||
endif
|
||||
$(eval _TAG = $(if ${TAG}, ${TAG}, $(_TAG)))
|
||||
$(eval _PUSH = $(if ${PUSH}, ${PUSH}, ))
|
||||
@gf docker ${_PUSH} -tn $(DOCKER_NAME):${_TAG};
|
||||
|
||||
|
||||
# Build docker image and automatically push to docker repo.
|
||||
.PHONY: image.push
|
||||
image.push: cli.install
|
||||
@make image PUSH=-p;
|
||||
|
||||
|
||||
# Deploy image and yaml to current kubectl environment.
|
||||
.PHONY: deploy
|
||||
deploy: cli.install
|
||||
$(eval _TAG = $(if ${TAG}, ${TAG}, develop))
|
||||
|
||||
@set -e; \
|
||||
mkdir -p $(ROOT_DIR)/temp/kustomize;\
|
||||
cd $(ROOT_DIR)/manifest/deploy/kustomize/overlays/${_ENV};\
|
||||
kustomize build > $(ROOT_DIR)/temp/kustomize.yaml;\
|
||||
kubectl apply -f $(ROOT_DIR)/temp/kustomize.yaml; \
|
||||
if [ $(DEPLOY_NAME) != "" ]; then \
|
||||
kubectl patch -n $(NAMESPACE) deployment/$(DEPLOY_NAME) -p "{\"spec\":{\"template\":{\"metadata\":{\"labels\":{\"date\":\"$(shell date +%s)\"}}}}}"; \
|
||||
fi;
|
||||
|
||||
|
||||
# Parsing protobuf files and generating go files.
|
||||
.PHONY: pb
|
||||
pb: cli.install
|
||||
@gf gen pb
|
||||
|
||||
# Generate protobuf files for database tables.
|
||||
.PHONY: pbentity
|
||||
pbentity: cli.install
|
||||
@gf gen pbentity
|
||||
Reference in New Issue
Block a user