Skip to content

Commit

Permalink
v3.13.0
Browse files Browse the repository at this point in the history
功能变动:

- **重构数据获取逻辑**
- 修改部署配置
- 修改服务状态看板网址
- API 目录更名
- 添加开源协议
- 设置 Poetry package-mode = false
- 禁用前端资源 Brotli 压缩
- 更新依赖库
- 升级 Biome 配置文件 Schema 版本
  • Loading branch information
FHU-yezi committed May 3, 2024
2 parents e0e1ccc + 6b403ad commit bd74892
Show file tree
Hide file tree
Showing 40 changed files with 699 additions and 655 deletions.
16 changes: 10 additions & 6 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
**/node_modules
**/dist
**/__pycache__
**/.ruff_cache
poetry.lock
config.yaml
**/.git/
**/.github/
**/.ruff_cache/
**/__pycache__/
**/dist/
**/node_modules/
**/pyproject.toml
**/poetry.lock
**/requirements-dev.txt
**/config.yaml
8 changes: 2 additions & 6 deletions Caddyfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
# 下线宽限期
grace_period 3s
grace_period 5s

# 日志
log {
level INFO
output stdout
format console
}
}

:8602 {
handle {
header Content-Security-Policy "default-src 'self' wa.sscreator.com 'unsafe-inline' data:"

root * ./static
try_files {path} /index.html
file_server {
# TODO: 由于 Bun 标准库实现问题,暂时禁用 Brotli 压缩
precompressed gzip
}
}
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
FROM python:3.10.8-slim
FROM python:3.10-slim

ENV TZ Asia/Shanghai

WORKDIR /app

COPY backend/requirements.txt .

RUN pip install \
-r requirements.txt \
--no-cache-dir \
--no-compile \
--disable-pip-version-check \
--quiet
--disable-pip-version-check

COPY /backend /app
COPY backend .

CMD ["python", "main.py"]
11 changes: 5 additions & 6 deletions Dockerfile.frontend
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ FROM oven/bun:1-alpine AS build

WORKDIR /app

COPY frontend/package.json frontend/bun.lockb /app

COPY frontend/package.json frontend/bun.lockb .
RUN bun install --prod --frozen-lockfile

COPY frontend /app

COPY frontend .
RUN bun run build

FROM caddy:2.7.4-alpine
FROM caddy:2.7-alpine

WORKDIR /app

COPY --from=build /app/dist ./static
COPY Caddyfile /etc/caddy/Caddyfile
COPY --from=build /app/dist .
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 叶子

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
216 changes: 97 additions & 119 deletions backend/poetry.lock

Large diffs are not rendered by default.

13 changes: 2 additions & 11 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
[tool.poetry]
name = "jtools"
version = "3.12.0"
description = "探索未知"
authors = ["yezi <[email protected]>"]
license = "MIT"
readme = "README.md"
package-mode = false

[tool.poetry.dependencies]
python = "^3.8"
motor = "^3.4.0"
sspeedup = {version = "^0.25.0", extras = ["logging", "config", "api-litestar"]}
uvicorn = "^0.28.0"
uvicorn = "^0.29.0"
httptools = "^0.6.0"
uvloop = "^0.19.0"
jkit = "^3.0.0a16"
Expand All @@ -20,10 +15,6 @@ ruff = "^0.4.0"
pyright = "^1.1.0"
watchfiles = "^0.21.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]

target-version = "py38"
Expand Down
12 changes: 6 additions & 6 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.1 ; python_version >= "3.8" and python_version < "3.11"
faker==24.11.0 ; python_version >= "3.8" and python_version < "4.0"
faker==25.0.0 ; python_version >= "3.8" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.8" and python_version < "4.0"
h2==4.1.0 ; python_version >= "3.8" and python_version < "4.0"
hpack==4.0.0 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -26,19 +26,19 @@ multidict==6.0.5 ; python_version >= "3.8" and python_version < "4.0"
nodeenv==1.8.0 ; python_version >= "3.8" and python_version < "4.0"
polyfactory==2.15.0 ; python_version >= "3.8" and python_version < "4.0"
pygments==2.17.2 ; python_version >= "3.8" and python_version < "4.0"
pymongo==4.6.3 ; python_version >= "3.8" and python_version < "4.0"
pyright==1.1.359 ; python_version >= "3.8" and python_version < "4.0"
pymongo==4.7.1 ; python_version >= "3.8" and python_version < "4.0"
pyright==1.1.361 ; python_version >= "3.8" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "4.0"
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "4.0"
rich-click==1.7.4 ; python_version >= "3.8" and python_version < "4.0"
rich-click==1.8.0 ; python_version >= "3.8" and python_version < "4.0"
rich==13.7.1 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.4.0 ; python_version >= "3.8" and python_version < "4.0"
ruff==0.4.2 ; python_version >= "3.8" and python_version < "4.0"
setuptools==69.5.1 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
sspeedup[api-litestar,config,logging]==0.25.1 ; python_version >= "3.8" and python_version < "4.0"
typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.28.1 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.29.0 ; python_version >= "3.8" and python_version < "4.0"
uvloop==0.19.0 ; python_version >= "3.8" and python_version < "4.0"
watchfiles==0.21.0 ; python_version >= "3.8" and python_version < "4.0"
zipp==3.18.1 ; python_version >= "3.8" and python_version < "3.10"
8 changes: 4 additions & 4 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ click==8.1.7 ; python_version >= "3.8" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.8" and python_version < "4.0" and platform_system == "Windows"
dnspython==2.6.1 ; python_version >= "3.8" and python_version < "4.0"
exceptiongroup==1.2.1 ; python_version >= "3.8" and python_version < "3.11"
faker==24.11.0 ; python_version >= "3.8" and python_version < "4.0"
faker==25.0.0 ; python_version >= "3.8" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.8" and python_version < "4.0"
h2==4.1.0 ; python_version >= "3.8" and python_version < "4.0"
hpack==4.0.0 ; python_version >= "3.8" and python_version < "4.0"
Expand All @@ -25,15 +25,15 @@ msgspec==0.18.6 ; python_version >= "3.8" and python_version < "4.0"
multidict==6.0.5 ; python_version >= "3.8" and python_version < "4.0"
polyfactory==2.15.0 ; python_version >= "3.8" and python_version < "4.0"
pygments==2.17.2 ; python_version >= "3.8" and python_version < "4.0"
pymongo==4.6.3 ; python_version >= "3.8" and python_version < "4.0"
pymongo==4.7.1 ; python_version >= "3.8" and python_version < "4.0"
python-dateutil==2.9.0.post0 ; python_version >= "3.8" and python_version < "4.0"
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "4.0"
rich-click==1.7.4 ; python_version >= "3.8" and python_version < "4.0"
rich-click==1.8.0 ; python_version >= "3.8" and python_version < "4.0"
rich==13.7.1 ; python_version >= "3.8" and python_version < "4.0"
six==1.16.0 ; python_version >= "3.8" and python_version < "4.0"
sniffio==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
sspeedup[api-litestar,config,logging]==0.25.1 ; python_version >= "3.8" and python_version < "4.0"
typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.28.1 ; python_version >= "3.8" and python_version < "4.0"
uvicorn==0.29.0 ; python_version >= "3.8" and python_version < "4.0"
uvloop==0.19.0 ; python_version >= "3.8" and python_version < "4.0"
zipp==3.18.1 ; python_version >= "3.8" and python_version < "3.10"
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json",
"extends": ["frontend/biome.json"]
}
14 changes: 4 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,24 @@ networks:

