跳至內容

伺服器

來源:github.com/tuist/tuist/tree/main/server

用途#

伺服器為 Tuist 嘅伺服器端功能提供支援,例如認證、帳戶同專案、快取儲存、洞察分析、預覽、註冊表,以及整合(GitHub、Slack 同 SSO)。佢係一個基於 Phoenix/Elixir 嘅應用程式,使用 Postgres 同 ClickHouse。

點樣貢獻#

向伺服器作出貢獻需要簽署 CLA(server/CLA.md)。

本地設定#

bash
cd server
mise install
# Dependencies
brew services start postgresql@16
mise run clickhouse:start
# Install dependencies + set up the database
mise run install
# Run the server
mise run dev

喺瀏覽器開啟 http://localhost:8080。喺開發環境中,登入頁面包含一個 以測試用戶身份登入 按鈕,會用預設帳戶([email protected] / tuistrocks)幫你登入。

Note

內部開發人員透過 fnox 從 1Password 載入開發密鑰 — mise run dev 將伺服器包裝喺 fnox exec 入面(參見 server/fnox.toml)。外部貢獻者唔需要 1Password 存取權限;伺服器可以喺本地運行而唔需要佢。OAuth、Stripe 同其他第三方整合會被停用,但核心功能仍然正常運作。

本地 Helm 測試#

你可以使用 kind 同埋內置嘅 mise 任務,喺你部機上啟動完整堆疊。這會喺本地構建 Docker 映像、建立 kind 集群、安裝 chart,並自動轉發所有服務嘅端口:

bash
# Deploy everything (builds images from source)
mise run helm:up --license "YOUR_LICENSE_KEY"
# Include the observability stack (Grafana, Prometheus, Loki, Tempo)
mise run helm:up --license "YOUR_LICENSE_KEY" --observability
# Check status
mise run helm:status
# Tear down
mise run helm:down

前置條件: docker、kind、helm 同 kubectl。

測試同格式化#

  • 測試:mix test
  • 格式化:mise run format