mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-14 05:15:17 +08:00
Updated 春松客服 (markdown)
parent
2fde50bf89
commit
078ddcd341
178
春松客服.md
178
春松客服.md
@ -1 +1,179 @@
|
||||
# 春松客服
|
||||
|
||||
本文档主要是介绍如何完成春松客服开发环境的搭建。
|
||||
|
||||
## 依赖
|
||||
|
||||
* [Git](https://git-scm.com/)
|
||||
|
||||
* [Java 8+](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
|
||||
|
||||
* [Maven 3+](https://maven.apache.org/)
|
||||
|
||||
* [IntelliJ IDEA](https://www.jetbrains.com/idea/)或[Eclipse](https://www.eclipse.org/)
|
||||
|
||||
* [Docker 18+](https://www.docker.com/)
|
||||
|
||||
* [Docker compose 1.22+ ](https://docs.docker.com/compose/install/)
|
||||
|
||||
* [MySQL管理客户端 Navicat for MySQL](https://www.navicat.com/en/products/navicat-for-mysql)
|
||||
|
||||
## 修改maven2配置
|
||||
|
||||
增加Chatopera的Maven2开放库信息。
|
||||
|
||||
打开Maven的配置文件,默认位置为当前用户home目录的.m2文件夹下的settings.xml
|
||||
|
||||
```
|
||||
$USER/.m2/settings.xml
|
||||
```
|
||||
|
||||
在```<servers>```内增加
|
||||
|
||||
```
|
||||
<server>
|
||||
<id>chatopera</id>
|
||||
<username>ada</username>
|
||||
<password>L1OBFepgSZ</password>
|
||||
</server>
|
||||
```
|
||||
|
||||
在```<profiles>```内增加
|
||||
|
||||
```
|
||||
<profile>
|
||||
<id>chatopera</id>
|
||||
<!--Enable snapshots for the built in central repo to direct -->
|
||||
<!--all requests to nexus via the mirror -->
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>public</id>
|
||||
<url>https://nexus.chatopera.com/repository/maven-public</url>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>public</id>
|
||||
<url>https://nexus.chatopera.com/repository/maven-public/</url>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
<activeProfiles>
|
||||
<activeProfile>chatopera</activeProfile>
|
||||
</activeProfiles>
|
||||
```
|
||||
|
||||
配置文件的示例见 [settings.xml](https://github.com/chatopera/cosin/blob/develop/contact-center/_m2/settings.xml)。
|
||||
|
||||
## 下载代码
|
||||
|
||||
```
|
||||
git clone https://github.com/chatopera/cosin.git
|
||||
```
|
||||
|
||||
## 数据库
|
||||
|
||||
在源码中,有默认使用docker-compose启动服务的描述文件(docker-compose.yml)[https://github.com/chatopera/cosin/blob/develop/docker-compose.yml],用于快速准备开发环境。
|
||||
|
||||
### MySQL
|
||||
春松客服依赖MySQL服务,如果没有MySQL服务,可以用下面的方式创建。
|
||||
|
||||
```
|
||||
cd cosin
|
||||
docker-compose up -d mysql
|
||||
```
|
||||
|
||||
1. 连接MySQL服务
|
||||
|
||||
2. 创建contact-center数据库
|
||||
|
||||
3. 导入数据
|
||||
|
||||
### Redis
|
||||
|
||||
春松客服依赖Redis服务,如果没有Redis服务,可以用下面的方式创建。
|
||||
|
||||
```
|
||||
docker-compose up -d redis
|
||||
```
|
||||
|
||||
## 生成项目描述
|
||||
|
||||
文件目录介绍
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/3538629/44974362-ffb57180-af91-11e8-80d1-a48daa3c3dd5.png" width="800"/>
|
||||
|
||||
```_m2```用于Dockerfile中,构建镜像。
|
||||
|
||||
```admin```各种脚本。
|
||||
|
||||
```app```源代码。
|
||||
|
||||
```config```数据库文件。
|
||||
|
||||
```data```数据库数据。
|
||||
|
||||
```logs```日志。
|
||||
|
||||
春松客服是基于Java开发到,使用Maven维护项目声明周期。使用Maven命令,生成项目,方便导入到IDE中。
|
||||
|
||||
### Eclipse
|
||||
|
||||
```
|
||||
cd cosin
|
||||
./admin/gen-eclipse.sh
|
||||
```
|
||||
|
||||
### IntelliJ IDEA
|
||||
|
||||
```
|
||||
cd cosin
|
||||
./admin/gen-idea.sh
|
||||
```
|
||||
|
||||
|
||||
## 配置文件
|
||||
|
||||
春松客服是基于spring boot release 1.5.9 开发,配置文件是
|
||||
|
||||
```
|
||||
cosin/contact-center/app/src/main/resources/application.properties
|
||||
```
|
||||
|
||||
|
||||
数据库连接等其他信息,参考该文件。同时,配置信息也可以通过环境变量方式映射,并覆盖application.properties中等配置,其映射方式为```propery```的键转为大写同时```.```和```-```转为```_```。部分环境变量:
|
||||
|
||||
```
|
||||
JAVA_OPTS=-Xmx12288m -Xms2048m -XX:PermSize=256m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true
|
||||
SERVER_PORT=8035
|
||||
SERVER_LOG_PATH=/logs
|
||||
SERVER_LOG_LEVEL=INFO
|
||||
SPRING_DATA_ELASTICSEARCH_PROPERTIES_PATH_DATA=/data
|
||||
SPRING_DATASOURCE_TYPE=com.alibaba.druid.pool.DruidDataSource
|
||||
SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver
|
||||
SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/contact-center?useUnicode=true&characterEncoding=UTF-8
|
||||
```
|
||||
|
||||
|
||||
该命令会创建MySQL,Redis和Contact-center的容器,启动后,访问 http://localhost:8035 确定服务正常运行了。
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user