242 lines
7.6 KiB
Markdown
242 lines
7.6 KiB
Markdown
# 小鹿超市项目
|
||
|
||
## 后端技术栈
|
||
|
||
| 核心技术 |
|
||
| :----------------------------------------------------------- |
|
||
| SpringBoot:简化新Spring应用的初始搭建以及开发过程 |
|
||
| SpringCloud:基于Spring Boot实现的云原生应用开发工具,SpringCloud使用的技术:(Spring Cloud Gateway、Spring Cloud OpenFeign、Spring Cloud Alibaba Nacos等) |
|
||
| MyBatis-Plus:持久层框架 |
|
||
| Redis:缓存数据库 |
|
||
| Redisson:基于redis的Java驻内存数据网格,实现分布式锁 |
|
||
| RabbitMQ:消息中间件 |
|
||
| ElasticSearch + Kibana: 全文检索服务器 +可视化数据监控 |
|
||
| ThreadPoolExecutor:线程池来实现异步操作,提高效率 |
|
||
| OSS/MinIO:文件存储服务 |
|
||
| Knife4j(Swagger):Api接口文档工具 |
|
||
| Nginx:负载均衡 |
|
||
| MySQL:关系型数据库 |
|
||
| 微信支付 |
|
||
| 微信小程序 |
|
||
| Docker:容器技术 |
|
||
| DockerFile:管理Docker镜像命令文本 |
|
||
| SkyWalking:链路追踪、日志、监控框架 |
|
||
| |
|
||
| |
|
||
|
||
## 前端技术栈
|
||
|
||
| 核心技术 |
|
||
| ------------------ |
|
||
| UinApp |
|
||
| vue-admin-template |
|
||
| ElementUI |
|
||
| Axios |
|
||
| Node.js |
|
||
| Npm |
|
||
| |
|
||
| |
|
||
| |
|
||
|
||
|
||
|
||
## 开发工具
|
||
|
||
| 开发工具 | 版本 |
|
||
| ----------------------------- | -------------- |
|
||
| Intellil IDEA Ultimate | 2023.3.2 |
|
||
| DataGrip | 2023.3.2 |
|
||
| WebStorm | 2023.3.2 |
|
||
| HBuilderx | 3.8.12 |
|
||
| Google Chrome | 120.0.6099.216 |
|
||
| Another Redis Desktop Manager | 1.6 |
|
||
| Apifox | 2.3.19 |
|
||
| Parallels Desktop | 18.1.1 |
|
||
| Termius | 8.4.0 |
|
||
| 微信开发者工具 | 1.06.2306020 |
|
||
|
||
## 操作系统
|
||
|
||
| 开发工具 | 版本 |
|
||
| ------------------- | ------ |
|
||
| Mac OS Ventura | 13.6.3 |
|
||
| Linux CentOS Stream | 9 |
|
||
| Linux CentOS | 7.9 |
|
||
|
||
## 项目环境部署
|
||
|
||
### Mysql 数据库
|
||
|
||
```shell
|
||
docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql:latest
|
||
```
|
||
|
||
### Redis 缓存
|
||
|
||
```shell
|
||
docker run -itd --name redis -p 6379:6379 redis
|
||
```
|
||
|
||
### RabbitMQ 消息队列
|
||
|
||
```shell
|
||
docker run -d --restart=always -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:3.8-management
|
||
|
||
docker exec -it rabbit /bin/bash
|
||
#安装插件
|
||
rabbitmq-plugins enable rabbitmq_management
|
||
```
|
||
|
||
### Nacos 注册中心
|
||
|
||
```shell
|
||
docker run -d --name nacos-server -p 8848:8848 -p 9848:9848 \
|
||
-e MODE=standalone \
|
||
-e JVM_XMS=512m \
|
||
-e JVM_XMX=512m \
|
||
-v /logs/nacos:/home/nacos/logs \
|
||
nacos/nacos-server:v2.2.3
|
||
```
|
||
|
||
### ES + Kibana 分词器
|
||
|
||
```shell
|
||
docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \
|
||
-e "discovery.type=single-node" \
|
||
-e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
|
||
-d elasticsearch:7.8.0
|
||
|
||
docker exec -it elasticsearch /bin/bash
|
||
|
||
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.17.5/elasticsearch-analysis-ik-7.17.5.zip
|
||
|
||
docker restart elasticsearch
|
||
|
||
docker run -d --name kibana --link elasticsearch:elasticsearch -p 5601:5601 kibana:7.8.0
|
||
```
|
||
|
||
### GrayLog 日志框架 (已弃用,日志服务整合到 SkyWalking)
|
||
|
||
```shell
|
||
#部署Elasticsearch
|
||
docker run -d \
|
||
--name elasticsearch \
|
||
-e "ES_JAVA_OPTS=-Xms512m -Xmx512m" \
|
||
-e "discovery.type=single-node" \
|
||
-v es-data:/usr/share/elasticsearch/data \
|
||
-v es-plugins:/usr/share/elasticsearch/plugins \
|
||
--privileged \
|
||
-p 9200:9200 \
|
||
-p 9300:9300 \
|
||
elasticsearch:7.17.5
|
||
|
||
#部署MongoDB(使用之前部署的服务即可)
|
||
docker run -d \
|
||
--name mongodb \
|
||
-p 27017:27017 \
|
||
--restart=always \
|
||
-v mongodb:/data/db \
|
||
-e MONGO_INITDB_ROOT_USERNAME=xlcs \
|
||
-e MONGO_INITDB_ROOT_PASSWORD=123321 \
|
||
mongo:4.4
|
||
|
||
#部署
|
||
docker run \
|
||
--name graylog \
|
||
-p 9000:9000 \
|
||
-p 12201:12201/udp \
|
||
-e GRAYLOG_HTTP_EXTERNAL_URI=http://<IP>:9000/ \
|
||
-e GRAYLOG_ELASTICSEARCH_HOSTS=http://<IP>:9200/ \
|
||
-e GRAYLOG_ROOT_TIMEZONE="Asia/Shanghai" \
|
||
-e GRAYLOG_WEB_ENDPOINT_URI="http://<IP>:9000/:9000/api" \
|
||
-e GRAYLOG_PASSWORD_SECRET="somepasswordpepper" \
|
||
-e GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \
|
||
-e GRAYLOG_MONGODB_URI=mongodb://xlcs:123321@<IP>:27017/admin \
|
||
-d \
|
||
graylog/graylog:4.3
|
||
```
|
||
|
||
### SkyWalking 链路追踪、日志、监控框架
|
||
|
||
```yaml
|
||
version: "3"
|
||
services:
|
||
elasticsearch:
|
||
image: elasticsearch:8.4.2
|
||
container_name: elasticsearch
|
||
ports:
|
||
- "9200:9200"
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -sf http://localhost:9200/_cluster/health || exit 1"] #⼼跳检测,成功之后不再执⾏后⾯的退出
|
||
interval: 60s #⼼跳检测间隔周期
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 60s #⾸次检测延迟时间
|
||
environment:
|
||
discovery.type: single-node #单节点模式
|
||
ingest.geoip.downloader.enabled: "false"
|
||
bootstrap.memory_lock: "true"
|
||
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
|
||
TZ: "Asia/Shanghai"
|
||
xpack.security.enabled: "false" #单机模式
|
||
ulimits:
|
||
memlock:
|
||
soft: -1
|
||
hard: -1
|
||
skywalking-oap:
|
||
image: apache/skywalking-oap-server:9.4.0
|
||
container_name: skywalking-oap
|
||
depends_on:
|
||
elasticsearch:
|
||
condition: service_healthy
|
||
links:
|
||
- elasticsearch
|
||
environment:
|
||
SW_HEALTH_CHECKER: default
|
||
SW_STORAGE: elasticsearch
|
||
SW_STORAGE_ES_CLUSTER_NODES: 124.70.87.134:9200
|
||
JAVA_OPTS: "-Xms2048m -Xmx2048m"
|
||
TZ: Asia/Shanghai
|
||
SW_TELEMETRY: prometheus
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "/skywalking/bin/swctl ch"]
|
||
interval: 30s
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 10s
|
||
restart: on-failure
|
||
ports:
|
||
- "11800:11800"
|
||
- "12800:12800"
|
||
skywalking-ui:
|
||
image: apache/skywalking-ui:9.4.0
|
||
container_name: skywalking-ui
|
||
depends_on:
|
||
skywalking-oap:
|
||
condition: service_healthy
|
||
links:
|
||
- skywalking-oap
|
||
ports:
|
||
- "8080:8080"
|
||
environment:
|
||
SW_OAP_ADDRESS: http://124.70.87.134:12800
|
||
SW_HEALTH_CHECKER: default
|
||
TZ: Asia/Shanghai
|
||
healthcheck:
|
||
test: ["CMD-SHELL", "curl -sf http://localhost:8080 || exit 1"] #⼼跳检测,成功之后不再执⾏后⾯的退出
|
||
interval: 60s #⼼跳检测间隔周期
|
||
timeout: 10s
|
||
retries: 3
|
||
start_period: 60s #⾸次检测延迟时间
|
||
```
|
||
|
||
## K8s 集群部署
|
||
|
||
使用 jenkins 进行打包
|
||
|
||
构建参数
|
||
|
||
![image-20240125141417779](https://lsky.hhdxw.top/imghub/2024/01/image-202401251706163258.png)
|
||
|
||
具体 pipeline 参考各模块下文件
|