# demo接口服务

# 所需文件

文件描述 文件名 文件位置
服务jar包 demo-server.jar /opt/demoserver
jar 包配置文件 application.properties /opt/demoserver

# 操作系统

Ubuntu 18.04

# 配置环境

  1. 更新linux安装程序源,安装 jre
apt update
apt upgrade
apt install openjdk-8-jdk

# jar 包配置文件

application.properties,需要放在jar包同目录下,或者同目录的config文件夹下,并不是所有的字段都需要,都有默认值,只需要把需要修改的放进来即可。

server.servlet.context-path=/
#出现错误时,直接抛出异常
spring.mvc.throw-exception-if-no-handler-found=true
#不要对资源文件创建映射
spring.resources.add-mappings=false

# 上传文件总的最大值
spring.servlet.multipart.max-request-size=1000MB
# 单个文件的最大值
spring.servlet.multipart.max-file-size=10000MB
#设置为懒加载,不然依然会捕获不到异常
spring.servlet.multipart.resolve-lazily=true
#最重要的是这一行,可设置为 -1 不作限制,
server.tomcat.max-swallow-size = -1

#日志配置文件
logging.config=classpath:logback-spring.xml

#数据库配置
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.hikari.maximum-pool-size= 100
spring.datasource.hikari.minimum-idle= 1
spring.datasource.hikari.idle-timeout= 180000
# 测试连接是否可用的query 语句 在oracle是 select 1 from dual
spring.datasource.hikari.connection-test-query= select 1


server.port=17778
#数据库
spring.datasource.username=
spring.datasource.password=
spring.datasource.url=jdbc:mysql://?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=Asia/Shanghai
#允许跨域的域名
allowed.origins = http://localhost:8080,http://localhost:8081

#七牛云相关配置
QiniuBucket     = bsedit
QiniuHost       = https://demo.editor.com
QiniuRegion     = qiniu.region.z0
#腾讯云相关配置
QcloudRegion        = ap-beijing
QcloudBucket        = bsedit-123
QcloudOriginHost    = https://bsedit-123.cos.ap-beijing.myqcloud.com
QcloudHost          = https://demo.editor.com
#亚马逊相关配置
AwsS3Region     = us-west-1
AwsS3Bucket     = bsedit
AwsS3OriginHost = https://bsedit.s3-us-west-1.amazonaws.com
AwsS3Host       = https://demo.editor.com
#阿里云相关配置
AliyunRegion     = oss-cn-beijing
AliyunEndpoint   = http://oss-cn-beijing-internal.aliyuncs.com
AliyunBucket     = bseditor123
AliyunOriginHost = https://bseditor123.oss-cn-beijing.aliyuncs.com
AliyunHost       = https://demo.editor.com
AliyunArn        = acs:ram::1464697148549665:role/stsrole
AliyunTokenDurationSecond=3000
AliyunPolicy ={"Version":"1","Statement":[{"Effect":"Allow","Action":"oss:PutObject","Resource":"acs:oss:*:*:%s"}]}
#百度云相关配置
BOSEndpoint     = http://sts.bj.baidubce.com
BOSBucket       = testbsedit123
BOSOriginHost   = https://demo.editor.com
BOSHost         = https://demo.editor.com
#华为云相关配置
OBSEndpoint = http://obs.cn-east-3.myhuaweicloud.com
OBSHost = http://editor123.obs.cn-east-3.myhuaweicloud.com
OBSRegion = cn-east-3
OBSAction = obs:object:PutObject
OBSBucket = editor123
#金山云相关配置
KsyunEndpoint   = ks3-cn-beijing.ksyuncs.com
KsyunBucket     = editor
KsyunOriginHost = https://editor.ks3-cn-beijing.ksyuncs.com
KsyunHost       = https://demo.editor.com
KsyunPolicyResourcePath = ks3_editor_role
KsyunSubuserEndpoint = sts.cn-beijing-6.api.ksyun.com
KsyunId = 123
KsyunDomainModeEnabled = false
#本地存储相关配置
localFilePath       = /opt/file/editor/
localFileHost       = https://wslhost.com/file

#默认的对象存储
#qcloud(腾讯云), qiniu(七牛), aws(亚马逊), aliyun(阿里云),
#baidu(百度云), local(本地), huawei(华为云), ksyun(金山云),wenge(闻歌)
defaultStorageType=local
accessKey=
secretKey=


#任务调度器回调地址
jobCallbackHost = http://localhost:${server.port}
#任务调度地址
jobDispatchUrl  = http://127.0.0.1:9999
#云存储回调地址
cloudStorageCallback    = https://..../upload/callback
#云存储存储前缀
cloudStoragePrefixKey   = test/

#讯飞语音转写的账号
iflytekAppId=
iflytekSecretKey=

project.history.localPath   = /home/project/history
project.history.storageKey  = ${cloudStoragePrefixKey}bs_project/history/

# 启动服务

切换到jar包的目录下

  1. 启动 java 服务
nohup java -jar demo-server.jar >/dev/null 2>&1 &

# 日志说明

会产生1个日志目录,在/opt/demoserver目录下。 logs 是Java程序产生的日志,每天一个日志文件,只保留最近30天的日志。 (opens new window)