|
1 | 1 | # SPA-SERVER |
| 2 | + |
2 | 3 | [](https://github.com/ForNetCode/spa-server/releases) |
3 | 4 | [](https://github.com/ForNetCode/spa-server/actions/workflows/spa-server-ci.yml) |
4 | 5 | [](LICENSE) |
5 | 6 | [](https://github.com/ForNetCode/spa-server/graphs/commit-activity) |
6 | 7 | [](https://github.com/ForNetCode/spa-server/pulls) |
7 | 8 |
|
8 | | - |
9 | 9 | 专为静态页面提供全链路优化的托管服务。 |
10 | 10 |
|
11 | 11 | [ENGLISH README](./README.md) |
| 12 | + |
12 | 13 | ## 特性 |
13 | | -- 基于 Hyper 和 warp 构建。 |
14 | | -- SSL 基于 Rustls。 |
15 | | -- 服务器端缓存、客户端缓存(Cache-Content)、Gzip压缩。 |
| 14 | + |
| 15 | +- 基于 Salvo 构建。 |
16 | 16 | - SPA 版本管理, 仅需要一个 http 请求就能实现版本回滚和更新。 |
17 | | -- 支持热更新(Mac and Linux)。 |
18 | | -- 支持 CORS 跨域 |
19 | | -- http/https 同时服务(http 也可返回 redirect https)。 |
20 | 17 | - 支持 Docker 镜像(压缩后大小:~26M) |
21 | 18 | - 提供 命令行/npm包 客户端,一行命令部署 |
22 | 19 | - 每个域名可拥有独立的配置 |
23 | | -- 支持 Let's Encrypt |
24 | | -- 支持 OpenTelemetry |
25 | 20 | - 提供JS SDK、命令行客户端与服务器进行交互。 |
26 | 21 |
|
27 | 22 | ## 文档 |
28 | | -中文 README 目前仅提供一些简易`快速使用`指引,更多内容可参考英文文档, 中文版会在后续有精力的时候做,其网站托管在 [GitHub Pages](https://fornetcode.github.io/spa-server), |
| 23 | + |
| 24 | +中文 README 目前仅提供一些简易`快速使用`指引,更多内容可参考英文文档, |
| 25 | +中文版会在后续有精力的时候做,其网站托管在 [GitHub Pages](https://fornetcode.github.io/spa-server), |
29 | 26 |
|
30 | 27 | ## 服务跑起来 |
31 | 28 |
|
32 | | -配置文件说明: [`config.release.conf`](./config.release.conf). |
| 29 | +配置文件说明: [`config.release.conf`](./config.release.conf). |
33 | 30 |
|
34 | 31 | 可以通过修改环境变量 `SPA_CONFIG=${config_path}`, 来更改配置文件地址。 |
35 | 32 |
|
36 | 33 | ### 通过源码 |
| 34 | + |
37 | 35 | ```shell |
38 | 36 | git clone [email protected]:fornetcode/spa-server.git |
39 | 37 | cd spa-server |
40 | | -git submodule init && git submodule update |
41 | 38 | cp config.release.toml config.toml # please remember to change `file_dir` in config.conf |
42 | 39 | cargo run --bin spa-server |
43 | 40 | ``` |
44 | 41 |
|
45 | 42 | ### 通过镜像 |
| 43 | + |
46 | 44 | ```shell |
47 | 45 | docker run -d -p 80 -v $HOST_VOLUME:/data -v $CONFIG:/config.conf ghcr.io/fornetcode/spa-server:latest |
48 | 46 | ``` |
49 | 47 |
|
50 | 48 | ## 如何部署静态文件 |
51 | | -如果你想集成到JS项目中,请参阅:[example/js-aapp-example](example/tmp/README.md)。 |
52 | | - |
53 | | -## spa-server 使用场景 |
54 | | -### 单独使用 |
55 | | -根据自己的需求配置好 `cache`, 可获得极大的性能提升。 若需要热加载功能(ssl证书更替)/文件版本管理/客户端交互,请开启 `admin server` 配置。 |
56 | | -### 搭配 Nginx 使用 |
57 | | -请在默认配置的基础上,请对 `cache.compression, cache.client_cache, cors` 保持默认/禁用,相关配置所带来的功能可设定在Nginx端,预防本服务和Nginx出现冲突。 |
58 | | -### 高可用 |
59 | | -目前项目没有做高可用的适配,需要注意以下几点: |
60 | | -1. 文件最好放在 S3/NFS 等可以共享到所有spa-server实例的文件系统中,否则 `Last-Modified` 不一致会对客户端缓存有一定影响。 |
61 | | -2. 所有控制请求,需要对每个实例都发起一遍。 |
62 | 49 |
|
63 | | -## 项目规划 |
64 | | -请参阅 [项目规划](docs/develop/roadmap.md). |
| 50 | +如果你想集成到JS项目中,请参阅:[example/js-app-example](example/tmp/README.md)。 |
65 | 51 |
|
66 | | -## 为何自行维护 warp 版本 |
67 | | -[#171 Add reply::file(path) helper](https://github.com/seanmonstar/warp/issues/171) |
| 52 | +## 项目规划 |
68 | 53 |
|
69 | | -本项目用了很多 warp/src/filters/fs.rs 的私有API。 |
| 54 | +请参阅 [项目规划](docs/develop/roadmap.md). |
70 | 55 |
|
71 | 56 | ## 项目起源 |
| 57 | + |
72 | 58 | 请跳转至 [SPA 发布辅助工具](https://github.com/timzaak/blog/issues/80) 浏览。 |
0 commit comments