|
| 1 | +# Per-SDK: Cloud-ready Sample Repo, Branch, Task Queue, and How It Connects |
| 2 | + |
| 3 | +For the chosen SDK: clone the **`money-transfer-project-cloud-setup`** branch, install deps, then run the Worker and the starter. **The branch is pre-wired for Cloud — there is no connection edit.** |
| 4 | + |
| 5 | +> **Note:** the clone + deps install are done by `scripts/provision.sh provision-and-scaffold` (PE-68), and the Worker + starter run is done by `scripts/provision.sh run-workflow --sdk <sdk> --dir <repo_path>` (PE-70) — a single synchronous call that starts the Worker, waits until it's polling (Temporal API, not `ps`/`pgrep`), runs the starter, and stops the Worker. The per-SDK repo, task queue, and run commands below are the **source of truth the script encodes** — they are reference, not commands you run by hand. |
| 6 | +
|
| 7 | +How each branch connects: **all six SDKs load the named `cloud-setup` profile from `temporal.toml`** (env-config), so the key stays in the locked `0600` file — never in source, argv, or shell history. Step 6 writes that profile; nothing else is needed at run time. *(Verify the SDK's env-config symbol against current docs before relying on it.)* |
| 8 | + |
| 9 | +All connection values come from the **`cloud-setup` profile** in the TOML written in Step 6 (never `default`): |
| 10 | +- `address` = the **namespace endpoint** = the handle + `.tmprl.cloud:7233`, e.g. `<namespace-handle>.tmprl.cloud:7233` (region-agnostic, works with API keys — **not** the regional `<region>.<provider>.api.temporal.io:7233`) |
| 11 | +- `namespace` = `<namespace-handle>` |
| 12 | +- `api_key` = the one-time key |
| 13 | + |
| 14 | +TLS is required for Temporal Cloud (the `cloud-setup` profile / env-config carries it). Worker and starter must use the **same task-queue name** (already set in the sample — do not change it). |
| 15 | + |
| 16 | +## Quick table |
| 17 | + |
| 18 | +| SDK | Repo (branch `money-transfer-project-cloud-setup`) | Task queue | Connects via | |
| 19 | +|-----|------|-----------|--------------| |
| 20 | +| Python | `money-transfer-project-template-python` | `TRANSFER_MONEY_TASK_QUEUE` | `cloud-setup` profile (env-config) | |
| 21 | +| Go | `money-transfer-project-template-go` | `TRANSFER_MONEY_TASK_QUEUE` | `cloud-setup` profile (env-config) | |
| 22 | +| TypeScript | `money-transfer-project-template-ts` | `money-transfer` | `cloud-setup` profile (env-config) | |
| 23 | +| Java | `money-transfer-project-java` | `MONEY_TRANSFER_TASK_QUEUE` | `cloud-setup` profile (env-config) | |
| 24 | +| .NET | `money-transfer-project-template-dotnet` | `MONEY_TRANSFER_TASK_QUEUE` | `cloud-setup` profile (env-config) | |
| 25 | +| Ruby | `money-transfer-project-template-ruby` | `money-transfer` | `cloud-setup` profile (env-config) | |
| 26 | + |
| 27 | +The per-SDK sections below give **install + run** commands. The connection code they show is **reference only** — the cloud branch already contains it; you do not edit it. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## Python |
| 32 | + |
| 33 | +Install: `python3 -m venv env && source env/bin/activate && python -m pip install temporalio` |
| 34 | + |
| 35 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `ClientConfigProfile.load("cloud-setup")` → `Client.connect(**profile.to_client_connect_config())` (`temporalio.envconfig`), in `run_worker.py` and `run_workflow.py`. |
| 36 | + |
| 37 | +Run (activate the venv in each shell): `source env/bin/activate && python run_worker.py` (Worker) then `source env/bin/activate && python run_workflow.py` (starter). |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## Go |
| 42 | + |
| 43 | +Install: `go version` (deps via `go.mod`). |
| 44 | + |
| 45 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `envconfig.LoadClientOptions(LoadClientOptionsRequest{ConfigFileProfile:"cloud-setup"})` → `client.Options` (`go.temporal.io/sdk/contrib/envconfig`), in `worker/main.go` and `start/main.go`. |
| 46 | + |
| 47 | +Run: `go run worker/main.go` then `go run start/main.go`. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## TypeScript |
| 52 | + |
| 53 | +Install: `npm install`. |
| 54 | + |
| 55 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `loadClientConnectConfig({profile:'cloud-setup'})` (`@temporalio/envconfig`) drives both `NativeConnection` (worker, `src/worker.ts`) and `Connection` (client, `src/client.ts`). |
| 56 | + |
| 57 | +Run: `npm run worker` (= `ts-node src/worker.ts`) then `npm run client` (= `ts-node src/client.ts`). (Verified against the `money-transfer-project-cloud-setup` branch's `package.json`.) |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## Java |
| 62 | + |
| 63 | +Build: Maven (`pom.xml`); the run targets compile on demand. |
| 64 | + |
| 65 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `ClientConfigProfile.load(...setConfigFileProfile("cloud-setup"))` → `toWorkflowServiceStubsOptions()` / `toWorkflowClientOptions()` (`io.temporal.envconfig`), in `MoneyTransferWorker.java` and `TransferApp.java`. |
| 66 | + |
| 67 | +Run (Maven, verified against the cloud-setup branch's `Makefile`): worker `mvn compile exec:java -Dexec.mainClass="moneytransferapp.MoneyTransferWorker"` (`make worker`), then starter `mvn compile exec:java -Dexec.mainClass="moneytransferapp.TransferApp"` (`make run`). |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## .NET |
| 72 | + |
| 73 | +Install: `dotnet --version`. |
| 74 | + |
| 75 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `ClientEnvConfig.LoadClientConnectOptions(new ProfileLoadOptions{Profile="cloud-setup"})` → `TemporalClientConnectOptions` (`Temporalio.Common.EnvConfig`), in `MoneyTransferWorker/Program.cs` and `MoneyTransferClient/Program.cs`. |
| 76 | + |
| 77 | +Run: `dotnet run --project MoneyTransferWorker` then `dotnet run --project MoneyTransferClient`. |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Ruby |
| 82 | + |
| 83 | +Install: `bundle install`. |
| 84 | + |
| 85 | +Connects via the `cloud-setup` profile (already in the branch — no edit): `Temporalio::EnvConfig::ClientConfig.load_client_connect_options(profile:'cloud-setup')` → `Client.connect(*args, **kwargs)`, in `worker.rb` and `starter.rb`. |
| 86 | + |
| 87 | +Run: `ruby worker.rb` then `ruby starter.rb`. |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Package managers & minimum versions (PE-75 adaptation) |
| 92 | + |
| 93 | +`scripts/provision.sh detect-tools --sdk <sdk>` reports which managers are **supported by the sample |
| 94 | +AND installed**, picks a deterministic default (first available in preference order; the lockfile's |
| 95 | +manager leads when one is committed), and flags version discrepancies. `install_cmd_for` / |
| 96 | +`install-deps` in `provision.sh` are the single source of truth for the install commands below. |
| 97 | + |
| 98 | +**Only Python and TypeScript ship a real manager choice.** This was confirmed by auditing the |
| 99 | +`money-transfer-project-cloud-setup` branch of each sample repo (Step 0): the Python sample ships |
| 100 | +**no** dependency manifest (`pip install temporalio` only — so `poetry` is not offered), and the |
| 101 | +TypeScript sample commits `package-lock.json` (so `npm` leads). The other four SDKs are single-toolchain. |
| 102 | + |
| 103 | +| SDK | Managers (default first) | Install command (per manager) | |
| 104 | +|-----|--------------------------|-------------------------------| |
| 105 | +| python | **pip**, uv | pip: `python3 -m venv env && . env/bin/activate && python -m pip install -q temporalio` · uv: `uv venv env && . env/bin/activate && uv pip install -q temporalio` | |
| 106 | +| ts | **npm**, pnpm, yarn | npm: `npm install` · pnpm: `pnpm install` · yarn: `yarn install` | |
| 107 | +| go | go | `go mod download` | |
| 108 | +| java | maven | `mvn -q -DskipTests dependency:resolve` (the run targets also compile on demand) | |
| 109 | +| dotnet | dotnet | `dotnet restore` | |
| 110 | +| ruby | bundler | `bundle install` | |
| 111 | + |
| 112 | +**Minimum versions (advisory — a shortfall is a `version-too-old` warning + remediation, never a hard block):** |
| 113 | + |
| 114 | +| Tool | Min | Tool | Min | |
| 115 | +|------|-----|------|-----| |
| 116 | +| python3 | 3.8 | uv | 0.1 | |
| 117 | +| node | 18 | npm | 8 | |
| 118 | +| go | 1.21 | pnpm | 8 | |
| 119 | +| java (JDK) | 8 | yarn | 1.22 | |
| 120 | +| dotnet | 6.0 | maven | 3.6 | |
| 121 | +| ruby | 3.0 | bundler | 2.0 | |
| 122 | + |
| 123 | +Java reports its version with the legacy `1.8.x` scheme for JDK 8; `detect-tools` maps `1.N` to `N` |
| 124 | +so JDK 8 is treated as 8 (not flagged below the JDK-11 line some tools assume — the Temporal Java |
| 125 | +SDK supports JDK 8, so 8 is the intended floor). |
| 126 | + |
| 127 | +## Notes |
| 128 | + |
| 129 | +- If unsure of the exact env-config symbol for the installed SDK version, check the SDK's current "connect to Temporal Cloud" / env-config docs or the sample repo's README. |
| 130 | +- The `address` is the namespace endpoint (`<namespace-handle>.tmprl.cloud:7233`) — built directly from the handle that `namespace create` returns, **not** the Web UI URL and **not** reconstructed via `namespace get -o json` (which returns empty on this prerelease). `scripts/provision.sh create-namespace` derives and returns it as `address`. |
0 commit comments