services:
frontend:
image: jtools-frontend:3.12.0
image: jtools-frontend:3.13.0
container_name: jtools-frontend
build:
dockerfile: Dockerfile.frontend
ports:
- 8602:8602
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
networks:
- internal
deploy:
resources:
limits:
cpus: "0.50"
memory: 48M
memory: 32M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
stop_grace_period: 5s
backend:
image: jtools-backend:3.12.0
image: jtools-backend:3.13.0
container_name: jtools-backend
build:
dockerfile: Dockerfile.backend
Expand All @@ -43,10 +39,8 @@ services:
deploy:
resources:
limits:
cpus: "1.00"
memory: 96M
memory: 128M
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
stop_grace_period: 5s
5 changes: 4 additions & 1 deletion frontend/biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
"$schema": "https://biomejs.dev/schemas/1.7.2/schema.json",
"linter": {
"rules": {
"style": {
Expand All @@ -10,6 +10,9 @@
},
"suspicious": {
"noExplicitAny": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
}
},
Expand Down
Binary file modified frontend/bun.lockb
Binary file not shown.
39 changes: 17 additions & 22 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jtools",
"private": true,
"version": "3.12.0",
"version": "3.13.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -14,33 +14,28 @@
"biome-ci": "biome ci ."
},
"dependencies": {
"@mantine/hooks": "^7.3.2",
"@mantine/hooks": "^7.3.0",
"@preact/preset-vite": "^2.7.0",
"@preact/signals": "^1.2.2",
"@sscreator/ui": "^0.26.0",
"@unocss/preset-rem-to-px": "^0.58.6",
"@unocss/reset": "^0.58.6",
"@preact/signals": "^1.2.0",
"@sscreator/ui": "^0.27.0",
"@unocss/reset": "^0.58.0",
"clsx": "^2.1.0",
"dayjs": "^1.11.10",
"dayjs": "^1.11.0",
"echarts": "^5.5.0",
"echarts-wordcloud": "^2.1.0",
"preact": "^10.19.3",
"react-hot-toast": "^2.4.1",
"react-qr-code": "^2.0.12",
"resize-observer": "^1.0.4",
"swr": "^2.2.4",
"unocss": "^0.58.6",
"vite": "^5.0.10",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-pwa": "^0.17.4",
"workbox-window": "^7.0.0",
"wouter-preact": "^2.12.2"
"preact": "^10.21.0",
"react-hot-toast": "^2.4.0",
"react-qr-code": "^2.0.0",
"resize-observer": "^1.0.0",
"swr": "^2.2.0",
"unocss": "^0.58.0",
"vite": "^5.0.0",
"vite-plugin-compression": "^0.5.0",
"vite-plugin-pwa": "^0.20.0",
"wouter-preact": "^3.1.0"
},
"devDependencies": {
"@biomejs/biome": "^1.5.3",
"@biomejs/biome": "^1.5.0",
"rollup-plugin-visualizer": "^5.12.0"
},
"overrides": {
"@rollup/plugin-node-resolve": "^15.2.3"
}
}
Loading

0 comments on commit bd74892

Please sign in to comment.