本文章用于安装v3.1.7版本
创建数据库
CREATE DATABASE `yearning` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
CREATE USER 'yearning_db'@'%' IDENTIFIED BY 'xxxxxx';
GRANT ALL PRIVILEGES ON yearning.* TO 'yearning_db'@'%';
flush privileges;
编写yaml文件
yearning.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: yearning
name: yearning
spec:
replicas: 1
selector:
matchLabels:
app: yearning
template:
metadata:
labels:
app: yearning
spec:
containers:
- name: yearning
image: yeelabs/yearning:v3.1.7
ports:
- name: http-8000
containerPort: 8000
protocol: TCP
env:
- name: MYSQL_USER
value: 'yearning_db'
- name: MYSQL_ADDR
value: 'ip:port'
- name: MYSQL_PASSWORD
value: 'xxxxxx'
- name: MYSQL_DB
value: yearning
- name: SECRET_KEY
value: akanoneedakanone #自定义
resources:
limits:
memory: 2048Mi
requests:
memory: 1024Mi
---
apiVersion: v1
kind: Service
metadata:
labels:
app: yearning
name: yearning
spec:
ports:
- name: http-8000
port: 8000
protocol: TCP
targetPort: 8000
selector:
app: yearning
启动容器
kubectl -n xxx apply -f yearning.yaml
等待容器创建完成后,可以执行以下操作。
插入必要数据
INSERT INTO `core_accounts` (`username`,`password`,`department`,`real_name`,`email`,`is_recorder`) VALUES ('admin','pbkdf2_sha256$120000$LwSop65y17f4$AgXGkzmZLF7Lw3K1gToLkOBHqziBC0Wpf3bBIHoWA5Q=','DBA','超级管理员','',0);
INSERT INTO `core_global_configurations` (`authorization`,`ldap`,`message`,`other`,`stmt`,`audit_role`,`board`) VALUES ('global','{"url":"","user":"","password":"","type":"(\u0026(objectClass=organizationalPerson) (sAMAccountName=%s))","sc":"","ldaps":false,"map":"","test_user":"","test_password":""}','{"web_hook":"","host":"","port":25,"user":"","password":"","to_user":"","mail":false,"ding":false,"ssl":false,"push_type":false,"key":""}','{"limit":1000,"idc":["Aliyun","AWS"],"query":false,"register":false,"export":false,"ex_query_time":60}',0,'{"DMLAllowLimitSTMT":false,"DMLInsertColumns":false,"DMLMaxInsertRows":10,"DMLWhere":false,"DMLAllowInsertNull":false,"DMLOrder":false,"DMLSelect":false,"DMLInsertMustExplicitly":false,"DDLEnablePrimaryKey":false,"DDLCheckTableComment":false,"DDlCheckColumnComment":false,"DDLCheckColumnNullable":false,"DDLCheckColumnDefault":false,"DDLEnableAcrossDBRename":false,"DDLEnableAutoincrementInit":false,"DDLEnableAutoIncrement":false,"DDLEnableAutoincrementUnsigned":false,"DDLEnableDropTable":false,"DDLEnableDropDatabase":false,"DDLEnableNullIndexName":false,"DDLIndexNameSpec":false,"DDLMaxKeyParts":5,"DDLMaxKey":5,"DDLMaxCharLength":10,"MaxTableNameLen":10,"MaxAffectRows":1000,"MaxDDLAffectRows":0,"SupportCharset":"","SupportCollation":"","CheckIdentifier":false,"MustHaveColumns":"","DDLMultiToCommit":false,"DDLPrimaryKeyMust":false,"DDLAllowColumnType":false,"DDLImplicitTypeConversion":false,"DDLAllowPRINotInt":false,"DDLEnableForeignKey":false,"DDLTablePrefix":"","DDLColumnsMustHaveIndex":"","DDLAllowChangeColumnPosition":false,"DDLCheckFloatDouble":false,"IsOSC":false,"OSCExpr":"","OscSize":0,"AllowCreateView":false,"AllowCrateViewWithSelectStar":false,"AllowCreatePartition":false,"AllowSpecialType":false,"PRIRollBack":false}','');
INSERT INTO `core_graineds` (`username`,`group`) VALUES ('admin','["admin"]');
如果上面的sql执行失败,可以进入到容器的命令行,直接执行
./Yearning install
执行完成后,再次执行以上sql
访问
http://ip:8000
账号密码: admin / Yearning_admin