Skip to content

Commit 6b5b68d

Browse files
committed
docs: improve README and updater guide
1 parent f665e66 commit 6b5b68d

2 files changed

Lines changed: 391 additions & 4 deletions

File tree

README.md

Lines changed: 131 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,134 @@
1-
# Tauri + React + Typescript
1+
# DevStack
22

3-
This template should help get you started developing with Tauri, React and Typescript in Vite.
3+
<p align="center">
4+
Desktop local development environment for Windows, built with Tauri v2 + React.
5+
</p>
46

5-
## Recommended IDE Setup
7+
<p align="center">
8+
<a href="https://github.com/holdon1996/dev-stack/releases">
9+
<img src="https://img.shields.io/github/v/release/holdon1996/dev-stack?display_name=tag&style=for-the-badge" alt="Release">
10+
</a>
11+
<a href="https://github.com/holdon1996/dev-stack/actions/workflows/release.yml">
12+
<img src="https://img.shields.io/github/actions/workflow/status/holdon1996/dev-stack/release.yml?style=for-the-badge&label=release" alt="Release Workflow">
13+
</a>
14+
<a href="https://github.com/holdon1996/dev-stack/stargazers">
15+
<img src="https://img.shields.io/github/stars/holdon1996/dev-stack?style=for-the-badge" alt="Stars">
16+
</a>
17+
<a href="https://github.com/holdon1996/dev-stack/network/members">
18+
<img src="https://img.shields.io/github/forks/holdon1996/dev-stack?style=for-the-badge" alt="Forks">
19+
</a>
20+
<a href="https://github.com/holdon1996/dev-stack/issues">
21+
<img src="https://img.shields.io/github/issues/holdon1996/dev-stack?style=for-the-badge" alt="Issues">
22+
</a>
23+
</p>
624

7-
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
25+
## Overview
26+
27+
DevStack is a desktop tool for managing a local PHP / Apache / MySQL development stack on Windows with a fast native Rust backend.
28+
29+
It focuses on:
30+
31+
- managing Apache, MySQL, PHP, Redis, and project services in one UI
32+
- switching installed runtime versions without a heavy VM or container workflow
33+
- handling virtual hosts, local sites, ports, logs, and quick config from one app
34+
- shipping as a native Windows desktop app with tray support and auto-update support
35+
36+
## Highlights
37+
38+
- Native Tauri v2 desktop app
39+
- React + Zustand frontend
40+
- Rust backend for process management, file operations, downloads, and system integration
41+
- Apache version management
42+
- PHP version management and per-project switching
43+
- MySQL management and query execution
44+
- Virtual host setup with hosts file sync
45+
- Tunnel integrations page
46+
- Log viewer for Apache, MySQL, PHP, and Redis
47+
- Start with Windows support
48+
- Native updater support for packaged releases
49+
50+
## Main Sections
51+
52+
- `Services`: start, stop, monitor, and auto-start managed services
53+
- `Sites`: create and manage local virtual hosts and project folders
54+
- `Apache`: install and switch Apache builds
55+
- `Database`: manage MySQL versions and run quick queries
56+
- `PHP`: install, switch, and patch PHP runtimes
57+
- `Tunnels`: expose local services through supported tunnel providers
58+
- `Quick Config`: shortcut actions for common setup tasks
59+
- `Settings`: paths, ports, startup behavior, editor, and updates
60+
61+
## Tech Stack
62+
63+
- Tauri v2
64+
- React 19
65+
- Zustand
66+
- Tailwind CSS
67+
- Rust
68+
69+
## Project Structure
70+
71+
```text
72+
src/ React UI, state slices, hooks
73+
src-tauri/ Rust commands, Tauri config, bundling
74+
src/store/ Zustand slices for app domains
75+
scripts/ Local helper scripts
76+
.github/workflows/ Release automation
77+
```
78+
79+
## Quick Start
80+
81+
### Prerequisites
82+
83+
- Node.js 20+
84+
- Rust stable
85+
- Windows
86+
87+
### Development
88+
89+
```powershell
90+
npm install
91+
npm run tauri dev
92+
```
93+
94+
### Production Build
95+
96+
```powershell
97+
npm run tauri build
98+
```
99+
100+
## Releases And Auto Update
101+
102+
Updater and release signing are already wired into the app and workflow.
103+
104+
- Release workflow: [.github/workflows/release.yml](/f:/dev-stack/.github/workflows/release.yml)
105+
- Updater setup guide: [UPDATER_SETUP.md](/f:/dev-stack/UPDATER_SETUP.md)
106+
- Local env helper: [scripts/set-updater-env.ps1](/f:/dev-stack/scripts/set-updater-env.ps1)
107+
108+
If the repository is private, GitHub-hosted updater assets will not be publicly downloadable by end users. For the current updater URL strategy, the repository should be public or served through a separate update endpoint.
109+
110+
## Recommended Setup
111+
112+
- VS Code
113+
- Tauri extension
114+
- rust-analyzer
115+
116+
## Roadmap
117+
118+
- Better release presentation and screenshots
119+
- More automated runtime discovery
120+
- Improved SSL and local certificate flow
121+
- Better onboarding for first-time setup
122+
123+
## Star History
124+
125+
<p align="center">
126+
<a href="https://star-history.com/#holdon1996/dev-stack&Date">
127+
<img src="https://api.star-history.com/svg?repos=holdon1996/dev-stack&type=Date" alt="Star History Chart">
128+
</a>
129+
</p>
130+
131+
## Support
132+
133+
- Issues: https://github.com/holdon1996/dev-stack/issues
134+
- Releases: https://github.com/holdon1996/dev-stack/releases

