1
0
mirror of https://github.com/chatopera/cosin.git synced 2025-08-01 16:38:02 +08:00

后端基础设施完善

This commit is contained in:
lecjy 2023-09-27 13:34:40 +08:00 committed by lecjy
parent 7c93ac0109
commit 64387b8a8e
111 changed files with 1475 additions and 1594 deletions

View File

@ -12,7 +12,7 @@ jobs:
# Be sure to update the Docker image tag below to openjdk version of your application.
# A list of available CircleCI Docker Convenience Images are available here: https://circleci.com/developer/images/image/cimg/openjdk
docker:
- image: cimg/openjdk:17.0.7
- image: cimg/openjdk:21
# Add steps to the job
# See: https://circleci.com/docs/configuration-reference/#steps
steps:
@ -25,10 +25,7 @@ jobs:
echo "$DOCKERHUB_USERPASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
- run:
name: Build Contact Center Docker Image
command: cd $CIRCLE_WORKING_DIRECTORY/contact-center && ./admin/build.sh
- run:
name: Push Contact Center Docker Image to DockerHub
command: cd $CIRCLE_WORKING_DIRECTORY/contact-center && ./admin/push.sh
command: cd $CIRCLE_WORKING_DIRECTORY/cskefu-backend && ../scripts/deploy.sh
# Invoke jobs via workflows
# See: https://circleci.com/docs/configuration-reference/#workflows

View File

@ -15,5 +15,4 @@ jobs:
if [ ! -d .git ]; then git init; git config user.email "you@dummy.com"; git config user.name "dummy"; git add --all && git commit -q -m "Only fix mvn goals for github workflow"; fi
if [ -f ~/.cskefu.rc ]; then source ~/.cskefu.rc; else echo "Not found ~/.cskefu.rc; find info with https://github.com/cskefu/cskefu/issues/688"; exit 1; fi
java -version && mvn -version
$GITHUB_WORKSPACE/public/plugins/scripts/install-all.sh
cd $GITHUB_WORKSPACE/contact-center && ./admin/compile.sh
cd $GITHUB_WORKSPACE/cskefu-backend && ../public/scripts/compile.sh

1
.gitignore vendored
View File

@ -21,7 +21,6 @@ build.gradle
.vscode/
nohup.out
docker-compose.dev.yml
docker-compose.custom.yml
private/
smart-doc/
target/

View File

