Skip to content

二次开发

开发须知

此文档适合具备一定编程能力基础的人员进行二次开发时的环境搭建

环境依赖

  • Golang 1.18.x及以上
  • Vue 3.x
  • NodeJs 16.14
  • Redis 5.0及以上
  • MySQL 5.7及以上
  • 现代浏览器

安装步骤

项目统一安装在${HOME}/mycode/luban目录下

git clone https://github.com/dnsjia/luban  ${HOME}/mycode

安装依赖

go mod tidy

修改配置文件

cd ${HOME}/mycode/luban/etc
cp config_example.yaml config.yaml
vim config.yaml
...
启动后端
go run cmd/main.go

...
您正在使用config的默认值, 配置路径为etc/config.yaml
2022/05/06 - 17:54:02.779       INFO    /Users/micheng/mycode/luban/common/init_table.go:58   register table success
config.file: etc/ldap.yml
2022/05/06 - 17:54:02.807       INFO    /Users/micheng/mycode/luban/services/job.go:56        SyncJobManager.start
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
 - using env:   export GIN_MODE=release
 - using code:  gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET    /api/v1/luban/ping        --> github.com/dnsjia/luban/routers.User.func1 (5 handlers)
[GIN-debug] GET    /api/v1/luban/pid         --> github.com/dnsjia/luban/routers.User.func2 (5 handlers)
[GIN-debug] GET    /api/v1/luban/addr        --> github.com/dnsjia/luban/routers.User.func3 (5 handlers)
...
...
[GIN-debug] GET    /api/v1/job/tasks         --> github.com/dnsjia/luban/controller.GetJobs (9 handlers)
[GIN-debug] POST   /api/v1/job/task          --> github.com/dnsjia/luban/controller.AddJob (9 handlers)
[GIN-debug] POST   /api/v1/job/taskDetail    --> github.com/dnsjia/luban/controller.TaskDetail (9 handlers)
[GIN-debug] POST   /api/v1/job/job/kill      --> github.com/dnsjia/luban/controller.KillJob (9 handlers)
[GIN-debug] Listening and serving HTTP on :8999
asynq: pid=13592 2022/05/06 09:54:02.850988 INFO: Starting processing
asynq: pid=13592 2022/05/06 09:54:02.851994 INFO: Send signal TERM or INT to terminate the process
2022/05/06 17:54:02 registered an entry: "bf2153ab-7de5-4f5d-9b2e-03c5d6f3778d"
asynq: pid=13592 2022/05/06 09:54:02.854990 INFO: Scheduler starting
asynq: pid=13592 2022/05/06 09:54:02.855996 INFO: Scheduler timezone is set to UTC
asynq: pid=13592 2022/05/06 09:54:02.856997 INFO: Send signal TERM or INT to stop the scheduler

安装前端依赖

cd ${HOME}/mycode/luban/luban_fe
npm install --registry=https://registry.npm.taobao.org

启动前端

npm run dev

...
  App running at:
  - Local:   http://localhost:8080/
  - Network: http://192.168.1.254:8080/

  Note that the development build is not optimized.
  To create a production build, run npm run build.

Back to top