UPDATER_SETUP.md

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
# DevStack Updater Setup
2+
3+
Tài liệu này ghi rõ cách tạo lại updater key, setup GitHub Secrets, build release, và cách updater native trong app đang được cấu hình.
4+
5+
## Tổng quan
6+
7+
App hiện đang có 2 chế độ:
8+
9+
- Native auto-update của Tauri: chỉ hoạt động khi lúc build có `TAURI_UPDATER_PUBKEY``TAURI_UPDATER_ENDPOINT`.
10+
- Manual update fallback: nếu build không có 2 biến trên, app vẫn check GitHub Releases và mở trang tải bản mới.
11+
12+
Code hiện đang đọc 2 biến này bằng `option_env!`, nên đây là compile-time env vars. Nghĩa là chúng phải có sẵn trong GitHub Actions trước khi chạy build.
13+
14+
## 1. Tạo lại updater key
15+
16+
Chỉ tạo lại key nếu bạn chưa phát hành updater cho người dùng, hoặc bạn chấp nhận rằng các bản đã cài bằng key cũ sẽ không nhận được native update nữa.
17+
18+
### Xóa key cũ
19+
20+
Chạy trên PowerShell:
21+
22+
```powershell
23+
Remove-Item "$HOME\.tauri\devstack.key" -Force -ErrorAction SilentlyContinue
24+
Remove-Item "$HOME\.tauri\devstack.key.pub" -Force -ErrorAction SilentlyContinue
25+
```
26+
27+
Nếu thư mục chưa tồn tại:
28+
29+
```powershell
30+
New-Item -ItemType Directory -Force "$HOME\.tauri"
31+
```
32+
33+
### Tạo key mới có password
34+
35+
```powershell
36+
npm run tauri signer generate -- -w "$HOME\.tauri\devstack.key"
37+
```
38+
39+
CLI sẽ hỏi:
40+
41+
```text
42+
Please enter a password to protect the secret key.
43+
Password:
44+
Password (one more time):
45+
```
46+
47+
Nhập password bạn muốn dùng để mã hóa private key.
48+
49+
### Kiểm tra key đã tạo
50+
51+
```powershell
52+
Get-ChildItem "$HOME\.tauri\devstack.key*"
53+
```
54+
55+
Lấy public key:
56+
57+
```powershell
58+
Get-Content "$HOME\.tauri\devstack.key.pub"
59+
```
60+
61+
Lấy private key:
62+
63+
```powershell
64+
Get-Content "$HOME\.tauri\devstack.key"
65+
```
66+
67+
## 2. GitHub cần setup gì
68+
69+
Vào repo GitHub:
70+
71+
`Settings` -> `Secrets and variables` -> `Actions` -> `New repository secret`
72+
73+
Tạo 3 secrets sau:
74+
75+
### `TAURI_SIGNING_PRIVATE_KEY`
76+
77+
Giá trị là nội dung file private key:
78+
79+
```powershell
80+
Get-Content "$HOME\.tauri\devstack.key" -Raw
81+
```
82+
83+
Copy toàn bộ nội dung đó vào secret.
84+
85+
### `TAURI_SIGNING_PRIVATE_KEY_PASSWORD`
86+
87+
Giá trị là password bạn vừa nhập lúc generate key.
88+
89+
### `TAURI_UPDATER_PUBKEY`
90+
91+
Giá trị là nội dung file public key:
92+
93+
```powershell
94+
Get-Content "$HOME\.tauri\devstack.key.pub" -Raw
95+
```
96+
97+
Copy toàn bộ nội dung đó vào secret.
98+
99+
## 3. `TAURI_UPDATER_ENDPOINT` là gì và setup thế nào
100+
101+
Biến này là URL mà app sẽ dùng để check native updater.
102+
103+
Trong workflow đã tạo sẵn, mình đặt:
104+
105+
```text
106+
https://github.com/<owner>/<repo>/releases/latest/download/latest.json
107+
```
108+
109+
Với repo này nó sẽ trở thành:
110+
111+
```text
112+
https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json
113+
```
114+
115+
Bạn không cần tạo secret riêng cho biến này nếu giữ nguyên workflow hiện tại, vì workflow đã set trực tiếp trong `env`.
116+
117+
Nếu sau này bạn muốn đổi sang CDN riêng hoặc update server riêng, sửa:
118+
119+
[`release.yml`](/f:/dev-stack/.github/workflows/release.yml)
120+
121+
dòng `TAURI_UPDATER_ENDPOINT`.
122+
123+
## 3.1. Vì sao local build báo thiếu `pubkey`
124+
125+
Tauri updater không chỉ đọc cấu hình ở runtime. Ngay lúc `tauri build`, bundler cũng sẽ parse:
126+
127+
- `plugins.updater.pubkey`
128+
- `plugins.updater.endpoints`
129+
130+
trong:
131+
132+
[`tauri.conf.json`](/f:/dev-stack/src-tauri/tauri.conf.json)
133+
134+
Nếu thiếu `pubkey`, build sẽ dừng với lỗi kiểu:
135+
136+
```text
137+
failed to parse updater plugin configuration: missing field `pubkey`
138+
```
139+
140+
Vì vậy file config phải luôn có 2 trường này.
141+
142+
Hiện trong repo mình đã thêm sẵn:
143+
144+
```json
145+
"updater": {
146+
"pubkey": "PASTE_YOUR_TAURI_UPDATER_PUBLIC_KEY_HERE",
147+
"endpoints": [
148+
"https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
149+
]
150+
}
151+
```
152+
153+
Việc bạn cần làm là thay:
154+
155+
`PASTE_YOUR_TAURI_UPDATER_PUBLIC_KEY_HERE`
156+
157+
bằng đúng nội dung file:
158+
159+
```powershell
160+
Get-Content "$HOME\.tauri\devstack.key.pub" -Raw
161+
```
162+
163+
Lưu ý:
164+
165+
- Đây là public key nên có thể commit vào repo.
166+
- Không dùng path file ở đây.
167+
- Phải là nội dung đầy đủ của public key trên một chuỗi string.
168+
169+
## 4. Build release local để test
170+
171+
Nếu muốn build local có updater native:
172+
173+
```powershell
174+
$env:TAURI_SIGNING_PRIVATE_KEY = "$HOME\.tauri\devstack.key"
175+
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "<password-của-bạn>"
176+
$env:TAURI_UPDATER_PUBKEY = Get-Content "$HOME\.tauri\devstack.key.pub" -Raw
177+
$env:TAURI_UPDATER_ENDPOINT = "https://github.com/holdon1996/dev-stack/releases/latest/download/latest.json"
178+
npm run tauri build
179+
```
180+
181+
Hoặc dùng script đã tạo sẵn:
182+
183+
[`set-updater-env.ps1`](/f:/dev-stack/scripts/set-updater-env.ps1)
184+
185+
```powershell
186+
. .\scripts\set-updater-env.ps1
187+
npm run tauri build
188+
```
189+
190+
Nếu muốn truyền password trực tiếp:
191+
192+
```powershell
193+
. .\scripts\set-updater-env.ps1 -Password "<password-của-bạn>"
194+
npm run tauri build
195+
```
196+
197+
Lưu ý:
198+
199+
- `TAURI_SIGNING_PRIVATE_KEY` dùng path hoặc content đều được, theo docs Tauri.
200+
- `TAURI_UPDATER_PUBKEY` trong app hiện tại đang được nhúng vào lúc build, nên cần có trước `npm run tauri build`.
201+
- `.env` không được Tauri dùng cho signing key trong lúc build release.
202+
- Ngoài ra, trước khi build local bạn nên mở [`tauri.conf.json`](/f:/dev-stack/src-tauri/tauri.conf.json) và thay `pubkey` placeholder bằng public key thật.
203+
204+
## 5. Release trên GitHub
205+
206+
Workflow đã được tạo sẵn:
207+
208+
[`release.yml`](/f:/dev-stack/.github/workflows/release.yml)
209+
210+
Workflow này sẽ:
211+
212+
- chạy khi push tag dạng `v*`
213+
- build bản Windows
214+
- ký updater artifacts
215+
- upload release assets lên GitHub Release
216+
- tạo `latest.json` để native updater dùng
217+
218+
### Cách release
219+
220+
Cập nhật version trước:
221+
222+
- [`package.json`](/f:/dev-stack/package.json)
223+
- [`src-tauri/Cargo.toml`](/f:/dev-stack/src-tauri/Cargo.toml)
224+
- [`src-tauri/tauri.conf.json`](/f:/dev-stack/src-tauri/tauri.conf.json)
225+
226+
Nên để cùng một version, ví dụ `1.0.1`.
227+
228+
Sau đó tạo tag:
229+
230+
```powershell
231+
git add .
232+
git commit -m "release: v1.0.1"
233+
git tag v1.0.1
234+
git push origin main
235+
git push origin v1.0.1
236+
```
237+
238+
Khi workflow chạy xong, vào tab `Releases` trên GitHub để kiểm tra:
239+
240+
- có file installer `.exe` và/hoặc `.msi`
241+
- có file `.sig`
242+
- có file `latest.json`
243+
244+
## 6. App đang dùng updater như thế nào
245+
246+
Nếu build có đầy đủ biến updater:
247+
248+
- Settings sẽ hiện chế độ `Native auto-update`
249+
- app có thể check, download, install update ngay trong app
250+
251+
Nếu build thiếu cấu hình updater:
252+
253+
- Settings sẽ hiện `Manual download`
254+
- app vẫn check release mới nhất, nhưng sẽ mở trang tải về thay vì auto-install
255+
256+
## 7. Nguồn tham khảo chính thức
257+
258+
- Tauri updater guide: https://v2.tauri.app/plugin/updater/
259+
- Tauri updater JS API: https://v2.tauri.app/reference/javascript/updater/
260+
- tauri-plugin-updater README: https://docs.rs/crate/tauri-plugin-updater/latest/source/README.md

0 commit comments

Comments
 (0)