Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💡 MAJOR CHANGELOG #48

Open
sudoooooo opened this issue Jan 17, 2024 · 4 comments
Open

💡 MAJOR CHANGELOG #48

sudoooooo opened this issue Jan 17, 2024 · 4 comments

Comments

@sudoooooo
Copy link
Collaborator

sudoooooo commented Jan 17, 2024

2024.5.10

对应docker tag1.1.0

web升级Vue3,具体查看升级文档

2024.1.30

变更

对应commit tag1.2.0

对应docker tag1.0.4

服务端架构应用koa升级成nestjs,变化点如下:
1、服务端架构升级到nestjs
2、安全插件化方案
3、传输加密使用rsa加密
4、服务端单测
5、日志
6、环境变量放到配置文件维护,同时删除无效变量,具体查看.env文件
特别注意DB地XIAOJU_SURVEY_MONGO_AUTH_SOURCE需要单独配置

XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey
XIAOJU_SURVEY_MONGO_URL=mongodb://localhost:27017
XIAOJU_SURVEY_MONGO_AUTH_SOURCE=


XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey
XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa

XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret
XIAOJU_SURVEY_JWT_EXPIRES_IN=8h

XIAOJU_SURVEY_LOGGER_FILENAME=./logs/app.log

7、升级前版本:https://github.com/didi/xiaoju-survey/releases/tag/v1.1.0

2024.1.17

变更

对应commit tag1.2.0

对应docker tag1.0.3

优化服务端环境变量引入方式,主要优化了配置引用方式和命名规范:
1、xiaojuSurveyMongoUrl 规范化成 XIAOJU_SURVEY_MONGO_URL
2、xiaojuSurveyJwtSecret 规范化成 XIAOJU_SURVEY_JWT_SECRET
3、xiaojuSurveyJwtExpiresIn 规范化成 XIAOJU_SURVEY_JWT_EXPIRES_IN
4、xiaojuSurveySessionExpireTime 使用 XIAOJU_SURVEY_JWT_EXPIRES_IN
5、xiaojuSurveyEncryptType 规范化成 XIAOJU_SURVEY_ENCRYPT_TYPE
6、xiaojuSurveyDataAesEncryptSecretKey 规范化成 XIAOJU_SURVEY_ENCRYPT_SECRET_KEY
7、xiaojuSurveyAesCodelength 使用 XIAOJU_SURVEY_ENCRYPT_TYPE_LEN

来源

@alwayrun PR 🎉

影响

⚠️ 服务重新部署前,特别注意您的环境配置,需重新配置环境变量,尤其是MongoDB和启动,如下提示,最新内容看文档

@sudoooooo sudoooooo changed the title ⚠️ 重大CHANGELOG 💡 重大CHANGELOG Jan 18, 2024
@sudoooooo sudoooooo changed the title 💡 重大CHANGELOG 💡 Major Changelog Jan 18, 2024
@sudoooooo sudoooooo changed the title 💡 Major Changelog 💡 MAJOR CHANGELOG Jan 18, 2024
@coder-xiaomo
Copy link

@sudoooooo 是否考虑将配置从环境变量转移到配置文件呢,这样配置起来会方便一些,也方便后续扩展

@sudoooooo
Copy link
Collaborator Author

sudoooooo commented Feb 6, 2024

@coder-xiaomo 你好,server架构升级后统一在配置文件维护,可查看.env文件

@linux-y
Copy link

linux-y commented Mar 25, 2024

崩溃啦,为什么我用docker启动一直报连不上数据库?
[root@redis survey]# docker -v
Docker version 19.03.5, build 633a0ea
[root@redis survey]# docker-compose -v
docker-compose version 1.24.1, build 4667896b
[root@redis survey]# cat /etc/redhat-release
CentOS Linux release 8.3.2011
[root@redis survey]# uname -a
Linux redis 4.18.0-240.el8.x86_64 #1 SMP Fri Sep 25 19:48:47 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

