Docker¶
从 v1.0.0 (alpha/beta) 开始,Luban 多集群管理要求 Kubernetes >= 1.12 以上版本的集群使用。
Warning
若系统未安装docker, 请参考文档进行安装 https://docs.docker.com/get-docker/
拉取镜像¶
docker pull dnsjia/luban:latest
docker pull registry.cn-hangzhou.aliyuncs.com/dnsjia/mysql:5.7
修改配置文件¶
配置文件示例
-
拷贝源码etc目录下的config_example.yaml配置文件命名为 config.yaml
-
若使用ldap方式登录,请在配置文件中定义ldap搜索域及管理员账号密码
http:
mode: 'private' # Change to "develop" to skip authentication for development mode, change to "private" authentication
listen: 8999
rpc: 40737
jwt: "luban"
# mysql configuration
mysql:
path: 'localhost:3306'
config: 'charset=utf8mb4&parseTime=True&loc=Local'
db-name: 'luban'
username: 'root'
password: '123456'
max-idle-conns: 10
max-open-conns: 100
conn-max-idle-time: 60
conn-max-life-time: 600
log-mode: false
log-zap: ""
redis:
addr: 'localhost:63790'
db: 0
username: ''
password: '123456'
poolSize: 20
dialTimeout:
readTimeout:
writeTimeout:
ldap:
enable: true
host: 172.16.10.13
port: 389
baseDn: "ou=infra,dc=dnsjia,dc=com"
# AD: manange@example.org
bindUser: "cn=admin,dc=dnsjia,dc=com"
bindPass: "123456"
# openldap: (&(uid=%s))
# AD: (&(sAMAccountName=%s))
#authFilter: "(&(uid=%s))"
authFilter: "(&(objectClass=*)(cn=%s))"
attributes:
nickname: "displayName"
email: "mail"
phone: "mobile"
uid: "uidNumber"
coverAttributes: false
autoRegist: true
tls: false
startTLS: false
log:
# stdout, stderr, file
format: 'file'
level: 'INFO'
director: '/data/webapps/luban/logs'
# casbin configuration
casbin:
model-path: './etc/rbac_model.conf'
# cloudSync Task
crontab:
aliyun: "* */2 * * *"
# dingding qrcode
dingtalk:
appid: ''
secret: ''
url: 'https://oapi.dingtalk.com'
# 允许登录的邮箱后缀 test@luban.com [luban.com]
allow-suffix: 'luban.com'
feishu:
deploy: 'https://open.feishu.cn/open-apis/bot/v2/hook/748f7b93-axxxxx'
notice: ''
# 应用诊断网关
giraffe:
token: '951ebc8e-15f1-48d3-af2d-b28def327067'
# giraffe gateway
addr: '127.0.0.1:45459'
monitor:
# docker监控使用
prometheus: 'http://192.168.10.167:9090'
# 对外暴露的端口号
cadvisor-expose-port: '58080'
如何修改资产同步周期
crontab:
aliyun: "*/5 * * * *" # 阿里云资产同步周期
Danger
/opt/luban/mysql 为鲁班数据库目录,删除后将导致数据丢失
mkdir -p /opt/luban/mysql
启动MySQL¶
docker run -itd --name luban-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -v /opt/luban/mysql:/var/lib/mysql registry.cn-hangzhou.aliyuncs.com/dnsjia/mysql:5.7
启动后端¶
docker run -itd --name luban -p 8080:8080 -v /root/luban/etc:/data/luban/etc dnsjia/luban:latest
Success
使用 docker logs luban
查看日志,若显示以下内容则表明安装成功
- 默认账号密码:
guji
/a123456.
您正在使用config的默认值, 配置路径为etc/config.yaml
2022/05/06 - 05:32:55.139 INFO C:/Users/Administrator/Documents/mycode/luban/common/init_table.go:58 register table success
config.file: etc/ldap.yml
[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] Listening and serving HTTP on :8999
asynq: pid=14 2022/05/06 05:32:55.143133 INFO: Starting processing
asynq: pid=14 2022/05/06 05:32:55.143158 INFO: Send signal TSTP to stop processing new tasks
asynq: pid=14 2022/05/06 05:32:55.143163 INFO: Send signal TERM or INT to terminate the process
2022/05/06 - 05:32:55.143 INFO C:/Users/Administrator/Documents/mycode/luban/services/job.go:56 SyncJobManager.start
2022/05/06 - 05:32:55.143 INFO C:/Users/Administrator/Documents/mycode/luban/rpc/server/rpc.go:45 Rpc server: [:40737] available...
2022/05/06 05:32:55 registered an entry: "7ac811c2-b814-4927-afc8-41ce39027e49"
asynq: pid=14 2022/05/06 05:32:55.145914 INFO: Scheduler starting
asynq: pid=14 2022/05/06 05:32:55.145922 INFO: Scheduler timezone is set to UTC
asynq: pid=14 2022/05/06 05:32:55.145937 INFO: Send signal TERM or INT to stop the scheduler
恭喜你安装成功, 快来体验一下吧?