@ -1,8 +0,0 @@
app/target
!app/target/*.war.original
!app/target/*.war
!app/target/*.jar.original
!app/target/*.jar
logs/
tmp/
data/

View File

@ -1,23 +0,0 @@
*.swp
*.swo
*.sublime-*
*.pyc
jmeter.log
__pycache__
tmp/
node_modules/
sftp-config.json
.DS_Store
*.iml
*.ipr
*.iws
*.idea
~$*.xls*
~$*.ppt*
~$*.doc*
admin/localrc
app/target/
app/.classpath
app/.project
app/.settings/
logPath_IS_UNDEFINED/

View File

@ -1,30 +0,0 @@
FROM chatopera/java:17
MAINTAINER Hai Liang Wang <hain@chatopera.com>
ARG DEBIAN_FRONTEND=noninteractive
ARG VCS_REF
ARG APPLICATION_CUSTOMER_ENTITY
ARG APPLICATION_BUILD_DATESTR
ENV APPLICATION_CUSTOMER_ENTITY=$APPLICATION_CUSTOMER_ENTITY
ENV APPLICATION_BUILD_DATESTR=$APPLICATION_BUILD_DATESTR
LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://www.cskefu.com"
# create dirs
RUN /bin/bash -c "mkdir -p /{data,logs}"
# build WAR
RUN mkdir -p /opt/cskefu
COPY ./app/target/contact-center.war /opt/cskefu/contact-center.war
COPY ./assets/mysql.setup.db.sh /opt/cskefu
COPY ./assets/mysql.upgrade.db.sh /opt/cskefu
COPY ./assets/utils.sh /opt/cskefu
COPY ./assets/docker-entrypoint.sh /opt/cskefu
RUN chmod +x /opt/cskefu/*.sh
RUN touch /root/.cskefu.pep
WORKDIR /opt/cskefu
EXPOSE 8030-8050
CMD ["./docker-entrypoint.sh"]

View File

@ -1,7 +0,0 @@
# Chatopera Contact Center
前三代呼叫中心均是以电话为主要的服务渠道。在 2000 年伴随着互联网以及移动通信的发展与普及将电子邮件、互联网、手机短信等渠道接入呼叫中心成为第四代呼叫中心的标志。第四代呼叫中心也称为多媒体呼叫中心或联络中心Contact Center。它相对传统呼叫中心来说接入渠道丰富同时引入了多渠道接入与多渠道统一排队等概念。
## 文档
<https://docs.chatopera.com/>

View File

@ -1,40 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
appHome=$baseDir/..
registryPrefix=
imagename=cskefu/contact-center
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
# build
cd $appHome
TIMESTAMP=`date "+%Y%m%d.%H%M%S"`
PACKAGE_VERSION=`git rev-parse --short HEAD`
APPLICATION_CUSTOMER_ENTITY=${APPLICATION_CUSTOMER_ENTITY:-"OpenSource Community"}
$baseDir/package.sh
if [ ! $? -eq 0 ]; then
exit 1
fi
set -x
docker build --build-arg VCS_REF=$PACKAGE_VERSION \
--build-arg APPLICATION_BUILD_DATESTR=$TIMESTAMP \
--build-arg APPLICATION_CUSTOMER_ENTITY="$APPLICATION_CUSTOMER_ENTITY" \
--no-cache \
--force-rm=true --tag $registryPrefix$imagename:$PACKAGE_VERSION .
if [ $? -eq 0 ]; then
docker tag $registryPrefix$imagename:$PACKAGE_VERSION $registryPrefix$imagename:develop
else
echo "Build contact-center failure."
exit 1
fi

View File

@ -1,30 +0,0 @@
#! /bin/bash
###########################################
# Create standalone SQL file to setup db
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
cwdDir=$PWD
export PYTHONUNBUFFERED=1
export PATH=/opt/miniconda3/envs/venv-py3/bin:$PATH
export TS=$(date +%Y%m%d%H%M%S)
export DATE=`date "+%Y%m%d"`
export DATE_WITH_TIME=`date "+%Y%m%d-%H%M%S"` #add %3N as we want millisecond too
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/..
if [ ! -e tmp ]; then
mkdir tmp
fi
cat config/sql/001.mysql-create-db.sql > tmp/db-setup.sql
echo "" >> tmp/db-setup.sql
cat config/sql/002.mysql-create-schemas.sql >> tmp/db-setup.sql
echo "Setup Script created in" `pwd`/tmp/db-setup.sql

View File

@ -1,50 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
REPO_ID_SNP=chatopera-snapshots
REPO_URL_SNP=https://nexus.chatopera.com/repository/maven-snapshots/
REPO_ID_REL=chatopera-releases
REPO_URL_REL=https://nexus.chatopera.com/repository/maven-releases/
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
mvn clean jar:jar
PACKAGE_VERSION=$(grep --max-count=1 '<version>' pom.xml | awk -F '>' '{ print $2 }' | awk -F '<' '{ print $1 }')
if [[ $PACKAGE_VERSION == *SNAPSHOT ]]; then
echo "Deploy as snapshot package ..."
mvn deploy:deploy-file \
-Dmaven.test.skip=true \
-Dfile=./target/contact-center.jar \
-DgroupId=com.cskefu.cc \
-DartifactId=cc-core \
-Dversion=$PACKAGE_VERSION \
-Dpackaging=jar \
-DgeneratePom=true \
-DrepositoryId=$REPO_ID_SNP \
-Durl=$REPO_URL_SNP
if [ ! $? -eq 0 ]; then
exit 1
fi
else
echo "Deploy as release package ..."
mvn deploy:deploy-file \
-Dmaven.test.skip=true \
-Dfile=./target/contact-center.jar \
-DgroupId=com.cskefu.cc \
-DartifactId=cc-core \
-Dversion=$PACKAGE_VERSION \
-Dpackaging=jar \
-DgeneratePom=true \
-DrepositoryId=$REPO_ID_REL \
-Durl=$REPO_URL_REL
if [ ! $? -eq 0 ]; then
exit 1
fi
fi

View File

@ -1,15 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
source .env
mvn spring-boot:run
#java -jar target/contact-center.war

View File

@ -1,13 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
mvn eclipse:eclipse

View File

@ -1,13 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
mvn idea:idea

View File

@ -1,47 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
SCRIPT_PATH=$0
ts=`date +"%Y-%m-%d_%H-%M-%S"`
buildDir=/tmp/cc-build-$ts
# functions
function print_usage(){
echo "Install contact-center plugin: $SCRIPT_PATH contact-center_jar_path plugin_path output_path"
}
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
if [ "$#" -ne 4 ]; then
CONTACT_CENTER=$1
CC_PLUGIN=$2
OUTPUT_PATH=$3
if [ ! -f $1 ]; then
echo "contact center jar file not exist."
print_usage
exit 1
fi
if [ ! -f $2 ]; then
echo "cc plugin jar file not exist."
print_usage
exit 2
fi
# create jar
rm -rf $buildDir
mkdir $buildDir
unzip $CONTACT_CENTER -d $buildDir
cp $CC_PLUGIN $buildDir/BOOT-INF/lib
cd $buildDir
jar -cvfM0 $3 .
echo "Created new jar file as" $OUTPUT_PATH "successfully."
echo "Build done, delete buildDir" $buildDir "in 3 seconds ..."
sleep 3
rm -rf $buildDir
else
print_usage
fi

View File

@ -1,19 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
mvn -DskipTests clean package
# take too long time with dev002 for uploading artifact, skip this operation
# $baseDir/deploy.app.sh
if [ ! $? -eq 0 ]; then
exit 1
fi

View File

@ -1,13 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../root
mvn deploy

View File

@ -1,52 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
appHome=$baseDir/..
registryPrefix=
imagename=cskefu/contact-center
PACKAGE_VERSION=
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $appHome/
if [ -d ../private ]; then
registryPrefix=dockerhub.qingcloud.com/
fi
TIMESTAMP=`date "+%Y%m%d.%H%M%S"`
PACKAGE_VERSION=`git rev-parse --short HEAD`
cd $baseDir
docker run -it --rm \
-p 9035:8035 \
-p 9036:8036 \
-v $PWD/data:/data \
-v $PWD/logs:/logs \
-e "JAVA_OPTS=-Xmx12288m -Xms2048m -XX:PermSize=256m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true" \
-e SERVER_PORT=8035 \
-e SERVER_LOG_PATH=/logs \
-e SERVER_LOG_LEVEL=INFO \
-e WEB_UPLOAD_PATH=/data \
-e SPRING_FREEMARKER_CACHE=true \
-e SPRING_DATA_ELASTICSEARCH_PROPERTIES_PATH_DATA=/data \
-e SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.jdbc.Driver \
-e "SPRING_DATASOURCE_URL=jdbc:mysql://mysql:8037/contactcenter?useUnicode=true&characterEncoding=UTF-8" \
-e SPRING_DATASOURCE_USERNAME=root \
-e SPRING_DATASOURCE_PASSWORD=123456 \
-e MANAGEMENT_SECURITY_ENABLED=false \
-e SPRING_REDIS_DATABASE=2 \
-e SPRING_REDIS_HOST=redis \
-e SPRING_REDIS_PORT=8041 \
-e CSKEFU_CALLOUT_WATCH_INTERVAL=60000 \
-e SPRING_DATA_ELASTICSEARCH_CLUSTER_NAME=elasticsearch \
-e SPRING_DATA_ELASTICSEARCH_CLUSTER_NODES=elasticsearch:8040 \
-e SPRING_DATA_ELASTICSEARCH_LOCAL=false \
-e SPRING_DATA_ELASTICSEARCH_REPOSITORIES_ENABLED=true \
$registryPrefix$imagename:$PACKAGE_VERSION

View File

@ -1,14 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../app
set -x
mvn -Dtest=com.cskefu.cc.proto.ProtoTest#testProto test

View File

@ -1,22 +0,0 @@
#! /bin/bash
###########################################
# Contact Center Start
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir
./mysql.setup.db.sh
./mysql.upgrade.db.sh
if [ $? -eq 0 ]; then
java -jar contact-center.war
else
echo "Fail to resolve mysql database instance."
exit 1
fi

View File

@ -1,23 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
export PATH=$PATH:$JAVA_HOME/bin
baseDir=$(cd `dirname "$0"`;pwd)
MVNNAME=maven.tgz
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd /opt && wget -O $MVNNAME https://downloads.apache.org/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar xzf $MVNNAME
mv apache-maven-* maven
rm $MVNNAME
export MAVEN_HOME=/opt/maven
export PATH=$PATH:$MAVEN_HOME/bin
rm -rf $0

View File

@ -1,86 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
source $baseDir/utils.sh
MYSQL_WRITEMODE_IP=`parse_host ${SPRING_DATASOURCE_URL}`
MYSQL_WRITEMODE_PORT=`parse_port ${SPRING_DATASOURCE_URL}`
CONTACT_CENTER_DB=`parse_dbname ${SPRING_DATASOURCE_URL}`
CONTACT_CENTER_WAR=/opt/cskefu/contact-center.war
MYSQL_SETUP_CREATE_DB=001.mysql-create-db.sql
MYSQL_SETUP_CREATE_SCHEMAS=002.mysql-create-schemas.sql
# functions
function import_db(){
if [ ! -f $1 ]; then exit 1; fi
println "run MySQL DB initialize script ..."
mysql -u ${SPRING_DATASOURCE_USERNAME} \
-h ${MYSQL_WRITEMODE_IP} \
-P ${MYSQL_WRITEMODE_PORT} -p${SPRING_DATASOURCE_PASSWORD} \
< $1
# verify status
if [ ! $? -eq 0 ]; then
exit 1
fi
}
function init_db(){
println "extract SQL script ..."
if [ -f $CONTACT_CENTER_WAR ]; then
cd /tmp
if [ -d ROOT ]; then
rm -rf ROOT
fi
unzip -q $CONTACT_CENTER_WAR -d ROOT
if [ -f /tmp/ROOT/$MYSQL_SETUP_CREATE_SCHEMAS ]; then
println "start to import database ..."
cat /tmp/ROOT/$MYSQL_SETUP_CREATE_DB > /tmp/ROOT/db_setup.sql
echo "" >> /tmp/ROOT/db_setup.sql
cat /tmp/ROOT/$MYSQL_SETUP_CREATE_SCHEMAS >> /tmp/ROOT/db_setup.sql
import_db /tmp/ROOT/db_setup.sql
# verify status
if [ ! $? -eq 0 ]; then
rm /tmp/ROOT/db_setup.sql
exit 1
fi
rm -rf /tmp/ROOT
else
println "SQL script not exist."
exit 1
fi
else
println "War file not exist."
fi
}
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
println "[setup] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
## wait for database connection ...
while ! mysqladmin --user=${SPRING_DATASOURCE_USERNAME} --password=${SPRING_DATASOURCE_PASSWORD} --host=${MYSQL_WRITEMODE_IP} --port=${MYSQL_WRITEMODE_PORT} ping --silent &> /dev/null ; do
echo "Waiting for database connection..."
sleep 2
done
# check if database exist, if not, create it.
mysqlshow -h ${MYSQL_WRITEMODE_IP} \
-P ${MYSQL_WRITEMODE_PORT} \
--user=${SPRING_DATASOURCE_USERNAME} \
--password=${SPRING_DATASOURCE_PASSWORD} \
${CONTACT_CENTER_DB} > /dev/null 2>&1 && exit 0;
# not exist
init_db
# verify status
if [ ! $? -eq 0 ]; then
println "DB status check failed."
exit 1
fi

View File

@ -1,81 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
source $baseDir/utils.sh
MYSQL_WRITEMODE_IP=`parse_host ${SPRING_DATASOURCE_URL}`
MYSQL_WRITEMODE_PORT=`parse_port ${SPRING_DATASOURCE_URL}`
CONTACT_CENTER_DB=`parse_dbname ${SPRING_DATASOURCE_URL}`
CONTACT_CENTER_WAR=/opt/cskefu/contact-center.war
APP_WAR_EXTRACTED=/tmp/ROOT
UPGRADE_DB_SCRIPT_DIR=$APP_WAR_EXTRACTED/upgrade
# functions
function upgrade_db(){
if [ ! -f $1 ]; then exit 1; fi
println "[upgrade] run MySQL DB upgrade script" $1 "..."
mysql -u ${SPRING_DATASOURCE_USERNAME} \
-h ${MYSQL_WRITEMODE_IP} \
-P ${MYSQL_WRITEMODE_PORT} -p${SPRING_DATASOURCE_PASSWORD} \
< $1
# verify status
if [ ! $? -eq 0 ]; then
exit 1
fi
}
function extract_war(){
println "extract SQL script ..."
if [ -f $CONTACT_CENTER_WAR ]; then
cd /tmp
if [ -d $APP_WAR_EXTRACTED ]; then
rm -rf $APP_WAR_EXTRACTED
fi
unzip -q $CONTACT_CENTER_WAR -d ROOT
else
println "War file not exist."
fi
}
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
println "[upgrade] connecting to $MYSQL_WRITEMODE_IP:$MYSQL_WRITEMODE_PORT/$CONTACT_CENTER_DB with $SPRING_DATASOURCE_USERNAME/****"
## check upgrade footprint
if [ -f /opt/cskefu/upgrade.his ]; then
echo "[upgrade] upgrade has been done with previous start."
exit 0
fi
## wait for database connection ...
while ! mysqladmin --user=${SPRING_DATASOURCE_USERNAME} --password=${SPRING_DATASOURCE_PASSWORD} --host=${MYSQL_WRITEMODE_IP} --port=${MYSQL_WRITEMODE_PORT} ping --silent &> /dev/null ; do
echo "Waiting for database connection..."
sleep 2
done
## check root dir
if [ ! -d $APP_WAR_EXTRACTED ]; then
extract_war
fi
## run scripts
if [ -d $UPGRADE_DB_SCRIPT_DIR ]; then
cd $UPGRADE_DB_SCRIPT_DIR
for x in `find . -name "*.sql"|sort`; do
echo "[run] " $x " ..."
upgrade_db $x
if [ ! $? -eq 0 ]; then
echo "Failed result with" $x
exit 1
fi
done
fi
## touch upgrade footprint
if [ ! -f /opt/cskefu/upgrade.his ]; then
touch /opt/cskefu/upgrade.his
fi

View File

@ -1,54 +0,0 @@
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

View File

@ -1,27 +0,0 @@
println() {
# timestamp=`date +%Y%m%d%H%M%S`
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
echo $timestamp $@
}
# Following regex is based on https://tools.ietf.org/html/rfc3986#appendix-B with
# additional sub-expressions to split authority into userinfo, host and port
#
readonly JDBC_URI_REGEX='^jdbc:mysql:(//((([^:/?#]+)@)?([^:/?#]+)(:([0-9]+))?))?(/([^?#]*))(\?([^#]*))?(#(.*))?'
# ↑↑ ↑ ↑↑↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
# |2 scheme | ||6 userinfo 7 host | 9 port | 11 rpath | 13 query | 15 fragment
# 1 scheme: | |5 userinfo@ 8 :… 10 path 12 ?… 14 #…
# | 4 authority
# 3 //…
parse_host () {
[[ "$@" =~ $JDBC_URI_REGEX ]] && echo "${BASH_REMATCH[5]}"
}
parse_port () {
[[ "$@" =~ $JDBC_URI_REGEX ]] && echo "${BASH_REMATCH[7]}"
}
parse_dbname () {
[[ "$@" =~ $JDBC_URI_REGEX ]] && echo "${BASH_REMATCH[9]}"
}

View File

@ -1,25 +0,0 @@
FROM ubuntu:18.04
MAINTAINER Hai Liang Wang <hain@chatopera.com>
ARG DEBIAN_FRONTEND=noninteractive
# COPY $PWD/assets/aliyun.sources.list /etc/apt/sources.list
# install amazon jdk corretto
COPY $PWD/assets/install-corretto-8.sh /opt
RUN chmod +x /opt/install-corretto-8.sh && /opt/install-corretto-8.sh
# install other lib and configure timezone
RUN apt-get update && \
apt-get install --no-install-recommends -y tzdata iputils-ping mysql-client-5.7 zip unzip vim-tiny libfontconfig1 libfreetype6 && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure --frontend noninteractive tzdata && \
rm -rf /var/lib/apt/lists/*
# Set the locale
ENV LANG C.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL C.UTF-8
# set ENVs
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
ENV PATH=$PATH:$JAVA_HOME/bin

View File

@ -1,27 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
JDKNAME=java-1.8.0-amazon-corretto-jdk.deb
## fast download with internal addr
## replace JDKURL when builing outside chatopera machines, java-1.8.0-amazon-corretto-jdk_8.212.04-2_amd64.deb can be download from Amazon Official Site.
## https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html
JDKURL=http://192.168.2.217:30080/vendors/java/java-1.8.0-amazon-corretto-jdk_8.212.04-2_amd64.deb
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
apt-get update && apt-get install -y --no-install-recommends publicsuffix ca-certificates wget java-common
cd /tmp
wget --no-check-certificate -O $JDKNAME $JDKURL
dpkg --install $JDKNAME
rm -rf $JDKNAME
java -version
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
export PATH=$PATH:$JAVA_HOME/bin
rm -rf $0

View File

@ -1,33 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
appHome=$baseDir
# registryName=
imagename=chatopera/java-1.8.0-amazon-corretto-jdk
PACKAGE_VERSION=1.0.0
TIMESTAMP=`date "+%Y%m%d.%H%M%S"`
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
# build
cd $appHome
docker build --build-arg \
--no-cache \
--force-rm=true --tag $imagename:$PACKAGE_VERSION .
set -x
if [ $? -eq 0 ]; then
docker tag $imagename:$PACKAGE_VERSION $imagename:develop
docker push $imagename:$PACKAGE_VERSION
docker push $imagename:develop
else
echo "Build contact-center failure."
exit 1
fi

View File

@ -1,127 +0,0 @@
#优客服
优客服官方技术支持QQ群555834343目前项目已发布v3.8.0版本加入QQ群可以了解最新进度和技术问题咨询。
[![输入图片说明](http://git.oschina.net/uploads/images/2017/0123/001823_7efad50c_1200081.png "在这里输入图片标题")](http://shang.qq.com/wpa/qunwpa?idkey=637134af30a27220211c843d801ada14700aca69ee8f4acf13f795fe38ea7b94)
优客服是一个多渠道融合的客户支持服务平台包含WebIM微信电话邮件短信等接入渠道、智能机器人
#访问地址
DEMO访问地址[优客服UCKeFu-WebIM](http://uk.ukewo.cn/) 访问账号admin密码123456
#优客服组件结构
![输入图片说明](http://git.oschina.net/uploads/images/2017/0315/075025_c1add38b_1200081.png "在这里输入图片标题")
**1. WebIM在线客服**
优客服提供WebIM功能在线坐席能够通过工作台操作界面接收来自WebIM的咨询请求优客服通过整合多个渠道来源让坐席在同一个工作界面上处理来自PC端、移动端、微信端微博等渠道的服务请求。
**2. 社交媒体**
接入微信和微博渠道,将社交媒体渠道的的咨询请求接入进入 优客服 坐席工作平台,让客服统一响应和受理
**3. 邮件、短信**
多种邮件处理方式,能够将邮箱的消息转为坐席的待处理任务,可以将待处理任务或邮件转为工单
项目组成:
**1. 前端LayUI + Freemarker**
**1. 后端Spring Boot**
**1. 数据库MySQL+Elasticsearch**
项目运行方式:
### 1. 将代码拉取下来
### 1. 编译pom.xml文件下载好jar包
本项目有四个依赖包jave 和Mondrianaliyun-java-sdk-core、aliyun-java-sdk-dysmsapi通过以下指令加入到本地Mavenue仓库
1、mvn install:install-file -Dfile=src/main/resources/WEB-INF/lib/jave-1.0.2.jar -DgroupId=lt.jave -DartifactId=jave -Dversion=1.0.2 -Dpackaging=jar
2、mvn install:install-file -Dfile=src/main/resources/WEB-INF/lib/mondrian-3.7.0.jar -DgroupId=mondrian -DartifactId=mondrian -Dversion=3.7.0 -Dpackaging=jar
3、执行添加 阿里云jar
mvn install:install-file -Dfile=src/main/resources/WEB-INF/lib/aliyun-java-sdk-core-3.3.1.jar -DgroupId=com.aliyun -DartifactId=aliyun-java-sdk-core -Dversion=3.3.1 -Dpackaging=jar
4、阿里大鱼jar
mvn install:install-file -Dfile=src/main/resources/WEB-INF/lib/aliyun-java-sdk-dysmsapi-1.0.0.jar -DgroupId=com.aliyun -DartifactId=aliyun-java-sdk-dysmsapi -Dversion=1.0.0 -Dpackaging=jar
**确保两个依赖都安装成功**
### 1. 将项目按照maven格式配置好
### 1. 将ukefu.sql脚本在mysql数据库里运行创建数据库和表
### 1. 配置项目中的application.properties文件中的数据库连接
### 2. 将生成的WAR文件部署到 Tomcat 即可。
运行一下查看效果吧!
**优客服将会分版本实现全部的功能V1.0中将包含以下部分功能:**
**1、后台管理**
系统后台管理功能包括系统用户管理客服坐席管理系统角色管理、组织机构管理WebIM接入管理接入设置
**2、WebIM在线客服**
访客管理、访客邀请、WebIM网站端多风格切换访客用户唯一身份识别与跟踪老用户识别IP与地理位置识别转换访客轨迹访客停留记录访客实时对话通信消息表情包客户消息多媒体类型消息处理坐席与用户统一路由排队ACD实时提示坐席当前客户正在输入的内容坐席状态切换、坐席绩效管理
**3、联系人管理**
公共联系人,私有联系人,联系人贡献与分配
**4、联络记录**
坐席与客户之间的通信记录包含WebIM对话微信对话V2.0功能)等
**5、常用语FAQ维护**
公共常用语维护(话术),坐席私有常用语维护
优客服全渠道客服系统产品介绍
优客服是一个全渠道融合的客户支持服务平台聚合8大客服渠道帮助各种行业各种规模的企业建立完整客服体系。
通过将邮件、短信、电话语音、WebIM在线客服、微信、微博、H5页面、APP接口8个渠道来源的客户服务请求与对话汇聚在一个管理平台用统一的方式来响应和支撑客户服务。
1、渠道融合建立统一客服模式
• 语音
接入企业的呼叫中心,让客服在一个管理界面接听呼入的电话并可以方便快捷的呼出,通过工单记录和后续跟进客户
• WebIM在线客服
让您的客服在一个节目和各个渠道来源的用户对话,实时沟通,并能够为对话记录质检和创建业务请求方便后续跟进和处理
• 社交媒体
集成微信和微博渠道,将社交网络的服务请求集中到优客服,客服坐席统一响应和受理
• 邮件短信
将发至客服邮箱的邮件转为服务请求,通过任务受理和追踪,并能够通过发送邮件或短信快速回复客户客户
2、业务支撑提供快速服务请求
• 简单易用的界面与交互
为客户和坐席人员提供友好的操作界面,方便通过标准方式进行高效沟通
• 跨部门协同解决客户问题
连接您的所有职能人员,从销售客服到技术支持
• 问题流转与变更全纪录
客户的所有交谈记录和问题工单处理事件都会完整记录,方便任何客服接手问题处理,有效解决客户问题
3、数据分析深入了解客服业务状况
• 全渠道数据概况一目了然
了解所有渠道的客户服务状况、来源比例,了解响应时间与服务时间,按不同维度统计
• 优化客服坐席资源分配
按照不同的维度统计更细致的客户坐席服务变化趋势,查看每一天的坐席绩效
• 客群分类,建立客户全景式图
集成企业内部客户数据,分析客户价值,创建客户标签
**微信接入渠道演示微信公众号**
![输入图片说明](https://gitee.com/uploads/images/2018/0330/155011_a68bba9e_1200081.jpeg "qrcode_for_gh_b21c83fa3ff9_258.jpg")
优客服部分产品组件截图
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203140_36044898_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203147_5a832431_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203155_24ca7ba3_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203208_1c20aabe_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203218_78ff4169_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203225_01f116e7_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203236_7d782c9e_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203349_829a3ac2_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203359_533aa230_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203408_e27accb5_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203416_47aac57f_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203426_a4df219a_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203433_1172bbb7_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203445_4ba5491a_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203452_99b88f79_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203459_26a875f5_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203505_5e9309a1_1200081.png "在这里输入图片标题")
![输入图片说明](http://git.oschina.net/uploads/images/2017/0314/203512_fd235387_1200081.png "在这里输入图片标题")

View File

@ -1,2 +1,3 @@
*
data
logs
!.gitignore

View File

@ -0,0 +1,302 @@
version: "3"
services:
cskefu-web-gateway:
image: cskefu/cskefu-web-gateway
# container_name: cskefu-web-gateway
restart: always
# ports:
# - "${CSKEFU_WEB_GATEWAY_PORT:-8080}:8080"
expose:
- 8080
volumes:
- ./cskefu/logs:/cskefu/logs
deploy:
replicas: 3
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- cskefu-auth-service
- cskefu-manager-service
cskefu-manager-service:
image: cskefu/cskefu-manager-service
# container_name: cskefu-manager-service
restart: always
# ports:
# - "${CSKEFU_MANAGER_SERVICE_PORT:-8081}:8081"
expose:
- 8081
volumes:
- ./cskefu/logs:/cskefu/logs
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- mysql
- redis
- nacos
- rabbitmq
cskefu-auth-service:
image: cskefu/cskefu-auth-service
# container_name: cskefu-auth-service
restart: always
# ports:
# - "${CSKEFU_AUTH_SERVICE_PORT:-8082}:8082"
expose:
- 8082
volumes:
- ./cskefu/logs:/cskefu/logs
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- mysql
- redis
- nacos
- rabbitmq
cskefu-plugin-service:
image: cskefu/cskefu-plugin-service
# container_name: cskefu-plugin-service
restart: always
# ports:
# - "${CSKEFU_PLUGIN_SERVICE_PORT:-8083}:8083"
expose:
- 8083
volumes:
- ./cskefu/logs:/cskefu/logs
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- mysql
- redis
- nacos
- rabbitmq
cskefu-channel-wechat-service:
image: cskefu/cskefu-channel-wechat-service
# container_name: cskefu-channel-wechat-service
restart: always
# ports:
# - "${CSKEFU_CHANNEL_WECHAT_SERVICE_PORT:-8084}:8084"
expose:
- 8084
volumes:
- ./cskefu/logs:/cskefu/logs
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- cskefu-auth-service
cskefu-websocket-service:
image: cskefu/cskefu-websocket-service
# container_name: cskefu-websocket-service
restart: always
# ports:
# - "${CSKEFU_WEBSOCKET_SERVICE_PORT:-10000}:10000"
expose:
- ${CSKEFU_WEBSOCKET_SERVICE_PORT:-10000}
volumes:
- ./cskefu/logs:/cskefu/logs
deploy:
replicas: 3
environment:
- "JAVA_OPTS=-Xmx${CSKEFU_JAVA_XMX:-512m} -Xms${CSKEFU_JAVA_XMS:-512m} -XX:PermSize=128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- LOGGING_LEVEL_ROOT=${LOGGING_LEVEL_ROOT:-INFO}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
# - SPRING_DATASOURCE_HIKARI_MAXIMUM_POOL_SIZE=100
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_RABBITMQ_ADDRESSES=rabbitmq
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER_ADDR=nacos:8848
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- mysql
- redis
- nacos
- rabbitmq
mysql:
image: cskefu/mysql-8.1:nacos
container_name: mysql
restart: always
environment:
- MYSQL_PASSWORD=${MYSQL_PASSWORD:-123456}
- MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD:-123456}
ports:
- "${MYSQL_PORT:-3306}:3306"
expose:
- 3306
volumes:
- ./mysql/data:/var/lib/mysql
command: --max_allowed_packet=32505856
# https://hub.docker.com/r/nacos/nacos-server
nacos:
image: nacos/nacos-server:v2.2.3-slim
container_name: nacos
environment:
MODE: standalone
SPRING_DATASOURCE_PLATFORM: mysql
MYSQL_SERVICE_HOST: mysql
MYSQL_SERVICE_PORT: 3306
MYSQL_SERVICE_DB_NAME: nacos_config
MYSQL_SERVICE_USER: ${MYSQL_USER:-root}
MYSQL_SERVICE_PASSWORD: ${MYSQL_PASSWORD:-123456}
MYSQL_SERVICE_DB_PARAM: "characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&serverTimezone=UTC"
JVM_XMS: 256m
JVM_XMX: 512m
JVM_XMN: 256m
volumes:
- ./nacos/logs:/home/nacos/logs
ports:
- "${NACOS_PORT:-8848}:8848"
- "${NACOS_CLIENT_GRPC_PORT:-9848}:9848"
- "${NACOS_SERVER_GRPC_PORT:-9849}:9849"
expose:
- 8848
- 9848
- 9849
restart: always
depends_on:
- mysql
redis:
image: redis:7.2.1-alpine3.18
container_name: redis
restart: always
volumes:
- ./redis/data:/cskefu/redis
ports:
- "${REDIS_PORT:-6379}:6379"
expose:
- 6379
rabbitmq:
image: rabbitmq:3.12-management
container_name: rabbitmq
restart: always
hostname: rabbitmq
ports:
- "${RABBITMQ_CLIENT_PORT:-5672}:5672"
- "${RABBITMQ_HTTP_PORT:-15672}:15672"
expose:
- 5672
- 15672
volumes:
- ./rabbitmq/data:/var/lib/rabbitmq
- ./rabbitmq/hosts:/etc/hosts
environment:
- RABBITMQ_NODENAME=rabbitmq
- RABBITMQ_DEFAULT_VHOST='/'
- RABBITMQ_DEFAULT_USER=guest
- RABBITMQ_DEFAULT_PASS=guest
openresty:
image: openresty/openresty:1.21.4.2-0-alpine-apk
container_name: openresty
restart: always
ports:
- "${NGINX_HTTP_PORT:-80}:80"
- "${NGINX_SSL_PORT:-443}:443"
volumes:
- ./openresty/logs:/usr/local/openresty/nginx/logs
- ./openresty/conf.d:/etc/nginx/conf.d
- ./openresty/certs:/certs
- ./openresty/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
depends_on:
- cskefu-web-gateway
- cskefu-websocket-service

View File

@ -0,0 +1,7 @@
FROM mysql:8.1
ADD nacos_mysql.sql /nacos/nacos_mysql.sql
CMD ["mysqld"]
CMD ["mysql -uroot -p$MYSQL_ROOT_PASSWORD nacos_config < /nacos/nacos_mysql.sql"]

View File

@ -0,0 +1,208 @@
create database if not exists nacos_config default charset utf8 collate utf8_unicode_ci;
use nacos_config;
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = config_info */
/******************************************/
CREATE TABLE `config_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
`group_id` varchar(128) DEFAULT NULL,
`content` longtext NOT NULL COMMENT 'content',
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
`src_user` text COMMENT 'source user',
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
`app_name` varchar(128) DEFAULT NULL,
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
`c_desc` varchar(256) DEFAULT NULL,
`c_use` varchar(64) DEFAULT NULL,
`effect` varchar(64) DEFAULT NULL,
`type` varchar(64) DEFAULT NULL,
`c_schema` text,
`encrypted_data_key` text NOT NULL COMMENT '秘钥',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = config_info_aggr */
/******************************************/
CREATE TABLE `config_info_aggr` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
`datum_id` varchar(255) NOT NULL COMMENT 'datum_id',
`content` longtext NOT NULL COMMENT '内容',
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
`app_name` varchar(128) DEFAULT NULL,
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = config_info_beta */
/******************************************/
CREATE TABLE `config_info_beta` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
`content` longtext NOT NULL COMMENT 'content',
`beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps',
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
`src_user` text COMMENT 'source user',
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
`encrypted_data_key` text NOT NULL COMMENT '秘钥',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = config_info_tag */
/******************************************/
CREATE TABLE `config_info_tag` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
`tag_id` varchar(128) NOT NULL COMMENT 'tag_id',
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
`content` longtext NOT NULL COMMENT 'content',
`md5` varchar(32) DEFAULT NULL COMMENT 'md5',
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
`src_user` text COMMENT 'source user',
`src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = config_tags_relation */
/******************************************/
CREATE TABLE `config_tags_relation` (
`id` bigint(20) NOT NULL COMMENT 'id',
`tag_name` varchar(128) NOT NULL COMMENT 'tag_name',
`tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type',
`data_id` varchar(255) NOT NULL COMMENT 'data_id',
`group_id` varchar(128) NOT NULL COMMENT 'group_id',
`tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id',
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`nid`),
UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = group_capacity */
/******************************************/
CREATE TABLE `group_capacity` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID空字符表示整个集群',
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额0表示使用默认值',
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限单位为字节0表示使用默认值',
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数0表示使用默认值',
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限单位为字节0表示使用默认值',
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_group_id` (`group_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = his_config_info */
/******************************************/
CREATE TABLE `his_config_info` (
`id` bigint(20) unsigned NOT NULL,
`nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`data_id` varchar(255) NOT NULL,
`group_id` varchar(128) NOT NULL,
`app_name` varchar(128) DEFAULT NULL COMMENT 'app_name',
`content` longtext NOT NULL,
`md5` varchar(32) DEFAULT NULL,
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`src_user` text,
`src_ip` varchar(50) DEFAULT NULL,
`op_type` char(10) DEFAULT NULL,
`tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段',
`encrypted_data_key` text NOT NULL COMMENT '秘钥',
PRIMARY KEY (`nid`),
KEY `idx_gmt_create` (`gmt_create`),
KEY `idx_gmt_modified` (`gmt_modified`),
KEY `idx_did` (`data_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造';
/******************************************/
/* 数据库全名 = nacos_config */
/* 表名称 = tenant_capacity */
/******************************************/
CREATE TABLE `tenant_capacity` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID',
`quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额0表示使用默认值',
`usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量',
`max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限单位为字节0表示使用默认值',
`max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数',
`max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限单位为字节0表示使用默认值',
`max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量',
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表';
CREATE TABLE `tenant_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`kp` varchar(128) NOT NULL COMMENT 'kp',
`tenant_id` varchar(128) default '' COMMENT 'tenant_id',
`tenant_name` varchar(128) default '' COMMENT 'tenant_name',
`tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc',
`create_source` varchar(32) DEFAULT NULL COMMENT 'create_source',
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`),
KEY `idx_tenant_id` (`tenant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info';
CREATE TABLE `users` (
`username` varchar(50) NOT NULL PRIMARY KEY,
`password` varchar(500) NOT NULL,
`enabled` boolean NOT NULL
);
CREATE TABLE `roles` (
`username` varchar(50) NOT NULL,
`role` varchar(50) NOT NULL,
UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE
);
CREATE TABLE `permissions` (
`role` varchar(50) NOT NULL,
`resource` varchar(255) NOT NULL,
`action` varchar(8) NOT NULL,
UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE
);
INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE);
INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN');