docker-compose.yml如下:
`[root@redis survey]# docker logs -f xiaoju-survey

server@0.0.1 start:prod
NODE_ENV=production node dist/main

[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [NestFactory] Starting Nest application...
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +34ms
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ServeStaticModule dependencies initialized +0ms
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms
[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] AppModule dependencies initialized +25ms
[Nest] 19 - 03/25/2024, 10:03:02 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)...
MongoServerError: Invalid database name: ''
at Connection.onMessage (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:202:26)
at MessageStream. (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:61:60)
at MessageStream.emit (node:events:513:28)
at processIncomingData (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:124:16)
at MessageStream._write (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:391:12)
at _write (node:internal/streams/writable:332:10)
at MessageStream.Writable.write (node:internal/streams/writable:336:10)
at Socket.ondata (node:internal/streams/readable:754:22)
at Socket.emit (node:events:513:28)
[Nest] 19 - 03/25/2024, 10:03:05 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)...
MongoServerError: Invalid database name: ''
at Connection.onMessage (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:202:26)
at MessageStream. (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:61:60)
at MessageStream.emit (node:events:513:28)
at processIncomingData (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:124:16)
at MessageStream._write (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:391:12)
at _write (node:internal/streams/writable:332:10)
at MessageStream.Writable.write (node:internal/streams/writable:336:10)
at Socket.ondata (node:internal/streams/readable:754:22)
at Socket.emit (node:events:513:28)
^C
[root@redis survey]# cat docker-compose.yml .env
version: "3.6"
services:
mongo:
image: mongo:4
container_name: xiaoju-survey-mongo
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: syy# 默认使用系统的环境变量
MONGO_INITDB_ROOT_PASSWORD: syy123 # 默认使用系统的环境变量
ports:
- "27017:27017" # 数据库端口
volumes:
- mongo-volume:/data/db # xiaoju-survey-data/db/data:/data/db
networks:
- xiaoju-survey

xiaoju-survey:
image: "xiaojusurvey/xiaoju-survey:1.0.4"
container_name: xiaoju-survey
restart: always
ports:
- "8080:3000" # API端口
environment:
MONGO_INITDB_ROOT_USERNAME: syy # 默认使用系统的环境变量
MONGO_INITDB_ROOT_PASSWORD: syy123 # 默认使用系统的环境变量
XIAOJU_SURVEY_MONGO_DB_NAME: xiaojuSurvey
XIAOJU_SURVEY_MONGO_AUTH_SOURCE:
XIAOJU_SURVEY_MONGO_URL: mongodb://syy:syy123@192.168.2.246:27017/xiaojuSurvey
#XIAOJU_SURVEY_MONGO_URL: mongodb://syy:syy123@xiaoju-survey-mongo:27017 # docker-compose 会根据容器名称自动处理
links:
- mongo:mongo
depends_on:
- mongo
networks:
- xiaoju-survey

volumes:
mongo-volume:

networks:
xiaoju-survey:
name: xiaoju-survey
driver: bridge
MONGO_INITDB_ROOT_USERNAME=syy
MONGO_INITDB_ROOT_PASSWORD=syy123
XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey
XIAOJU_SURVEY_MONGO_URL=mongodb://localhost:27017
XIAOJU_SURVEY_MONGO_AUTH_SOURCE=

XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey
XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa

XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret
XIAOJU_SURVEY_JWT_EXPIRES_IN=8h

XIAOJU_SURVEY_LOGGER_FILENAME=./logs/app.log
`

@sudoooooo
Copy link
Collaborator Author

崩溃啦,为什么我用docker启动一直报连不上数据库? [root@redis survey]# docker -v Docker version 19.03.5, build 633a0ea [root@redis survey]# docker-compose -v docker-compose version 1.24.1, build 4667896b [root@redis survey]# cat /etc/redhat-release CentOS Linux release 8.3.2011 [root@redis survey]# uname -a Linux redis 4.18.0-240.el8.x86_64 #1 SMP Fri Sep 25 19:48:47 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

