Wukong CRM/72crm-11.0-Spring deployment

Wukong CRM deployment

Download code

Install git clone code

yum -y install git
https://gitee.com/wukongcrm/crm_pro.git

Wukong CRM Directory Structure

wk_crm
├── admin         -- 系统管理模块和用户管理模块
├── authorization -- 鉴权模块,目前仅用于登录鉴权,后期可能有更改
├── bi            -- 商业智能模块
├── core          -- 通用的代码和工具类
├── crm           -- 客户管理模块
├── gateway       -- 网关模块
├── job           -- 定时任务模块
├── oa            -- OA模块
└── work          -- 项目管理模块

The main technology stack used by Wukong CRM

name version Description port
spring-cloud-alibaba 2.2.1.RELEASE(Hoxton.SR3) Core framework
swagger 2.9.2 Interface documentation
sentinel 2.2.1.RELEASE Circuit breaker and current limit 8079
nacos 1.2.1.RELEASE Registry and distributed configuration management 8848
seata 1.2.0 Distributed transaction 8091
elasticsearch 2.2.5.RELEASE(6.8.6) Search engine middleware 9200,9300
xxl-job 2.1.2 Distributed timing task framework
gateway 2.2.2.RELEASE Microservice gateway

Instructions for use

1. Pre-environment

Two, JDK1.8 Maven3.5 installation

JDK installation

#JDK1.8
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html#license-lightbox		//需要输入oracel用户名密码

#设置环境变量
cat >>/etc/profile <<-EOF
export JAVA_HOME=/application/jdk1.8.0_271
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
EOF

source etc/profile

#测试
java -version

Maven3.5 installation

yum -y install maven-3.0.5-17.el7.noarch

Three, install Mysql database

1. Installation slightly

**2. Modify group by error report**