View File

@ -0,0 +1,15 @@
FROM openjdk:21 as openjdk-21
RUN jlink \
--add-modules ALL-MODULE-PATH \
--strip-debug \
--no-man-pages \
--no-header-files \
--compress=2 \
--output /java-21-openjdk
FROM debian:stretch-slim
COPY --from=openjdk-21 /java-21-openjdk /usr/local/java-21-openjdk
ENV JAVA_HOME=/usr/local/java-21-openjdk
ENV PATH=$PATH:/usr/local/java-21-openjdk/bin

3
containerization/mysql/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
data
.gitignore
!.gitignore

View File

@ -1,2 +1,3 @@
*
data
logs
!.gitignore

View File

@ -0,0 +1,2 @@
.gitignore
!.gitignore

View File

@ -0,0 +1,171 @@
http {
include /usr/local/openresty/nginx/conf/mime.types;
default_type application/octet-stream;
log_format main '$server_name $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $ssl_protocol $ssl_cipher $upstream_addr $request_time $upstream_response_time';
# access_log logs/access.log main;
# log_format nginxlog_json escape=json '{ "timestamp": "$time_iso8601", ' '"remote_addr": "$remote_addr", ' '"body_bytes_sent": $body_bytes_sent, ' '"request_time": $request_time, ' '"response_status": $status, ' '"request": "$request", ' '"request_method": "$request_method", ' '"host": "$host",' '"upstream_addr": "$upstream_addr",' '"http_x_forwarded_for": "$http_x_forwarded_for",' '"http_referrer": "$http_referer", ' '"http_user_agent": "$http_user_agent", ' '"http_version": "$server_protocol", ' '"nginx_access": true }';
# access_log /dev/stdout nginxlog_json;
# See Move default writable paths to a dedicated directory (#119)
# https://github.com/openresty/docker-openresty/issues/119
client_body_temp_path /var/run/openresty/nginx-client-body;
proxy_temp_path /var/run/openresty/nginx-proxy;
fastcgi_temp_path /var/run/openresty/nginx-fastcgi;
uwsgi_temp_path /var/run/openresty/nginx-uwsgi;
scgi_temp_path /var/run/openresty/nginx-scgi;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
init_by_lua_block {
instanceQueue = {}
cjson = require "cjson"
}
upstream cskefu_web_gateway {
server 0.0.0.1;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local instance = table.remove(instanceQueue, 1)
local ok, err = balancer.set_current_peer(instance["ip"], instance["port"])
if not ok then
ngx.log(ngx.ERR, "failed to set the current peer: ", err)
return ngx.exit(500)
end
}
}
upstream cskefu_websocket_service {
server 0.0.0.1;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local instance = table.remove(instanceQueue, 1)
local ok, err = balancer.set_current_peer(instance["ip"], instance["port"])
if not ok then
ngx.log(ngx.ERR, "failed to set the current peer: ", err)
return ngx.exit(500)
end
}
}
server {
root /usr/share/nginx/html;
client_max_body_size 100M;
location /api/ {
access_by_lua_block {
local cjson = require "cjson"
local queueLength = table.getn(instanceQueue)
local mapper = {}
if queueLength > 0 then
for i = 1, queueLength do
local id = instanceQueue[i]["ip"]..":"..instanceQueue[i]["port"]
mapper[id] = i
end
end
local result = ngx.location.capture("/nacos", {args='serviceName=cskefu-web-gateway'})
local hosts = cjson.decode(result.body)['hosts']
local hostsLength = table.getn(hosts)
local others = {}
instanceQueue = {}
for i = 1, hostsLength do
local id = hosts[i]["ip"]..":"..hosts[i]["port"]
if hosts[i]["healthy"] == true then
if mapper[id] then
instanceQueue[mapper[id]] = {
["ip"] = hosts[i]["ip"],
["port"] = hosts[i]["port"]
}
else
table.insert(others, {
["ip"] = hosts[i]["ip"],
["port"] = hosts[i]["port"]
})
end
end
end
local othersLength = table.getn(others)
if othersLength > 0 then
for i = 1, othersLength do
table.insert(instanceQueue, {
["ip"] = others[i]["ip"],
["port"] = others[i]["port"]
})
end
end
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_pass http://cskefu-web-gateway:8080/;
proxy_pass http://cskefu_web_gateway/;
}
location /ws/ {
access_by_lua_block {
local cjson = require "cjson"
local queueLength = table.getn(instanceQueue)
local mapper = {}
if queueLength > 0 then
for i = 1, queueLength do
local id = instanceQueue[i]["ip"]..":"..instanceQueue[i]["port"]
mapper[id] = i
end
end
local result = ngx.location.capture("/nacos", {args='serviceName=cskefu-websocket-service'})
local hosts = cjson.decode(result.body)['hosts']
local hostsLength = table.getn(hosts)
local others = {}
instanceQueue = {}
for i = 1, hostsLength do
local id = hosts[i]["ip"]..":"..hosts[i]["port"]
if hosts[i]["healthy"] == true then
if mapper[id] then
instanceQueue[mapper[id]] = {
["ip"] = hosts[i]["ip"],
["port"] = hosts[i]["port"]
}
else
table.insert(others, {
["ip"] = hosts[i]["ip"],
["port"] = hosts[i]["port"]
})
end
end
end
local othersLength = table.getn(others)
if othersLength > 0 then
for i = 1, othersLength do
table.insert(instanceQueue, {
["ip"] = others[i]["ip"],
["port"] = others[i]["port"]
})
end
end
}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
# proxy_pass http://cskefu-websocket-service:10000/ws/;
proxy_pass http://cskefu_websocket_service;
}
location = /nacos {
internal;
proxy_pass http://nacos:8848/nacos/v1/ns/instance/list;
}
}
# Don't reveal OpenResty version to clients.
# server_tokens off;
}

