> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 6. 安裝後工作

> 建立管理員、驗證沙箱編譯與資料持久性，並讓 Ayakaleaf Pro 在 Windows 上持續運作。

### 建立管理員與第一個專案

在您的 **Windows 瀏覽器**中開啟 [http://localhost:8080/launchpad](http://localhost:8080/launchpad)，建立第一個管理員帳號並登入。接著依照 Linux 指南的 [6. 安裝後工作](https://ayakaleaf-pro.mintlify.site/zh-TW/on-premises/installation/using-docker-compose/linux/6.-post-installation-tasks.md)操作，並在其範例 URL 中使用連接埠 `8080`。

### 驗證編譯

登入頁面能正常運作，並不代表獨立的編譯器容器可以存取 WSL 資料目錄。請建立一個空白專案，並以 **pdfLaTeX** 編譯以下 `main.tex`：

```latex theme={null}
\documentclass{article}
\begin{document}
Ayakaleaf Pro on Windows WSL 2.
\end{document}
```

PDF 預覽應該會顯示這段文字。若使用 basic 映像檔，如有需要，請在專案設定中選擇 **TeX Live 2026 Basic**。

選擇 **XeLaTeX** 並測試：

```latex theme={null}
\documentclass{article}
\usepackage{fontspec}
\begin{document}
Ayakaleaf WSL XeLaTeX sandbox.
\end{document}
```

這兩個範例在 basic 中都能運作。對於中文文件，請先使用包含 `ctex` 與所需字型的映像檔（例如 full），再以 **XeLaTeX** 測試以下內容。basic 不包含這些：

```latex theme={null}
\documentclass{ctexart}
\begin{document}
你好，Ayakaleaf Pro。
\end{document}
```

若要確認有使用沙箱，請在編譯期間於 **Ubuntu** 中執行：

```bash theme={null}
docker ps -a --filter ancestor=ghcr.io/ayaka-notes/texlive-basic:2026.1
bin/logs -f clsi
```

請在篩選條件中使用您所選的映像檔名稱。較短的編譯可能會在 `docker ps` 執行前就完成；`-a` 也會在清理前顯示已停止的容器。編譯器容器應使用該映像檔，並有一個來自 Toolkit WSL 資料目錄的 `/compile` bind mount。僅檢查應用程式記錄並不能取代檢查 PDF。

### 驗證資料持久性

在 **Ubuntu** 中，從 Toolkit 目錄執行：

```bash theme={null}
bin/stop
bin/start
```

等待應用程式啟動，從 Windows 重新開啟專案並再次編譯。您的帳號、原始碼與專案檔案應該都還在。預設的即時資料位於 Ubuntu 內的 `~/ayakaleaf-toolkit/data/`。請同時保留 `config/` 與 `data/`；解除安裝或取消註冊 Ubuntu 發行版可能會刪除它們。

### 保持執行個體可用

要讓執行個體持續運作，需要三個條件：Windows 保持喚醒、Docker Desktop 持續執行，以及容器隨引擎一同重新啟動。

在 Docker Desktop 的 **Settings → General** 中，開啟 **Start Docker Desktop when you sign in to your computer**，請參閱 [Docker Desktop 設定](https://docs.docker.com/desktop/settings-and-maintenance/settings/)。這會在登入後啟動 Docker，而不是在登入前。Windows 重新啟動後，請登入、等待 Docker Desktop 完成啟動，然後開啟 Ubuntu 並檢查 `docker ps` 與網站。

Docker Desktop 的 **Resource Saver** 與 Windows 睡眠是兩回事。它通常只會在沒有任何容器執行時啟動；正在執行的應用程式、MongoDB 與 Redis 會使其無法進入閒置狀態。在 WSL 2 上，它會暫停 Docker 引擎，而不是關閉共用的 WSL VM。在為使用者提供服務時，請勿手動 **Pause** Docker Desktop。您不需要只為了讓此堆疊持續執行而停用 Resource Saver；請參閱 [Docker 的 Resource Saver 文件](https://docs.docker.com/desktop/use-desktop/resource-saver/)。

Toolkit 的服務使用 `restart: always`。請在 **Ubuntu** 中確認實際設定：

```bash theme={null}
docker inspect sharelatex mongo redis --format '{{.Name}} restart={{.HostConfig.RestartPolicy.Name}}'
```

每個服務都應回報 `always`。Docker 執行後，就能在不需要重新執行 `bin/up` 的情況下重新啟動這些既有容器。手動停止的容器會維持停止狀態，直到您啟動它或重新啟動引擎為止；設為 `always` 時，引擎重新啟動可能會再次啟動它。請參閱 [Docker 的重新啟動原則行為](https://docs.docker.com/engine/containers/start-containers-automatically/)。

| 動作 | 對 Ayakaleaf 的影響 |
| - | - |
| 在 `bin/up -d` 之後關閉 Ubuntu 終端機 | 容器以分離模式執行；終端機並不是它們的監管者。請讓 Docker Desktop 與 WSL 環境保持可用 |
| 關閉 Docker Dashboard 視窗 | 視窗可以關閉，Docker Desktop 會繼續在系統匣中執行 |
| 選擇 **Quit Docker Desktop** | 會停止引擎並使網站無法使用；再次開啟 Docker Desktop 即可復原 |
| 執行 `wsl --shutdown` | 會停止所有 WSL 發行版並中斷 Docker 的 WSL 後端；請重新啟動 Docker Desktop 並重新開啟 Ubuntu |
| 讓 Windows 睡眠、休眠或關機 | 服務無法使用；只讓螢幕保持開啟或關閉並不會改變這一點 |
| 執行 `bin/stop` | 停止執行個體但保留其資料；使用 `bin/start` 即可恢復 |

若要在使用交流電源時長時間執行，請開啟 Windows 11 的 **Settings → System → Power & battery → Screen, sleep & hibernate timeouts**（部分版本顯示為 **Power** 或 **Screen and sleep**）。將接上電源時的睡眠逾時設為 **Never**，若有設定自動休眠也請將其停用。螢幕仍然可以關閉。筆電的上蓋動作是另一項獨立設定；即使閒置睡眠逾時設為 Never，闔上上蓋仍可能使其進入睡眠。請參閱 [Windows 電源設定](https://support.microsoft.com/en-us/windows/experience/power-battery/power-settings-in-windows-11)。

網站使用中時，請勿將 `wsl --shutdown` 當作例行清理來執行。若某項 WSL 設定變更需要執行它，請先停止執行個體並規劃中斷時間。透過這些設定，Windows 可以讓執行個體持續執行。對於必須在登出與無人值守重新開機後仍能持續運作的共用服務，我們建議使用 [Linux 指南](https://ayakaleaf-pro.mintlify.site/zh-TW/on-premises/installation/using-docker-compose/linux)。

### 檢查重新啟動 Docker Desktop 後的復原情況

儲存工作並等待進行中的編譯完成後，從 Docker Desktop 的疑難排解選單中選擇 **Restart Docker Desktop**。等待引擎啟動，然後在 **Ubuntu** 中檢查：

```bash theme={null}
docker ps
curl -I http://localhost:8080/launchpad
```

在 Windows 中開啟既有專案並再次編譯。確認帳號與原始碼仍然存在。

若您是刻意使用 `bin/stop` 停止執行個體，請使用 `bin/start`。若 Docker 已啟動但某個服務失敗，請讀取其記錄，而不是重新建立設定。Windows Update、Docker 更新與停電仍可能中斷全天候 24 小時運作的安裝；請保留備份，並在計畫性維護後檢查復原情況。

### 日常使用

在 Windows 中啟動 Docker Desktop。開啟 **Ubuntu**：

```bash theme={null}
cd "$HOME/ayakaleaf-toolkit"
```

| 工作 | 指令 |
| - | - |
| 啟動既有的容器 | `bin/start` |
| 停止容器並保留資料 | `bin/stop` |
| 套用設定變更 | `bin/up -d` |
| 檢查狀態 | `bin/docker-compose ps` |
| 讀取啟動記錄 | `bin/docker-compose logs --tail=100 sharelatex` |
| 讀取 MongoDB 記錄 | `bin/docker-compose logs --tail=100 mongo` |
| 讀取編譯器記錄 | `bin/logs -f clsi` |

`bin/start` 不會套用設定的編輯：變更 `config/` 後請使用 `bin/up -d`。在升級、搬移或移除 WSL 發行版之前，請依照[資料與備份](https://ayakaleaf-pro.mintlify.site/zh-TW/on-premises/maintenance/data-and-backups)操作。在資料庫寫入時複製即時的 MongoDB 檔案，並不是一致的備份。

本機使用時，請保持 `127.0.0.1`。若要提供給其他電腦使用，還需要刻意設定監聽位址、網站 URL、Windows 防火牆／網路設定以及 HTTPS；僅變更 `OVERLEAF_SITE_URL` 並不會對外發布連接埠。

若有任何問題，請參閱[疑難排解](https://ayakaleaf-pro.mintlify.site/zh-TW/on-premises/installation/using-docker-compose/windows/troubleshooting.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.