vi /etc/my.cnf
[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

3. Create a database

MySQL [nacos]> create database nacos;
MySQL [nacos]> create database seata;
MySQL [nacos]> create database wk_crm_single;
MySQL [nacos]> create database xxl_job;
MySQL [nacos]> grant all on *.* to crm@'%' identified by '123.com.cn'

Fourth, install Elasticsearch 6.8.6

Involving ports 9200, 9300

Download link https://mirrors.huaweicloud.com/elasticsearch/

#解压
cd /application
tar -zxvf Elasticsearch 6.8.6.tar.gz
#修改内存
cd elasticsearch-6.8.6/config
vi jvm.options里-Xms512M 和 -Xmx512M
#安装插件
mkdir /application/elasticsearch-6.8.6/plugins/analysis-icu
cd !$
wget https://file.72crm.com/project/analysis-icu-6.8.6.zip
unzip analysis-icu-6.8.6.zip
#创建ES的用户与组和权限
groupadd es
useradd esuser -g es -p elasticsearch
chown -R esuser:es /application/elasticsearch-6.8.6
#运行  (需要使用程序用户启动,后台运行)
sudo  -u esuser /bin/bash -c "source /etc/profile && /bin/bash /application/elasticsearch-6.8.6/bin/elasticsearch -d"

[External link image transfer failed. The source site may have an anti-hotlinking mechanism. It is recommended to save the image and upload it directly (img-AHvqpurE-1606231559997)(F:\Linux\Old Boy Document\image\1606122386251.png)]

Five, install Redis

yum -y install redis
sed -ri '48arequirepass \"123456\"' /etc/redis.conf
systemctl start redis && systemctl enable redis
redis 127.0.0.1:6379> AUTH 123456

Six, Nacos installation

Involving port 8848

#下载解压
cd /application
wget https://github.com/alibaba/nacos/releases/download/1.3.2/nacos-server-1.3.2.tar.gz
unzip nacos-server-1.3.2.tar.gz
#目录结构
nacos/
├── bin
│   ├── shutdown.cmd
│   ├── shutdown.sh			
│   ├── startup.cmd
│   └── startup.sh		//启动文件
├── conf
│   ├── application.properties
│   ├── application.properties.example
│   ├── cluster.conf.example
│   ├── nacos-logback.xml
│   ├── nacos-mysql.sql				//数据文件 需要导入
│   └── schema.sql
├── LICENSE
├── NOTICE
└── target
└── nacos-server.jar


#初始化数据库
将 nacos-mysql.sql导到nacos数据库中
mysql -ucrm -p123.com.cn nacos < nacos/config/nacos-mysql.sql	

#Modify the configuration file

vi application.properties

spring.datasource.platform=mysql

### Count of DB:
db.num=1

### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=crm
db.password=123.com.cn

Start nacos

startup.sh -m standalone 

Insert picture description here

Browser visit http://ip:8848/nacos
Insert picture description here

Seven, Seata installation

Involving port 8091

#下载并解压
cd /tools
wget https://github.com/seata/seata/releases/download/v1.3.0/seata-server-1.3.0.zip
unzip seata-server-1.3.0.zip
mv seata /application/

Download nacos configuration file to register

https://github.com/seata/seata/tree/develop/script/config-center
只下载nacos、config.txt并修改
上传到/application/seate中

#执行导入脚本
cd /application/seata/nacos/
./nacos-config.sh

Check nacos, as shown in the figure, the registration is successful
Insert picture description here

** Modify the registry.conf configuration to nacos **

cat > /application/seata/conf/registry.conf <<-EOF
registry {
     
     
# file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
type = "nacos"

nacos {
     
     
 application = "seata-server"
 serverAddr = "127.0.0.1:8848"
 namespace = "public"
 cluster = "default"
 username = "nacos"
 password = "nacos"
}
} 
config {
     
     
# file、nacos 、apollo、zk、consul、etcd3
type = "nacos"
nacos {
     
     
 serverAddr = "127.0.0.1:8848"
 namespace = "public"
 group = "SEATA_GROUP"
 username = "nacos"
 password = "nacos"
}
}
EOF

Start seate

./bin/seata-server.sh

Insert picture description here

Eight, Sentinel installation

Port 8079 involved

1.下载解压	
cd /tools
wget https://github.com/alibaba/Sentinel/releases/download/v1.8.0/sentinel-dashboard-1.8.0.jar
mkdir /application/sentinel && cp sentinel-dashboard-1.8.0.jar /application/sentinel/
cd /application/sentinel && unzip sentinel-dashboard-1.8.0.jar

2.启动
nohup java -Dserver.port=8079 -Dcsp.sentinel.dashboard.server=localhost:8079 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.0.jar &

Insert picture description here
Browser visit http://ip:8079 default username password sentinel\sentinel
Insert picture description here

Nine, project packaging

1. Import the initialization sql, the independent database used by the gateway module under the current project, and other modules use the same database

Create database

MySQL [nacos]> create database nacos;
MySQL [nacos]> create database seata;
MySQL [nacos]> create database wk_crm_single;
MySQL [nacos]> create database xxl_job;
为了方便这里我就直接使用root用户
MySQL [nacos]> grant all on *.* to crm@'%' identified by '123.com.cn'

**4.导入数据**

Import Data

#1.进入代码DB文件夹
cd /crm_pro/DB && ll
-rw-r--r-- 1 root root   4636 11月  9 17:48 config_info_route.sql
-rw-r--r-- 1 root root   1975 11月  9 17:48 seata.sql
-rw-r--r-- 1 root root 560747 11月  9 17:48 wk_crm_single.sql
-rw-r--r-- 1 root root  10983 11月  9 17:48 xxl_job.sql
#2.导入数据库 
mysql -u crm -p123.com.cn  nacos < config_info_route.sql
mysql -u crm -p123.com.cn  seata < seata.sql 
mysql -u crm -p123.com.cn  wk_crm_single < wk_crm_single.sql
mysql -u crm -p123.com.cn  xxl_job < xxl_job.sql 

2. Execute mvn install in the project root directory

Insert picture description here

3. Configure database account information and redis account information in the resource directory of each module (the application-dev.ymlconfiguration file is used by default, and the application-test.ymlconfiguration file used by the startup script by default after packaging )

[root@nginx_proxy_02 crm_pro]# find ./ -name application-test.yml  | grep "res"
./admin/src/main/resources/application-test.yml
./authorization/src/main/resources/application-test.yml
./bi/src/main/resources/application-test.yml
./crm/src/main/resources/application-test.yml
./job/src/main/resources/application-test.yml
./oa/src/main/resources/application-test.yml
./work/src/main/resources/application-test.yml
./gateway/src/main/resources/application-dev.yml

4. crm\src\main\resources\application-dev.ymlModify the elasticsearch configuration inside

spring.elasticsearch.rest.uris = elasticsearch地址 例:127.0.0.1:9200
spring.elasticsearch.rest.username = elasticsearch用户名 例:elastic 无密码可留空
spring.elasticsearch.rest.password = elasticsearch密码 例: password 无密码可留空

5. (Optional) The project log file is being core\src\main\resources\logback-spring.xmlmodified

6. The project is then packaged and deployed clean -Dmaven.test.skip=true package

mvn clean -Dmaven.test.skip=true package
·然后把对应模块下target文件夹下
·${name}-${version}-SNAPSHOT.zip/tar.gz上传到服务器,例:admin-0.0.1-SNAPSHOT.zip 并将压缩文件解压,检查对应配置文件。
cd /crm_pro
cp ./admin/target/wk_admin.tar.gz /application/wk_crm/wk_admin/ 
cp ./authorization/target/wk_authorization.tar.gz /application/wk_crm/wk_authorization/
cp ./bi/target/wk_bi.tar.gz /application/wk_crm/wk_bi/
cp ./crm/target/wk_crm.tar.gz /application/wk_crm/wk_crm/
cp ./gateway/target/wk_gateway.tar.gz /application/wk_crm/wk_gateway/
cp ./job/target/wk_job.tar.gz /application/wk_crm/wk_job/
cp ./oa/target/wk_oa.tar.gz /application/wk_crm/wk_oa/
cp ./work/target/wk_work.tar.gz /application/wk_crm/wk_work/

Insert picture description here

7. Project start

cd /application/wk_crm
export DIR=/application/wk_crm/
cd ${DIR}wk_authorization/ && ./72crm.sh start
cd ${DIR}wk_admin/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_bi/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_crm/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_gataeway/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_job/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_oa/ && ./72crm.sh start && cd .. 
cd ${DIR}wk_work/ && ./72crm.sh start && cd .. 


先启动nacos,seata,sentinel, elasticsearch,mysql,redis等基础服务
在第八步解压的文件模块下通过执行`sh 72crm.sh start`(windows下直接运行72crm.bat)启动各个模块服务。
其中项目基础模块:gateway,authorization,admin必须启动,其他模块可按需启动。
启动完成后,在浏览器中访问:http://localhost:8443/即可登录系统

Insert picture description here

10. Browser access

Visit crm for the first time to register and visit http://IP:8443

Insert picture description here

Visit swagger http://IP:8443/swagger-ui.html?urls.primaryName=crm#/ to view project status

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43357497/article/details/110100772