This commit is contained in:
xxx 2024-06-05 17:24:49 +08:00
parent f5047edd91
commit 37fccc1f40
9 changed files with 1750 additions and 17 deletions

18
.env.example Normal file
View File

@ -0,0 +1,18 @@
################# PlayEdu ###################
PLAYEDU_API_PORT=9700
PLAYEDU_PC_PORT=9800
PLAYEDU_H5_PORT=9801
PLAYEDU_ADMIN_PORT=9900
PLAYEDU_JWT_KEY=playeduxyz
################# MySQL ###################
MYSQL_PORT=3306
################# Redis ###################
REDIS_PORT=6379
################# MINIO ###################
MINIO_ROOT_USERNAME=username
MINIO_ROOT_PASSWORD=password
MINIO_PORT=9002
MINIO_CONSOLE_PORT=50002

46
Dockerfile Normal file
View File

@ -0,0 +1,46 @@
FROM node:20-alpine as NodeBuilder
RUN yarn config set registry https://registry.npmmirror.com &&\
yarn global add pnpm &&\
pnpm config set registry https://registry.npmmirror.com
COPY playedu-admin /app/admin
COPY playedu-pc /app/pc
COPY playedu-h5 /app/h5
WORKDIR /app
WORKDIR /app/admin
RUN pnpm i && VITE_APP_URL=/api/ pnpm build
WORKDIR /app/pc
RUN pnpm i && VITE_APP_URL=/api/ pnpm build
WORKDIR /app/h5
RUN pnpm i && VITE_APP_URL=/api/ pnpm build
FROM eclipse-temurin:17 as javaBuilder
COPY playedu-api /app
WORKDIR /app
RUN /app/mvnw -Dmaven.test.skip=true clean package
FROM eclipse-temurin:17
LABEL maintainer="滕勇志 <tengyongzhi@meedu.vip>"
RUN echo "Asia/Shanghai" > /etc/timezone
RUN apt update && apt install -y nginx
COPY --from=javaBuilder /app/playedu-api/target/playedu-api.jar /app/api/app.jar
COPY --from=NodeBuilder /app/admin/dist /app/admin
COPY --from=NodeBuilder /app/pc/dist /app/pc
COPY --from=NodeBuilder /app/h5/dist /app/h5
COPY docker/nginx/conf/nginx.conf /etc/nginx/sites-enabled/default
CMD nginx; echo "Waiting for MySQL/Redis/MinIO to start..."; sleep 15; java -jar /app/api/app.jar --spring.profiles.active=prod --spring.datasource.url="jdbc:mysql://${DB_HOST}:${DB_PORT:-3306}/${DB_NAME}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true" --spring.datasource.username=${DB_USER} --spring.datasource.password=${DB_PASS} --spring.data.redis.host=${REDIS_HOST} --spring.data.redis.port=${REDIS_PORT:-6379} --spring.data.redis.password=${REDIS_PASS} --spring.data.redis.database=${REDIS_DB:-0} --sa-token.is-concurrent=${SA_TOKEN_IS_CONCURRENT:-false} --sa-token.jwt-secret-key=${SA_TOKEN_JWT_SECRET_KEY}

View File