View File

@ -0,0 +1,2 @@
.gitignore
!.gitignore

View File

@ -0,0 +1,38 @@
# nginx.conf -- docker-openresty
#
# This file is installed to:
# `/usr/local/openresty/nginx/conf/nginx.conf`
# and is the file loaded by nginx at startup,
# unless the user specifies otherwise.
#
# It tracks the upstream OpenResty's `nginx.conf`, but removes the `server`
# section and adds this directive:
# `include /etc/nginx/conf.d/*.conf;`
#
# The `docker-openresty` file `nginx.vh.default.conf` is copied to
# `/etc/nginx/conf.d/default.conf`. It contains the `server section
# of the upstream `nginx.conf`.
#
# See https://github.com/openresty/docker-openresty/blob/master/README.md#nginx-config-files
#
#user nobody;
#worker_processes 1;
# Enables the use of JIT for regular expressions to speed-up their processing.
pcre_jit on;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
include /etc/nginx/conf.d/*.conf;

View File

@ -14,21 +14,20 @@ server {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://contact-center:8035;
proxy_pass http://cskefu-web-gateway:8080;
}
location /actuator {
return 403 "403: Target API is blocked.";
return 403 "403: Target API is blocked.";
}
location /socket.io {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://contact-center:8036;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://cskefu-websocket-service:10000;
}
}

View File

@ -1,2 +1,3 @@
*
data
logs
!.gitignore

View File

View File

@ -1,2 +1,2 @@
*
data
!.gitignore

View File

@ -4,26 +4,36 @@
# and edit .env with COMPOSE_FILE=docker-compose.custom.yml, docker-compose.custom.yml
# is ignored with .gitignore
COMPOSE_FILE=docker-compose.yml
# To setup with nginx service
#COMPOSE_FILE=docker-compose.yml:docker-nginx.yml
COMPOSE_PROJECT_NAME=cskefu
COMPOSE_PROJECT_NAME=cskefu-backend
# OS Params
CC_IMAGE=cskefu/contact-center:develop
CC_JAVA_XMX=12288m
CC_JAVA_XMS=2048m
CSKEFU_JAVA_XMX=512m
CSKEFU_JAVA_XMS=512m
# Variables
MYSQL_PORT=8037
REDIS_PORT=8041
CC_WEB_PORT=8035
CC_SOCKET_PORT=8036
ACTIVEMQ_PORT1=8051
ACTIVEMQ_PORT2=8052
ACTIVEMQ_PORT3=8053
DB_PASSWD=123456
LOG_LEVEL=INFO
CACHE_SETUP_STRATEGY=create_by_force
LOGGING_LEVEL_ROOT=INFO
#CSKEFU_WEB_GATEWAY_PORT:-8080
#CSKEFU_MANAGER_SERVICE_PORT:-8081
#CSKEFU_AUTH_SERVICE_PORT:-8082
#CSKEFU_PLUGIN_SERVICE_PORT:-8083
#CSKEFU_CHANNEL_WECHAT_SERVICE_PORT:-8084
CSKEFU_WEBSOCKET_SERVICE_PORT:10000
NGINX_HTTP_PORT=80
NGINX_SSL_PORT=443
RABBITMQ_CLIENT_PORT=5683
RABBITMQ_HTTP_PORT=15683
REDIS_PORT=6379
NACOS_PORT=8848
NACOS_CLIENT_GRPC_PORT=9848
NACOS_SERVER_GRPC_PORT=9849
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=123456
## chatbot
## https://docs.cskefu.com/docs/work-chatbot/
@ -33,4 +43,4 @@ BOT_THRESHOLD_FAQ_SUGG_REPLY=0.6
TONGJI_BAIDU_SITEKEY=placeholder
EXTRAS_LOGIN_BANNER=""
EXTRAS_LOGIN_CHATBOX=
EXTRAS_AUTH_SUPER_ADMIN_PASS=
EXTRAS_AUTH_SUPER_ADMIN_PASS=

View File

@ -0,0 +1,12 @@
#!/bin/bash
docker build -f openjdk-21-debian-stretch-slim -t openjdk-21:debian-stretch-slim .
docker build -f mysql-8.1-nacos -t mysql-8.1:nacos .
docker tag openjdk-21:debian-stretch-slim cskefu/openjdk-21:debian-stretch-slim
docker tag mysql-8.1:nacos cskefu/mysql-8.1:nacos
docker login
docker push cskefu/openjdk-21:debian-stretch-slim
docker push cskefu/mysql-8.1:nacos

View File

@ -2,15 +2,15 @@
- Java21
- Spring Boot 3
- Spring Cloud两种方案
- Spring Cloud Alibabadocker-compose方案
- Spring Cloud两种方案,采纳的是方案一
- 方案一:Spring Clouddocker-compose方案
- 注册中心 Nacos
- 声明式服务调用 OpenFeign/Square 待定
- 声明式服务调用 OpenFeign
- 负载均衡 Ribbon/LoadBanlancer 待定
- 配置中心 Nacos
- 服务容错 Sentinel
- 链路追踪 Skywalking
- Spring Cloud Kuberneteskubernetes方案
- 方案二:Spring Cloud Kuberneteskubernetes方案
- 注册中心 Kubernetes注册中心
- 声明式服务调用 OpenFeign/Square 待定
- 负载均衡 Kubernetes负载均衡/Ribbon/LoadBanlancer 待定
@ -19,10 +19,10 @@
- 链路追踪 Skywalking
- Spring Security + Oauth2.0
- MyBatis-Flex
- Netty SocketIO
- Webflux、 Tomcat
- Jackson不使用Fastjson
- Redisson
- Mysql 8.0
- redisson
- mysql 8.0
- HikariCP不使用Druid
- Smart-doc不使用Swagger
- RabbitMQ
@ -34,10 +34,11 @@
```
cskefu-web-gateway: 8080
cskefu-manager-service: 8081
cskefu-websocket-service: 8082
cskefu-auth-service: 8083
cskefu-plugin-service: 8090
cskefu-channel-wechat-service: 10000
cskefu-auth-service: 8082
cskefu-plugin-service: 8083
cskefu-channel-wechat-service: 8084
cskefu-websocket-service: 10000
```
# 模块及服务划分约定
@ -94,8 +95,6 @@ contact-backend
└─cskefu-websocket-service 客户端的WebSocket直接和这个服务连接
```
TODO 纯WebSocket服务怎么注册到注册中心
# 依赖、包、和类的约定
**统一的、简单的、一致的风格更有利于代码的维护,在依赖、包、和类的划分及命名上遵守以下约定。如不能请及时在开发者群反馈。**
@ -112,24 +111,22 @@ TODO 纯WebSocket服务怎么注册到注册中心
因此所有pom中请加入以下内容
```xml
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
```
如果包中有java代码其对应的pom请加入以下内容
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -150,7 +147,7 @@ src
│ ├─CskefuXXXApplication.java 启动类
│ └─sys
│ ├─SysUserController.java
│ ├─SysUser.java 不需要和其他业务或其他业务公用的实体类,如果需要公用,请放到对应的-domain下
│ ├─SysUser.java 不需要和其他业务公用的实体类,如果需要公用,请放到对应的-domain下
│ ├─SysUserService.java
│ ├─SysUserServiceImpl.java
│ ├─UserMapper.java
@ -176,12 +173,12 @@ src
- 按照包和类的组织中描述的方式命名实体类不区分VO、BO、DO、POJO、DTO等也不要使用这些后缀
- 枚举类统一以Enum结尾
- 除非必要,不需要定义异常类;
- 工具类以Utils结尾提供private无参构造函数并在构造函数中抛出异常参考JacksonUtils阻止类被实例化
- 除非必要,不需要定义异常类;
# 数据库变更
涉及到表结构的变更或必要的初始化数据请及时同步到contact-backend/v9.mysql.sql中。
涉及到表结构的变更或必要的初始化数据请及时同步到contact-backend/v9.mysql.init.sql中。
# 其他

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-assistant-base</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-assistant-base</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -28,7 +28,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-assistant-mvc</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-assistant-mvc</name>
@ -11,18 +11,12 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-assistant-base</artifactId>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
@ -59,7 +53,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -2,6 +2,9 @@ package com.cskefu.mvc;
import com.cskefu.base.JacksonUtils;
import com.cskefu.base.Result;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.ConstraintViolation;
@ -42,7 +45,11 @@ import java.util.stream.Collectors;
@RestControllerAdvice
@Slf4j
public class GlobalResponseBodyHandler implements ResponseBodyAdvice {
private static ObjectMapper objectMapper = new ObjectMapper();
static {
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
@Override
public boolean supports(MethodParameter returnType, Class converterType) {
return true;
@ -53,6 +60,13 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice {
if (body instanceof Result) {
return body;
}
if (body instanceof String) {
try {
return this.objectMapper.writeValueAsString(Result.success(body));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
return Result.success(body);
}
@ -63,7 +77,6 @@ public class GlobalResponseBodyHandler implements ResponseBodyAdvice {
@ExceptionHandler(BindException.class)
public Result<?> handlerBindException(BindException e) {
List<String> collect = new ArrayList<>();
if (e.getBindingResult().getFieldError() != null) {
List<FieldError> fieldErrors = e.getBindingResult().getFieldErrors();

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-assistant-module</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-assistant-module</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-assistant-base</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-auth-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-auth-domain</name>
@ -11,14 +11,14 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -2,9 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.cskefu</groupId>
<artifactId>cskefu-auth-service</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-auth-service</name>
@ -12,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -32,8 +31,13 @@
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-kubernetes-discovery</artifactId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
@ -47,11 +51,6 @@
<groupId>com.cskefu</groupId>
<artifactId>cskefu-assistant-mvc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
@ -70,7 +69,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -86,6 +85,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -4,6 +4,7 @@ import com.cskefu.security.JwtAuthenticationFilter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@ -14,7 +15,7 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@Slf4j
@SpringBootApplication
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class CskefuAuthApplication {
public static void main(String[] args) {
try {

View File

@ -1,12 +1,18 @@
server.port=8083
spring.application.name=cskefu-auth-service
debug=true
server.port=8082
spring.application.name=cskefu-auth-service
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc
cskefu.private-key=MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8TSxdMp76dZS2L8DpvJOgHNJmeI8PM30CFSeVMCHV5dEjtixipsMsSQu0ariAtVfA5M/ma1wcqEpsDO9nVQRsmsJCKMIWOcR6yBQU9f0T7Hkmil4Ckf61C1R7wLrynOjCeUCneQ7R0+dg9K25CymclPnK4ym2GInmuUjdbyQQcX4QBuIbmuY10MG8nW9ovhFML85KoBk5yxV4zVwLGP4TFJVnBmiNO3XSKL2XsX7wFFO93O8jmAnzgpWj8khsZAYG4nijIz2BciS9uQFa/lUX6yD50ykjNklbhCBIMGaQ6rr1WjnwLHDZU9sLvcYMboKPJHWz1FttvxuKSLYbf7j/AgMBAAECggEAEH1rPSrwF47kdW/vibu+uDuat7Tz3w9RpM6lc/Mn6ctoA6PLqN5hvFpJPbhHoAqn1kSZ0EJNA4imIjNsluf8rMyAs1QbN+CnMpMC7zL7jrS1IO+ze+LwVnpyufbbm3nfCE85OKSC7IbAfhHvUYOHIvQI5Zn76FTamFHxh5klpCrY1h8gcVWdRxiK0Q8AQP7KD0QnkzgROhkRmdI01639VyTCTc6Rtv5puU6J6idJwTd3JAiJXZ2qcoAwhnkSHnVnP5ktFxl66eHGJKeol6bGcJIFQRGLVmh78x6MXoqkJ2M7DRntL38TLKT5KCYViGxUpO0gED/HQBhDALyNevJZQQKBgQDr+pZDtRIQ6mMZMswKTo2+zIFEUFES2sR/bunEW5snPR3krKdgzJoEg7WERkMviSlvW6K7a6VeJ9KKO/iE07lcRkN2NQZUkBDsrNRgoOwB17hHJqrMyZ1It+hZmPQTkeyJu/BCxDkIMwbQYXxIe8J/dVYjHJVXZgzPqEXKYqeViwKBgQDMRwr7ceW+9c/GzHd7p6849s3+MbT0kzyXDTdeJkQFSDPufYapTCan/MrdJmnIRz8pq2URZrO4kDDxxeWu2Vkekv9cxVFrQVFfvuq+4BFpQvYkRHk9PDzCmgFJD/wLG8gzNTH7UahaNb7m0tPB3D1g5Q6LzZCc1h3s2K6SLS7g3QKBgE41Bof6ArrIc39ubmEcF64caNsTI0t0ZZs2TxNcqNcgUj/vWKmkJYdJf2cPQkUG2Eynug8TZgMGf6iAp6Sd5tjGEKWkfSyZcoJ95QUBUDZsIA60qfak+xOWn9LR9lJmElazirUWAzDMeH2nUWFUYumLIbkRSA1nLOfFhRvGBnRxAoGBAJvDAAjCzGBTpt77QZA0SFOzPVc6J7TmICk9lp5fpzYv3AlaBbhJrKAjDbybccWZLfxkCGjAWwG8UNXKBFzStjWt+LGQc4jJAXd0aCKrUBtnR7BX1epvaBUqwRgo7BK8WGdThI0RssE2gh4XXAhSGysq/XB0inRMf/z9K/+iHECxAoGAFlcIZ4/xXhbObUPU05hZFoj+zN5obaOLefRJn4uqjD9/VSRnI2bBv7vXKoLX6BwFF/PWvg1hzGy3O9TQ4XYPOqNGcBFDOqwxmVVevzXgRInoiRNP3xZXcqswppEbqORGbRoPLQBqLnPx1GKwbo7Fp9O5ywARVZtf4STt3pRK8PY=
cskefu.public-key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvE0sXTKe+nWUti/A6byToBzSZniPDzN9AhUnlTAh1eXRI7YsYqbDLEkLtGq4gLVXwOTP5mtcHKhKbAzvZ1UEbJrCQijCFjnEesgUFPX9E+x5JopeApH+tQtUe8C68pzownlAp3kO0dPnYPStuQspnJT5yuMpthiJ5rlI3W8kEHF+EAbiG5rmNdDBvJ1vaL4RTC/OSqAZOcsVeM1cCxj+ExSVZwZojTt10ii9l7F+8BRTvdzvI5gJ84KVo/JIbGQGBuJ4oyM9gXIkvbkBWv5VF+sg+dMpIzZJW4QgSDBmkOq69Vo58Cxw2VPbC73GDG6CjyR1s9Rbbb8biki2G3+4/wIDAQAB
cskefu.token.duration=3600

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-auth</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-auth</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-auth-domain</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-channel-wechat-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-channel-wechat-domain</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
</dependencies>
@ -20,7 +20,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-channel-wechat-service</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-channel-wechat-service</name>
@ -11,13 +11,26 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
@ -38,6 +51,7 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<!--TODO lecjy-->
<version>4.5.14</version>
</dependency>
</dependencies>
@ -46,7 +60,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -62,6 +76,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -3,10 +3,10 @@ package com.cskefu;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@Slf4j
@SpringBootApplication
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class CskefuWechatChannelApplication {
public static void main(String[] args) {
try {

View File

@ -121,7 +121,7 @@ public class WechatCallbackChatbot {
return "200";
}
public static void main(String[] args) throws Exception {
public static void test(String[] args) throws Exception {
String replyMsg = "中文<xml><ToUserName><![CDATA[oia2TjjewbmiOUlr6X-1crbLOvLw]]></ToUserName><FromUserName><![CDATA[gh_7f083739789a]]></FromUserName><CreateTime>1407743423</CreateTime><MsgType><![CDATA[video]]></MsgType><Video><MediaId><![CDATA[eYJ1MbwPRJtOvIEabaxHs7TX2D-HV71s79GUxqdUkjm6Gs2Ed1KF3ulAOA9H1xG0]]></MediaId><Title><![CDATA[testCallBackReplyVideo]]></Title><Description><![CDATA[testCallBackReplyVideo]]></Description></Video></xml>";
val nonce = "";

View File

@ -1,9 +1,13 @@
server.port=8090
spring.application.name=cskefu-channel-wechat-service
debug=true
server.port=8084
spring.application.name=cskefu-channel-wechat-service
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-channel</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-channel</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-channel-wechat-service</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-web-gateway</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-web-gateway</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -19,12 +19,12 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>com.cskefu</groupId>
@ -36,7 +36,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -52,6 +52,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -2,10 +2,16 @@ package com.cskefu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.net.InetAddress;
import java.net.UnknownHostException;
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class CskefuWebGatewayApplication {
public static void main(String[] args) {
try {
@ -14,4 +20,10 @@ public class CskefuWebGatewayApplication {
e.printStackTrace();
}
}
@GetMapping({"", "/"})
public String index() throws UnknownHostException {
InetAddress localHost = InetAddress.getLocalHost();
return localHost.getHostAddress();
}
}

View File

@ -1,5 +1,10 @@
debug=true
server.port=8080
spring.application.name=cskefu-web-gateway
debug=true
spring.datasource.password=123456
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-gateway</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-gateway</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-web-gateway</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-manager-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-manager-domain</name>
@ -11,14 +11,14 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-manager-service</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-manager-service</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath/>
</parent>
<dependencies>
@ -19,6 +19,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
@ -37,7 +50,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -53,6 +66,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -2,9 +2,10 @@ package com.cskefu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class CskefuManagerApplication {
public static void main(String[] args) {
try {

View File

@ -1,9 +1,13 @@
debug=true
server.port=8081
spring.application.name=cskefu-manager-service
debug=true
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-manager</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-manager</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-manager-service</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-plugin-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-plugin-domain</name>
@ -11,14 +11,14 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-plugin-service</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-plugin-service</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<relativePath/>
</parent>
<dependencies>
@ -19,6 +19,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
@ -37,7 +50,7 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -53,6 +66,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -2,9 +2,10 @@ package com.cskefu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class CskefuPluginApplication {
public static void main(String[] args) {
try {

View File

@ -1,9 +1,13 @@
server.port=8090
spring.application.name=cskefu-plugin-service
debug=true
server.port=8083
spring.application.name=cskefu-plugin-service
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.url=jdbc:mysql://localhost:3306/cskefu?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=123456
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-plugin</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-plugin</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-plugin-service</module>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-websocket-domain</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-websocket-domain</name>
@ -11,14 +11,14 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-websocket-service</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-websocket-service</name>
@ -11,32 +11,24 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>com.mybatis-flex</groupId>
<artifactId>mybatis-flex-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
@ -44,7 +36,14 @@
<dependency>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2022.0.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -56,6 +55,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,17 +1,16 @@
package com.cskefu;
import com.corundumstudio.socketio.SocketIOServer;
import com.cskefu.handler.WebSocketMappingHandlerMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Component;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter;
@Slf4j
@SpringBootApplication
//@EnableDiscoveryClient
@EnableDiscoveryClient
public class WebsocketApplication {
public static void main(String[] args) {
@ -21,24 +20,14 @@ public class WebsocketApplication {
e.printStackTrace();
}
}
}
@Component
@Slf4j
class SocketIOServerRunner implements CommandLineRunner, DisposableBean {
@Autowired
private SocketIOServer socketIOServer;
@Override
public void run(String... args) throws Exception {
socketIOServer.start();
log.warn("SocketIOServer启动成功");
@Bean
public HandlerMapping webSocketMapping() {
return new WebSocketMappingHandlerMapping();
}
@Override
public void destroy() throws Exception {
socketIOServer.stop();
log.warn("SocketIOServer关闭成功");
@Bean
public WebSocketHandlerAdapter handlerAdapter() {
return new WebSocketHandlerAdapter();
}
}
}

View File

@ -0,0 +1,12 @@
package com.cskefu.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface WebSocketMapping {
String value() default "";
}

View File

@ -0,0 +1,21 @@
package com.cskefu.handler;
import com.cskefu.annotations.WebSocketMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.socket.HandshakeInfo;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.WebSocketSession;
import reactor.core.publisher.Mono;
@Component
@Slf4j
@WebSocketMapping("/ws/message")
public class MessageHandler implements WebSocketHandler {
@Override
public Mono<Void> handle(WebSocketSession session) {
HandshakeInfo handshakeInfo = session.getHandshakeInfo();
return session.send(session.receive().map(msg -> session.textMessage("服务端:-> " + msg.getPayloadAsText())));
}
}

View File

@ -0,0 +1,33 @@
package com.cskefu.handler;
import com.cskefu.annotations.WebSocketMapping;
import org.springframework.beans.BeansException;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.web.reactive.handler.SimpleUrlHandlerMapping;
import org.springframework.web.reactive.socket.WebSocketHandler;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
public class WebSocketMappingHandlerMapping extends SimpleUrlHandlerMapping {
private Map<String, WebSocketHandler> handlerMap = new LinkedHashMap<>();
@Override
public void initApplicationContext() throws BeansException {
Map<String, Object> beanMap = obtainApplicationContext().getBeansWithAnnotation(WebSocketMapping.class);
beanMap.values().forEach(bean -> {
if (!(bean instanceof WebSocketHandler)) {
throw new RuntimeException(String.format("Controller [%s] doesn't implement WebSocketHandler interface.", bean.getClass().getName()));
}
WebSocketMapping annotation = AnnotationUtils.getAnnotation(bean.getClass(), WebSocketMapping.class);
//webSocketMapping 映射到管理中
handlerMap.put(Objects.requireNonNull(annotation).value(), (WebSocketHandler) bean);
});
super.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.setUrlMap(handlerMap);
super.initApplicationContext();
}
}

View File

@ -0,0 +1,30 @@
package com.cskefu.handler;
import com.cskefu.annotations.WebSocketMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.socket.HandshakeInfo;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.WebSocketSession;
import reactor.core.publisher.Mono;
import java.net.InetAddress;
import java.net.UnknownHostException;
@Component
@Slf4j
@WebSocketMapping("/ws/")
public class WelcomeHandler implements WebSocketHandler {
@Override
public Mono<Void> handle(WebSocketSession session) {
try {
InetAddress localHost = InetAddress.getLocalHost();
HandshakeInfo handshakeInfo = session.getHandshakeInfo();
return session.send(session.receive().map(msg -> session.textMessage("cskefu-websocket-service: " + localHost.getHostAddress())));
} catch (UnknownHostException e) {
e.printStackTrace();
throw new RuntimeException("出错了!");
}
}
}

View File

@ -1,100 +0,0 @@
package com.cskefu.websocket;
import com.corundumstudio.socketio.AuthorizationListener;
import com.corundumstudio.socketio.HandshakeData;
import com.corundumstudio.socketio.SocketConfig;
import com.corundumstudio.socketio.SocketIOServer;
import com.corundumstudio.socketio.annotation.SpringAnnotationScanner;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Arrays;
import java.util.Optional;
@Configuration
@Slf4j
public class SocketIOConfiguration {
@Value("${cskefu.socketio.port:8082}")
private Integer port;
@Value("${cskefu.socketio.bossCount:1}")
private int bossCount;
@Value("${cskefu.socketio.workCount:0}")
private int workCount;
@Value("${cskefu.socketio.upgradeTimeout:1000}")
private int upgradeTimeout;
@Value("${cskefu.socketio.pingTimeout:3000}")
private int pingTimeout;
@Value("${cskefu.socketio.pingInterval:3000}")
private int pingInterval;
@Value("#{'${cskefu.socketio.namespaces:}'.split(',')}")
private String[] namespaces;
@Bean
public SocketIOServer socketIOServer() {
SocketConfig socketConfig = new SocketConfig();
socketConfig.setTcpNoDelay(true);
socketConfig.setSoLinger(0);
socketConfig.setReuseAddress(true);
com.corundumstudio.socketio.Configuration config = new com.corundumstudio.socketio.Configuration();
config.setSocketConfig(socketConfig);
config.setPort(port);
config.setBossThreads(bossCount);
int threads = Runtime.getRuntime().availableProcessors();
if (workCount < 1) {
config.setWorkerThreads(threads);
} else {
if (workCount < threads) {
log.warn("worker threads to low");
}
config.setWorkerThreads(workCount);
}
config.setWorkerThreads(Runtime.getRuntime().availableProcessors());
config.setAllowCustomRequests(false);
config.setUpgradeTimeout(upgradeTimeout);
config.setPingTimeout(pingTimeout);
config.setPingInterval(pingInterval);
final SocketIOServer server = new SocketIOServer(config);
Optional.ofNullable(namespaces).ifPresent(namespace -> Arrays.stream(namespace).forEach(server::addNamespace));
config.setAuthorizationListener(new AuthorizationListener() {
@Override
public boolean isAuthorized(HandshakeData data) {
return true;
}
});
server.addConnectListener(client -> {
log.info("SessionId: {}", client.getSessionId());
log.info("RemoteAddress: {}", client.getRemoteAddress());
log.info("Transport: {}", client.getTransport());
});
server.addDisconnectListener(client -> {
log.info("断开连接:{} ", client.getSessionId());
client.disconnect();
});
server.addEventListener("text", Object.class, (client, data, ackSender) -> {
client.getHandshakeData();
log.info("客户端:{} 发来消息 {}", client, data);
});
return server;
}
@Bean
public SpringAnnotationScanner springAnnotationScanner() {
return new SpringAnnotationScanner(socketIOServer());
}
}

View File

@ -1,9 +1,17 @@
spring.application.name=cskefu-websocket-service
debug=true
server.port=10000
spring.application.name=cskefu-websocket-service
spring.mvc.static-path-pattern=/smart-doc/**
spring.web.resources.static-locations=classpath:/smart-doc
spring.cloud.kubernetes.discovery.enabled=true
cskefu.socketio.port=8082
cskefu.socketio.upgradeTimeout=1000
cskefu.socketio.pingTimeout=3000
cskefu.socketio.pingInterval=3000
spring.cloud.nacos.discovery.server-addr=localhost:8848
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.addresses=127.0.0.1
spring.rabbitmq.port=5672
spring.rabbitmq.publisher-confirm-type=correlated
spring.rabbitmq.publisher-returns=true
spring.rabbitmq.listener.simple.acknowledge-mode=manual
spring.rabbitmq.listener.simple.prefetch=1

View File

@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>cskefu-websocket</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-websocket</name>
@ -11,7 +11,7 @@
<parent>
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modules>
<module>cskefu-websocket-domain</module>

View File

@ -0,0 +1,16 @@
# git.properties
git.tags=PLACEHOLDER
git.branch=PLACEHOLDER
git.dirty=PLACEHOLDER
git.commit.id=PLACEHOLDER
git.commit.id.abbrev=PLACEHOLDER
git.commit.id.describe=PLACEHOLDER
git.commit.id.describe-short=PLACEHOLDER
git.commit.user.name=PLACEHOLDER
git.commit.user.email=PLACEHOLDER
git.commit.time=PLACEHOLDER
git.build.user.name=PLACEHOLDER
git.build.user.email=PLACEHOLDER
git.build.time=PLACEHOLDER
git.build.host=PLACEHOLDER
git.build.version=PLACEHOLDER

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property name="max_history" value="30"/>
<property name="max_file_size" value="50MB"/>
<property name="charset" value="UTF-8"/>
<property name="queueSize" value="256"/>
<property name="log_path" value="/cskefu/logs"/>
<define name="hostname" class="ch.qos.logback.core.property.CanonicalHostNamePropertyDefiner"/>
<springProperty scope="context" name="app_name" source="spring.application.name" defaultValue="log-%d{yyyy-MM-dd_HH:mm:ss.SSS}"/>
<conversionRule conversionWord="color" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
<conversionRule conversionWord="whitespace" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
<conversionRule conversionWord="extended_whitespace" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
<property name="console_log_pattern" value="%boldMagenta(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %boldYellow(${LOG-LEVEL-PATTERN:-%5p}) %boldCyan(${PID:- }){magenta} %boldGreen(---){faint} %boldGreen([%15.15t]){faint} %boldCyan(%-40.40logger{50}){cyan} %boldYellow(:){faint} %m%n${LOG-EXCEPTION-CONVERSION-WORD:-%extended_whitespace}"/>
<property name="file_log_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/>
<appender name="console_appender" class="ch.qos.logback.core.ConsoleAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${console_log_pattern}</pattern>
</encoder>
</appender>
<appender name="debug_file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}/${app_name}-${hostname}-debug.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>${charset}</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}/%d{yyyy-MM-dd}/${app_name}-${hostname}-debug.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${max_file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>${max_history}</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="info_file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}/${app_name}-${hostname}-info.log</file>
<encoder>
<pattern>${file_log_pattern}</pattern>
<charset>${charset}</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}/%d{yyyy-MM-dd}/${app_name}-${hostname}-info.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${max_file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>${max_history}</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="warn_file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}/${app_name}-${hostname}-warn.log</file>
<encoder>
<pattern>${file_log_pattern}</pattern>
<charset>${charset}</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}/%d{yyyy-MM-dd}/${app_name}-${hostname}-warn.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${max_file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>${max_history}</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="error_file_appender" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log_path}/${app_name}-${hostname}-error.log</file>
<encoder>
<pattern>${file_log_pattern}</pattern>
<charset>${charset}</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log_path}/%d{yyyy-MM-dd}/${app_name}-${hostname}-error.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${max_file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>${max_history}</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="async_log_debug" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>${queueSize}</queueSize>
<appender-ref ref="debug_file_appender"/>
</appender>
<appender name="async_log_info" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>${queueSize}</queueSize>
<appender-ref ref="info_file_appender"/>
</appender>
<appender name="async_log_warn" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>${queueSize}</queueSize>
<appender-ref ref="warn_file_appender"/>
</appender>
<appender name="async_log_error" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>${queueSize}</queueSize>
<appender-ref ref="error_file_appender"/>
</appender>
<logger name="com.cskefu" level="DEBUG">
<appender-ref ref="debug_file_appender"/>
<appender-ref ref="console_appender"/>
</logger>
<!--
<springProfile name="dev">
<root level="INFO">
<appender-ref ref="console_appender"/>
<appender-ref ref="async_log_debug"/>
<appender-ref ref="async_log_info"/>
<appender-ref ref="async_log_warn"/>
<appender-ref ref="async_log_error"/>
</root>
</springProfile>
<springProfile name="test">
<root level="INFO">
<appender-ref ref="console_appender"/>
<appender-ref ref="async_log_debug"/>
<appender-ref ref="async_log_info"/>
<appender-ref ref="async_log_warn"/>
<appender-ref ref="async_log_error"/>
</root>
</springProfile>
<springProfile name="pre">
<root level="INFO">
<appender-ref ref="async_log_debug"/>
<appender-ref ref="async_log_info"/>
<appender-ref ref="async_log_warn"/>
<appender-ref ref="async_log_error"/>
</root>
</springProfile>
<springProfile name="pro">
<root level="INFO">
<appender-ref ref="async_log_debug"/>
<appender-ref ref="async_log_info"/>
<appender-ref ref="async_log_warn"/>
<appender-ref ref="async_log_error"/>
</root>
</springProfile> -->
<root level="DEBUG">
<appender-ref ref="async_log_debug"/>
<appender-ref ref="async_log_info"/>
<appender-ref ref="async_log_warn"/>
<appender-ref ref="async_log_error"/>
</root>
</configuration>

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.cskefu</groupId>
<artifactId>cskefu-backend</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<name>cskefu-backend</name>
@ -34,11 +34,11 @@
<argLine>-Dfile.encoding=UTF-8</argLine>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<java.version>21</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<java.version>17</java.version>
<cskefu.assistant.version>1.0.0</cskefu.assistant.version>
<cskefu.assistant.version>1.0.0-SNAPSHOT</cskefu.assistant.version>
<jjwt.version>0.11.5</jjwt.version>
<mybatis.flex.version>1.6.6</mybatis.flex.version>
@ -47,6 +47,7 @@
<lombok.version>1.18.30</lombok.version>
<spring.boot.version>3.1.3</spring.boot.version>
<spring.cloud.version>2022.0.4</spring.cloud.version>
<spring.cloud.alibaba.version>2022.0.0.0</spring.cloud.alibaba.version>
<jakarta.servlet.version>6.0.0</jakarta.servlet.version>
<jakarta.validation.version>3.0.2</jakarta.validation.version>
<netty.socketio.version>2.0.3</netty.socketio.version>
@ -56,6 +57,12 @@
<bean.searcher.version>3.8.2</bean.searcher.version>
<redisson.starter.version>3.23.5</redisson.starter.version>
<smart.doc.version>2.6.4</smart.doc.version>
<git.commit.plugin.version>6.0.0</git.commit.plugin.version>
<jib.maven.plugin.version>3.4.0</jib.maven.plugin.version>
<springboot.maven.plugin.version>3.1.4</springboot.maven.plugin.version>
<docker.image.prefix>cskefu</docker.image.prefix>
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
</properties>
<repositories>
<repository>
@ -86,6 +93,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring.cloud.alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
@ -177,11 +191,35 @@
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>${git.commit.plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<phase>initialize</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>../.git</dotGitDirectory>
<verbose>false</verbose>
<dateFormat>yyyy-MM-dd HH:mm:ss</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.maven.plugin.version}</version>
<executions>
<execution>
<goals>
@ -207,9 +245,54 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>jib-maven-plugin</artifactId>
<version>${jib.maven.plugin.version}</version>
<executions>
<execution>
<id>build-image</id>
<phase>deploy</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<from>
<image>${docker.image.prefix}/openjdk-21:debian-stretch-slim</image>
</from>
<to>
<image>${docker.image.prefix}/${project.artifactId}:latest</image>
<tags>
<tag>v9-${git.commit.id.abbrev}</tag>
<tag>${maven.build.timestamp}-${git.commit.id.abbrev}</tag>
</tags>
</to>
<allowInsecureRegistries>true</allowInsecureRegistries>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="../../logback-spring.xml" tofile="${project.build.outputDirectory}/logback-spring.xml"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<!--
<distributionManagement>
<repository>
<id>chatopera-releases</id>
@ -222,4 +305,5 @@
<url>https://nexus.chatopera.com/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
-->
</project>

View File

@ -0,0 +1,2 @@
create database if not exists cskefu default charset utf8mb4 collate utf8mb4_unicode_ci;
use cskefu;

View File

@ -1,4 +0,0 @@
create
database if not exists cskefu default charset utf8mb4 collate utf8mb4_unicode_ci;
use
cskefu;

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,18 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose up redis
else
echo "Invalid docker compose."
exit 1
fi

View File

@ -1,18 +0,0 @@
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/../..
if [ -f docker-compose.yml ]; then
docker-compose down redis
else
echo "Invalid docker compose."
exit 1
fi

View File

@ -1,3 +0,0 @@
*
!.gitignore

View File

@ -1,93 +0,0 @@
version: "3"
services:
contact-center:
image: ${CC_IMAGE:-cskefu/contact-center:develop}
restart: always
ports:
- "${CC_WEB_PORT:-8035}:8035"
- "${CC_SOCKET_PORT:-8036}:8036"
volumes:
- ./contact-center/data:/data
- ./contact-center/logs:/logs
environment:
- "JAVA_OPTS=-Xmx${CC_JAVA_XMX:-12288m} -Xms${CC_JAVA_XMS:-2048m} -XX:PermSize=256m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true --add-opens java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.tryReflectionSetAccessible=true --illegal-access=warn"
- SERVER_PORT=8035
- SERVER_LOG_PATH=/logs
- SERVER_LOG_LEVEL=${LOG_LEVEL:-WARN}
- WEB_UPLOAD_PATH=/data
- UK_IM_SERVER_PORT=8036
- UK_IM_SERVER_HOST=localhost
- UK_IM_SERVER_THREADS=10
# 春松客服配置 HTTPs / HTTPs for CSKeFu
# In detail
# 1) https://chatopera.blog.csdn.net/article/details/105820829
# 2) https://github.com/cskefu/cskefu/issues/414#issuecomment-1437767407
# In short
# 1) Setup Load Balancing / Reverse Proxy
# 2) Modify CS_IM_SERVER_SSL_PORT
# set CS_IM_SERVER_SSL_PORT=443
- CS_IM_SERVER_SSL_PORT=${CC_SOCKET_PORT:-8036}
- SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/cosinee?useUnicode=true&characterEncoding=UTF-8
- SPRING_DATASOURCE_USERNAME=root
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWD:-123456}
- SPRING_DATA_REDIS_HOST=redis
- SPRING_DATA_REDIS_PORT=6379
- SPRING_DATA_REDIS_PASSWORD=${DB_PASSWD:-123456}
- SPRING_ACTIVEMQ_BROKER_URL=tcp://activemq:61616
- CSKEFU_MODULE_CALLOUT=false
- CSKEFU_MODULE_CONTACTS=true
- CSKEFU_MODULE_CHATBOT=true
- CACHE_SETUP_STRATEGY=${CACHE_SETUP_STRATEGY:-create_by_force}
- SKYPE_CHANNEL_CRM=${SKYPE_CHANNEL_CRM:-placeholder}
- BOT_THRESHOLD_FAQ_BEST_REPLY=${BOT_THRESHOLD_FAQ_BEST_REPLY:-0.9}
- BOT_THRESHOLD_FAQ_SUGG_REPLY=${BOT_THRESHOLD_FAQ_SUGG_REPLY:-0.1}
- CSKEFU_SETTINGS_WEBIM_VISITOR_SEPARATE=true
- TONGJI_BAIDU_SITEKEY=${TONGJI_BAIDU_SITEKEY:-placeholder}
- EXTRAS_LOGIN_BANNER=${NOTICE_LOGIN_BANNER:-off}
- EXTRAS_LOGIN_CHATBOX=${EXTRAS_LOGIN_CHATBOX:-off}
- EXTRAS_AUTH_SUPER_ADMIN_PASS=${EXTRAS_AUTH_SUPER_ADMIN_PASS:-}
- EXTRAS_LOG_REQUEST=${EXTRAS_LOG_REQUEST:-off}
depends_on:
- mysql
- redis
- activemq
activemq:
image: cskefu/activemq:5.14.3
restart: always
environment:
- ACTIVEMQ_ADMIN_LOGIN=admin
- ACTIVEMQ_ADMIN_PASSWORD=${DB_PASSWD:-123456}
- ACTIVEMQ_ENABLED_SCHEDULER=true
- ACTIVEMQ_MIN_MEMORY=1024
- ACTIVEMQ_MAX_MEMORY=4096
volumes:
- ./database/activemq/data:/data
- ./database/activemq/logs:/var/log/activemq
ports:
- "${ACTIVEMQ_PORT1:-8051}:8161"
- "${ACTIVEMQ_PORT2:-8052}:61616"
- "${ACTIVEMQ_PORT3:-8053}:61613"
mysql:
image: cskefu/mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=${DB_PASSWD:-123456}
- MYSQL_USER=admin
- MYSQL_PASSWORD=${DB_PASSWD:-123456}
ports:
- "${MYSQL_PORT:-8037}:3306"
volumes:
- ./database/mysql/data:/var/lib/mysql
command: --max_allowed_packet=32505856
redis:
image: cskefu/redis:5.0.5
environment:
- REDIS_PASSWORD=${DB_PASSWD:-123456}
restart: always
volumes:
- ./database/redis/data:/data
ports:
- "${REDIS_PORT:-8041}:6379"

View File

@ -1,14 +0,0 @@
version: "3"
services:
nginx:
image: nginx
restart: always
ports:
- 80:80
- 443:443
volumes:
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/certs:/certs
depends_on:
- contact-center

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,21 +0,0 @@
server {
root /usr/share/nginx/html;
client_max_body_size 100M;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://contact-center:8035;
}
location /socket.io { proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_pass http://contact-center:8036;
}
}

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -1,44 +0,0 @@
# 春松客服插件
本文件夹包含春松客服的开源的插件,每个插件授权参考各子目录。
## 规范
目前,春松客服插件安装是在命令行终端内完成:使用 Bash Shell 命令,链接插件源码到春松客服源码,然后编译打包 WAR 后得到插件功能。
> 提示Windows 上使用 Git Bash 获得 Bash Shell, [https://git-scm.com/downloads](https://git-scm.com/downloads)。
不同的插件均遵循以下的规范。
### 插件安装
执行命令:
```
cd plugins/PLUGIN
./scripts/install.sh
```
其中,`PLUGIN` 是插件的名字。
### 卸载插件
执行命令:
```
cd plugins/PLUGIN
./scripts/uninstall.sh
```
## 应用打包
安装插件后,插件开发过程同[春松客服开发环境搭建](https://docs.cskefu.com/docs/osc/engineering)。
如果需要部署到系统测试、生产环境等,首先打包为 WAR 应用,方式如下:
```
cd contact-center
./admin/package.sh
```
春松客服的发布形式为 Docker 镜像,如果在更改源码后,也可以使用春松客服的 Docker 镜像构建脚本发布,参考[构建脚本](https://github.com/cskefu/cskefu/blob/osc/contact-center/admin/build.sh)。

Some files were not shown because too many files have changed in this diff Show More