docker-compose.yml如下: `[root@redis survey]# docker logs -f xiaoju-survey

server@0.0.1 start:prod
NODE_ENV=production node dist/main

[Nest] 19 - 03/25/2024, 10:03:02 AM LOG [NestFactory] Starting Nest application... [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] TypeOrmModule dependencies initialized +34ms [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ServeStaticModule dependencies initialized +0ms [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms [Nest] 19 - 03/25/2024, 10:03:02 AM LOG [InstanceLoader] AppModule dependencies initialized +25ms [Nest] 19 - 03/25/2024, 10:03:02 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... MongoServerError: Invalid database name: '' at Connection.onMessage (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:202:26) at MessageStream. (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:61:60) at MessageStream.emit (node:events:513:28) at processIncomingData (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:124:16) at MessageStream._write (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:33:9) at writeOrBuffer (node:internal/streams/writable:391:12) at _write (node:internal/streams/writable:332:10) at MessageStream.Writable.write (node:internal/streams/writable:336:10) at Socket.ondata (node:internal/streams/readable:754:22) at Socket.emit (node:events:513:28) [Nest] 19 - 03/25/2024, 10:03:05 AM ERROR [TypeOrmModule] Unable to connect to the database. Retrying (2)... MongoServerError: Invalid database name: '' at Connection.onMessage (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:202:26) at MessageStream. (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/connection.js:61:60) at MessageStream.emit (node:events:513:28) at processIncomingData (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:124:16) at MessageStream._write (/xiaoju-survey/server/node_modules/mongodb/lib/cmap/message_stream.js:33:9) at writeOrBuffer (node:internal/streams/writable:391:12) at _write (node:internal/streams/writable:332:10) at MessageStream.Writable.write (node:internal/streams/writable:336:10) at Socket.ondata (node:internal/streams/readable:754:22) at Socket.emit (node:events:513:28) ^C [root@redis survey]# cat docker-compose.yml .env version: "3.6" services: mongo: image: mongo:4 container_name: xiaoju-survey-mongo restart: always environment: MONGO_INITDB_ROOT_USERNAME: syy# 默认使用系统的环境变量 MONGO_INITDB_ROOT_PASSWORD: syy123 # 默认使用系统的环境变量 ports: - "27017:27017" # 数据库端口 volumes: - mongo-volume:/data/db # xiaoju-survey-data/db/data:/data/db networks: - xiaoju-survey

xiaoju-survey: image: "xiaojusurvey/xiaoju-survey:1.0.4" container_name: xiaoju-survey restart: always ports: - "8080:3000" # API端口 environment: MONGO_INITDB_ROOT_USERNAME: syy # 默认使用系统的环境变量 MONGO_INITDB_ROOT_PASSWORD: syy123 # 默认使用系统的环境变量 XIAOJU_SURVEY_MONGO_DB_NAME: xiaojuSurvey XIAOJU_SURVEY_MONGO_AUTH_SOURCE: XIAOJU_SURVEY_MONGO_URL: mongodb://syy:syy123@192.168.2.246:27017/xiaojuSurvey #XIAOJU_SURVEY_MONGO_URL: mongodb://syy:syy123@xiaoju-survey-mongo:27017 # docker-compose 会根据容器名称自动处理 links: - mongo:mongo depends_on: - mongo networks: - xiaoju-survey

volumes: mongo-volume:

networks: xiaoju-survey: name: xiaoju-survey driver: bridge MONGO_INITDB_ROOT_USERNAME=syy MONGO_INITDB_ROOT_PASSWORD=syy123 XIAOJU_SURVEY_MONGO_DB_NAME=xiaojuSurvey XIAOJU_SURVEY_MONGO_URL=mongodb://localhost:27017 XIAOJU_SURVEY_MONGO_AUTH_SOURCE=

XIAOJU_SURVEY_RESPONSE_AES_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey XIAOJU_SURVEY_HTTP_DATA_ENCRYPT_TYPE=rsa

XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret XIAOJU_SURVEY_JWT_EXPIRES_IN=8h

XIAOJU_SURVEY_LOGGER_FILENAME=./logs/app.log `

目测是这个问题:#70

@sudoooooo sudoooooo mentioned this issue May 10, 2024
53 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants