系列文章目录
davinci本地启动: link
文章目录
1.后台启动
1.1 准备mysql数据库
本人使用的是mysql8.0.19的版本所以需要把mysql-connector-java的版本调至8.0.19
pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!--<version>5.1.44</version>-->
<version>8.0.19</version>
</dependency>
数据库信息:
调整config/application-dev.yml中的datasource
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/mysql_db1?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: <你的账号>
password: <你的密码>
进入数据库执行bin/davinci.sql创建所需要的表
1.2 改配置文件
改后台端口号 与 环境变量中的${DAVINCI3_HOME}
config/application.yml
server:
protocol: http
address: 127.0.0.1
port: 18080 #根据你的来
url: http://localhost:18080 # 根据你的来
server\src\main\resources\application.yml
${DAVINCI3_HOME}这个变量可以在系统环境变量中设置,这样你在配置文件中就不用设置了。如果不想设置在环境变量可以手动改成你的项目路径
#第一处
file:
userfiles-path: <你的项目路径>/userfiles/
web_resources: <你的项目路径>/davinci-ui/
base-path: <你的项目路径>/lib/
#第二处
logging:
config: file:<你的项目路径>/config/logback.xml
#第三处
custom-datasource-driver-path: <你的项目路径>/config/datasource_driver.yml
config/application-dev.yml
注释掉截图的配置,有可能会报错.
更改端口
设置本项目的context-path后面呢nginx会用到
screenshot:
# default_browser: CHROME
# timeout_second: 600
# chromedriver_path: $your_chromedriver_path$
# remote_webdriver_url: $your_remote_webdriver_url$
server:
protocol: http
address: 127.0.0.1
port: 18080
servlet:
context-path: /davinci
运行DavinciServerApplication修改Active profiles为dev:
成功启动日志:
2 启动前端项目
2.1 npm install
在webapp目录下运行 npm install 成功
npm warn deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm warn deprecated axios@0.19.2: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm warn deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm warn deprecated intl-relativeformat@2.2.0: This package has been deprecated, please see migration guide at 'https://github.com/formatjs/formatjs/tree/master/packages/intl-relativeformat#migration-guide'
npm warn deprecated eslint@6.6.0: This version is no longer supported. Please see https://eslint.org/version-support for other options.
npm warn deprecated core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
> davinci-webapp@0.3.0 preinstall
> npm run npmcheckversion
> davinci-webapp@0.3.0 npmcheckversion
> node ./internals/scripts/npmcheckversion.js
added 2246 packages in 2m
155 packages are looking for funding
run `npm fund` for details
2.2 运行npm start 失败
出现了 Error: error:0308010C:digital envelope routines::unsupported 错误。这是 Node.js 18+ 与 Webpack 4 的兼容性问题,原因是 Node.js 18+ 默认使用 OpenSSL 3,而旧版 Webpack 4 的哈希算法不兼容
设置 OpenSSL 兼容模式(临时)
在启动命令前添加环境变量,强制使用旧版 OpenSSL:
# Linux/macOS
export NODE_OPTIONS=--openssl-legacy-provider
npm start
# Windows (PowerShell)
$env:NODE_OPTIONS="--openssl-legacy-provider"
npm start
成功启动:
3 配置nginx
nginx.config主要是server 中的对于davinci中的转发
#user nobody;
worker_processes 1;
#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;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
server {
listen 8080;
# listen 443 ssl;
server_name localhost;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
server_tokens off;
client_max_body_size 100m;
# davinci 的配置到你的端口号
location /davinci/ {
proxy_pass http://localhost:18080;
# proxy_http_version 1.1;
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;
}
# davinci/backend 的转发
location /backend {
proxy_pass http://localhost:18080/davinci;
# proxy_http_version 1.1;
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;
}
location /dashboard {
index index.html;
try_files $uri $uri/ /dashboard/index.html; # 用于支持单页应用的HTML5 History Mode
}
location /dashboard2 {
index index.html;
try_files $uri $uri/ /dashboard2/index.html; # 用于支持单页应用的HTML5 History Mode
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
4 访问 http://localhost:8080/davinci
附npm version
{
npm: '10.8.2',
node: '20.18.0',
acorn: '8.12.1',
ada: '2.9.0',
ares: '1.33.1',
base64: '0.5.2',
brotli: '1.1.0',
cjs_module_lexer: '1.4.1',
cldr: '45.0',
icu: '75.1',
llhttp: '8.1.2',
modules: '115',
napi: '9',
nghttp2: '1.61.0',
nghttp3: '0.7.0',
ngtcp2: '1.1.0',
openssl: '3.0.13+quic',
simdutf: '5.5.0',
tz: '2024a',
undici: '6.19.8',
unicode: '15.1',
uv: '1.46.0',
uvwasi: '0.0.21',
v8: '11.3.244.8-node.23',
zlib: '1.3.0.1-motley-71660e1'
}