@ -2,25 +2,57 @@
<img src="https://meedu.cloud.oss.meedu.vip/playedu/%E5%A4%B4%E5%9B%BE.jpg"/>
</p>
<h4 align="center">
<a href="http://www.playeduos.com">官网</a> |
<a href="https://www.playeduos.com/function.html">商业版</a> |
<a href="https://faq.playeduos.com/">部署文档</a> |
<a href="https://www.playeduos.com/demo.html">演示站</a> |
<a href="https://faq.playeduos.com/qa">开源社区</a>
</h4>
## 系统介绍
**PlayEdu** 是由白书科技团队经营多年线上教育系统打造出的一款全新的企业培训解决方案,致力于为更多企业机构搭建私有化内部培训平台。**PlayEdu** 基于 Java + MySQL 开发;采用前后端分离模式;前端采用 React18 为核心框架,后端采用 SpringBoot3 为核心框架。提供部门管理、学员管理、在线视频学习、学员进度追踪、视频私有化存储等培训主要功能。**与此同时,我们在开源版本的基础上还提供了功能更加丰富的企业版本。企业版本在开源功能的基础上提供了包括视频云端存储、视频加密、音频学习、文档(PDF|WORD|PPT)在线学习、在线考试、学习计划培训等功能。企业版本更多信息请点击下方的企业版链接查看。**
## 常用链接
| 站点 | 链接 |
| ---------- | ---------------------------------------------------------------------------- |
| 官网 | [http://www.playedu.xyz](http://www.playedu.xyz) |
| **企业版** | [https://www.playedu.xyz/commercial](https://www.playedu.xyz/commercial) |
| 部署文档 | [https://www.playedu.xyz/book](https://www.playedu.xyz/book) |
| 系统演示 | [https://www.playedu.xyz/demo](https://www.playedu.xyz/demo) |
| 问答社区 | [https://www.playedu.xyz/qa](https://www.playedu.xyz/qa) |
| 站点 | 链接 |
| ---------- | ------------------------------------------------------------------------ |
| 官网 | [http://www.playedu.xyz](http://www.playedu.xyz) |
| **企业版** | [https://www.playedu.xyz/commercial](https://www.playedu.xyz/commercial) |
| 部署文档 | [https://www.playedu.xyz/book](https://www.playedu.xyz/book) |
| 系统演示 | [https://www.playedu.xyz/demo](https://www.playedu.xyz/demo) |
| 问答社区 | [https://www.playedu.xyz/qa](https://www.playedu.xyz/qa) |
## 依赖前端项目
## 🚀 快速上手
- [后台界面程序](https://github.com/PlayEdu/backend)
- [PC 界面程序](https://github.com/PlayEdu/frontend)
- [H5 界面程序](https://github.com/PlayEdu/h5)
拉取代码:
```
git clone --branch main https://gitee.com/playeduxyz/playedu.git playedu
```
构建镜像:
```
cd playedu && docker-compose build
```
运行镜像:
```
docker-compose up -d
```
现在,打开您的浏览器,输入 `http://localhost:9900` 即可访问后台管理界面,默认管理员账号和密码 `admin@playedu.xyz / playedu`
- PC 端口 `http://localhost:9800`
- H5 端口 `http://localhost:9801`
- API 端口 `http://localhost:9700`
## 🔰️ 软件安全
安全问题应该通过邮件私下报告给 tengyongzhi@meedu.vip。 您将在 24 小时内收到回复,如果因为某些原因您没有收到回复,请通过回复原始邮件的方式跟进,以确保我们收到了您的原始邮件。
## 界面预览
@ -28,10 +60,9 @@
![管理后台界面预览](https://meedu.cloud.oss.meedu.vip/playedu/%E5%90%8E%E5%8F%B0%E9%A1%B5%E9%9D%A2.jpg)
## 使用协议
## 使用须知
● 要求
- 保留页脚处版权信息。
- 保留源代码中的协议。
- 如果修改了代码,则必须在文件中进行说明。
- **1.版权归属** PlayEdu 开源版版权归杭州白书科技有限公司所有。我们鼓励社区成员在遵守开源协议的前提下,对开源版进行合法的使用和贡献。
- **2.代码修改** 用户有权在遵守开源协议的前提下,对 PlayEdu 开源版的代码进行必要的修改和优化。需在修改处添加清晰备注,记录修改内容信息。
- **3.版权保护** 严禁删除、修改或篡改源代码中的版权信息及开源说明文件。
- **4.商业化行为** 在遵循开源协议的前提下,可以进行商用。但请注意,任何商业化行为都应明确标注 PlayEdu 开源版的版权信息。

91
compose.yml Normal file
View File

@ -0,0 +1,91 @@
x-logging: &default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "10"
networks:
playedu:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.10.10.0/24
volumes:
mysql-data:
mysql-conf:
redis-data:
minio-data:
services:
playedu:
build: .
restart: always
environment:
- DB_HOST=mysql
- DB_PORT=3306
- DB_NAME=playedu
- DB_USER=root
- DB_PASS=playeduxyz
- REDIS_HOST=redis
- REDIS_PASS=playeduxyz
- REDIS_PORT=6379
- REDIS_DB=2
- SA_TOKEN_IS_CONCURRENT=false
- SA_TOKEN_JWT_SECRET_KEY=${PLAYEDU_JWT_KEY:-playeduxyz}
ports:
- "${PLAYEDU_API_PORT:-9700}:9700"
- "${PLAYEDU_PC_PORT:-9800}:9800"
- "${PLAYEDU_H5_PORT:-9801}:9801"
- "${PLAYEDU_ADMIN_PORT:-9900}:9900"
networks:
- playedu
depends_on:
- mysql
- redis
- minio
logging: *default-logging
redis:
build: ./docker/redis
restart: always
volumes:
- redis-data:/data
# ports:
# - "${REDIS_PORT:-6379}:6379"
networks:
- playedu
logging: *default-logging
mysql:
build: ./docker/mysql
restart: always
environment:
- MYSQL_DATABASE=playedu
- MYSQL_ROOT_PASSWORD=playeduxyz
- TZ=UTC
volumes:
- mysql-data:/var/lib/mysql
- mysql-conf:/etc/mysql/conf.d
# ports:
# - "${MYSQL_PORT:-3306}:3306"
networks:
- playedu
logging: *default-logging
minio:
image: bitnami/minio:latest
restart: always
environment:
- MINIO_ROOT_USER=${MINIO_ROOT_USERNAME:-username}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-password}
- MINIO_DEFAULT_BUCKETS=playedu:public
volumes:
- minio-data:/bitnami/minio/data
ports:
- "${MINIO_PORT:-9002}:9000"
- "${MINIO_CONSOLE_PORT:-50002}:9001"
networks:
- playedu
logging: *default-logging

18
docker/mysql/Dockerfile Normal file
View File

@ -0,0 +1,18 @@
FROM mysql:8.1
# 时区配置
ARG TZ=UTC
ENV TZ ${TIMEZONE}
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ >/etc/timezone && chown -R mysql:root /var/lib/mysql/
# 复制自定义的my.cnf
COPY my.cnf /etc/mysql/conf.d/my.cnf
# my.cnf只读权限
RUN chmod 0444 /etc/mysql/conf.d/my.cnf
# 暴露3306端口
EXPOSE 3306
# 启动mysql
CMD ["mysqld"]

12
docker/mysql/my.cnf Normal file
View File

@ -0,0 +1,12 @@
# The MySQL Client configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysql]
default-character-set=utf8mb4
[mysqld]
sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
character-set-server=utf8mb4
default-authentication-plugin=mysql_native_password

View File

@ -0,0 +1,131 @@
client_max_body_size 50m;
server {
# 监听端口号9800
listen 9800;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9801
listen 9801;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/h5;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号9900
listen 9900;
# 禁用绝对重定向
# 如果没有设置该配置项当Nginx重定向时它将使用绝对路径这意味着当用户访问一个虚拟主机时
# Nginx可能会将他们重定向到另一个主机的URL这可能会导致安全问题和用户体验问题。因此通过
# 设置 absolute_redirect off Nginx将使用相对路径进行重定向以确保用户在同一主机上进
# 行重定向,而不会遇到上述问题。
absolute_redirect off;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/admin;
# 指定默认的索引文件为index.html
index index.html;
# 启用gzip压缩
gzip on;
gzip_static on;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_types text/plain application/javascript text/css application/xml text/javascript;
gzip_vary on;
# 将所有以/api/开头的请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location /api/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
# 处理所有不以/api/开头的请求尝试查找匹配的文件如果没有找到则返回index.html
location ~* ^/(?![api].*) {
try_files $uri /index.html;
}
}
server {
# 监听端口号80
listen 9700;
# 匹配任何主机名
server_name _;
# 指定Web应用程序的根目录
root /app/pc;
# 指定默认的索引文件为index.html
index index.html;
# 将所有请求代理到本地地址为127.0.0.1:9898的Web应用程序后端服务器
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9898/;
}
}

9
docker/redis/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM redis:7.0.12
COPY redis.conf /usr/local/etc/redis/redis.conf
VOLUME /data
EXPOSE 6379
CMD ["redis-server", "/usr/local/etc/redis/redis.conf"]

1377
docker/redis/redis.conf Normal file

File diff suppressed because it is too large Load Diff