diff --git a/docs/docs.json b/docs/docs.json index 3f6151c2..cd6492dd 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -85,7 +85,17 @@ "group": "App", "pages": [ "web/getting-started/overview", - "web/getting-started/quickstart" + "web/getting-started/quickstart", + { + "group": "Cloud Templates", + "pages": [ + "web/machine-connection/cloud-templates/index", + "web/machine-connection/cloud-templates/installation-and-usage", + "web/machine-connection/cloud-templates/setup-script", + "web/machine-connection/cloud-templates/best-practices", + "web/machine-connection/cloud-templates/troubleshooting" + ] + } ] }, "pricing" @@ -518,46 +528,6 @@ "source": "/user-guides/memory/understanding-memory", "destination": "/cli/user-guides/become-a-power-user" }, - { - "source": "/user-guides/remote-workspaces", - "destination": "/web/getting-started/overview" - }, - { - "source": "/user-guides/remote-workspaces/best-practices", - "destination": "/web/getting-started/overview" - }, - { - "source": "/user-guides/remote-workspaces/custom-commands", - "destination": "/web/getting-started/overview" - }, - { - "source": "/user-guides/remote-workspaces/installation-and-usage", - "destination": "/web/getting-started/overview" - }, - { - "source": "/user-guides/remote-workspaces/troubleshooting", - "destination": "/web/getting-started/overview" - }, - { - "source": "/web/machine-connection/remote-workspaces/index", - "destination": "/web/getting-started/overview" - }, - { - "source": "/web/machine-connection/remote-workspaces/installation-and-usage", - "destination": "/web/getting-started/overview" - }, - { - "source": "/web/machine-connection/remote-workspaces/setup-script", - "destination": "/web/getting-started/overview" - }, - { - "source": "/web/machine-connection/remote-workspaces/best-practices", - "destination": "/web/getting-started/overview" - }, - { - "source": "/web/machine-connection/remote-workspaces/troubleshooting", - "destination": "/web/getting-started/overview" - }, { "source": "/user-guides/sessions-in-factory/chat-interface", "destination": "/cli/getting-started/overview" diff --git a/docs/factory-docs-map.mdx b/docs/factory-docs-map.mdx index 0e206024..b71b50c0 100644 --- a/docs/factory-docs-map.mdx +++ b/docs/factory-docs-map.mdx @@ -866,32 +866,32 @@ This map uses a hierarchical structure: - Reset Factory Bridge - Getting Additional Help -### [Remote Workspaces - Best Practices](https://docs.factory.ai/web/machine-connection/remote-workspaces/best-practices) +### [Cloud Templates - Best Practices](https://docs.factory.ai/web/machine-connection/cloud-templates/best-practices) - 1. Smart Setup Script Practices - 2. Workflow Patterns That Scale - 3. Team Collaboration Tips - 5. Troubleshooting at a Glance -### [Remote Workspaces](https://docs.factory.ai/web/machine-connection/remote-workspaces) +### [Cloud Templates](https://docs.factory.ai/web/machine-connection/cloud-templates) -- Why use remote workspaces? +- Why use cloud templates? - Get Started - More to Explore -### [Remote Workspaces – Installation & Usage](https://docs.factory.ai/web/machine-connection/remote-workspaces/installation-and-usage) +### [Cloud Templates – Installation & Usage](https://docs.factory.ai/web/machine-connection/cloud-templates/installation-and-usage) - System Requirements - Launching a Remote Workspace inside a Session - Everyday Usage - Troubleshooting & Help -### [Remote Workspaces – Setup Script](https://docs.factory.ai/web/machine-connection/remote-workspaces/setup-script) +### [Cloud Templates – Setup Script](https://docs.factory.ai/web/machine-connection/cloud-templates/setup-script) - 1. How to define a setup script - 2. Troubleshooting Tips -### [Remote Workspaces – Troubleshooting](https://docs.factory.ai/web/machine-connection/remote-workspaces/troubleshooting) +### [Cloud Templates – Troubleshooting](https://docs.factory.ai/web/machine-connection/cloud-templates/troubleshooting) - Quick Reference - 1. Workspace Creation Issues diff --git a/docs/web/getting-started/overview.mdx b/docs/web/getting-started/overview.mdx index 4b16c00b..e454bfb7 100644 --- a/docs/web/getting-started/overview.mdx +++ b/docs/web/getting-started/overview.mdx @@ -2,7 +2,7 @@ title: Overview sidebarTitle: Overview description: If it can be done on a computer, it can be done with a Droid. -keywords: ['factory app', 'desktop app', 'droid', 'factory bridge', 'bridge', 'remote workspaces', 'cloud workspaces', 'local machine', 'download', 'install', 'mac', 'windows', 'ai coding', 'coding assistant'] +keywords: ['factory app', 'desktop app', 'droid', 'factory bridge', 'bridge', 'cloud templates', 'cloud workspaces', 'local machine', 'download', 'install', 'mac', 'windows', 'ai coding', 'coding assistant'] --- @@ -56,7 +56,3 @@ Install, sign in, set your working directory, and start building. [Try the quick Connect Slack, Linear, and other tools - - - **Looking for Factory Bridge or Remote Workspaces?** The Factory App replaces both. The desktop app connects directly to your local machine with Droid built-in — no separate applications or cloud workspaces needed. - diff --git a/docs/web/getting-started/quickstart.mdx b/docs/web/getting-started/quickstart.mdx index 04392ba5..b279ffd0 100644 --- a/docs/web/getting-started/quickstart.mdx +++ b/docs/web/getting-started/quickstart.mdx @@ -1,7 +1,7 @@ --- title: "Quickstart" description: "Get up and running with the Factory App in 5 minutes" -keywords: ['quickstart', 'getting started', 'factory app', 'desktop app', 'droid', 'factory bridge', 'bridge', 'remote workspaces', 'setup', 'install', 'download', 'local machine', 'working directory'] +keywords: ['quickstart', 'getting started', 'factory app', 'desktop app', 'droid', 'factory bridge', 'bridge', 'cloud templates', 'setup', 'install', 'download', 'local machine', 'working directory'] --- diff --git a/docs/web/machine-connection/cloud-templates/best-practices.mdx b/docs/web/machine-connection/cloud-templates/best-practices.mdx new file mode 100644 index 00000000..f18b66aa --- /dev/null +++ b/docs/web/machine-connection/cloud-templates/best-practices.mdx @@ -0,0 +1,56 @@ +--- +title: Cloud Templates - Best Practices +description: Proven tips and workflows to get the most out of cloud templates in Factory +--- + +Cloud templates let you spin up consistent, production-ready development environments in seconds. Below are field-tested practices that keep templates fast, predictable, and team-friendly. + +## 1. Smart Setup Script Practices + +| Practice | Why it matters | How to do it | +| ---------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| **Order commands by dependency** | Later commands may depend on earlier installs. | Run package installation first: `npm ci && npm run build` or `pip install -r requirements.txt && pytest -q` | +| **Use exact package managers** | Consistent lockfiles prevent version drift. | Use `npm ci` (not `npm install`), `pnpm -w i`, or `pip install -r requirements.txt` for reproducible builds | +| **Add error handling** | Stops build on first failure, saves debugging time. | Start your script with `#!/usr/bin/env bash` and `set -euo pipefail` for proper error handling | +| **Make scripts executable early** | Avoid permission errors mid-build. | Add `chmod +x ./scripts/setup.sh && bash ./scripts/setup.sh` or use `bash ./scripts/setup.sh` directly | +| **Keep scripts idempotent** | Re-running setup shouldn't break things. | Use flags like `pip install --no-deps` or check for existing files before creating them | +| **Minimize heavy operations** | Long builds slow down template creation. | Focus on essential setup; defer optional tools to manual installation later | + +> **Tip:** Test your setup script locally first. The script runs with `bash` at the repo root, and you can add `set -euo pipefail` for strict error handling. + + +--- + +## 2. Workflow Patterns That Scale + + + + + Treat remote sessions as disposable: create one per ticket or PR, then archive when merged. + **Benefits:** perfect isolation, zero “works on my machine” drift. + + + + Need to test multiple branches? Launch two separate sessions; switch context without killing processes. + + + + +--- + +## 3. Team Collaboration Tips + +| Tip | Details | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| **Name templates clearly** | Name templates according to the tracked repository, e.g. `factory-mono` to work on the `factory-mono` GitHub repo. | +| **Document entry commands** | Add an `AGENTS.md` file with common tasks (`npm run dev`, `pytest`). Droid automatically reads this file. | + +## 5. Troubleshooting at a Glance + +| Symptom | Resolution | +| ---------------------------- | ---------------------------------------------------------------------------- | +| **Rebuild is slow** | Verify `.dockerignore`, cache heavy installs in image, use lighter base. | +| **Git asks for credentials** | Ensure repository integration is enabled in **Integrations → Repositories**. | +| **Out-of-disk errors** | Prune package caches (`npm cache clean --force`) or rebuild template. | + +Following these practices keeps your cloud templates fast, secure, and collaborative—so you can focus on shipping code, not configuring machines. diff --git a/docs/web/machine-connection/cloud-templates/index.mdx b/docs/web/machine-connection/cloud-templates/index.mdx new file mode 100644 index 00000000..e6b8dffe --- /dev/null +++ b/docs/web/machine-connection/cloud-templates/index.mdx @@ -0,0 +1,50 @@ +--- +title: Cloud Templates +description: Spin-up instant, cloud-hosted templates that mirror your local dev setup. No install required +--- + +Cloud templates let you code **anywhere** without the “works on my machine” dance. Each template is a pre-configured environment that lives in the cloud, boots in seconds and can be customized to run setup commands. +## Why use cloud templates? + +| Benefit | What it means for you | +| ----------------- | ------------------------------------------------------------------------------------------------------- | +| **Zero setup** | Open a session and start coding; no local installs or VM juggling. | +| **Consistency** | Every teammate (and CI job) runs the _exact_ same environment. | +| **Speed** | Heavy builds run on powerful cloud CPUs; your laptop fan stays silent. | +| **Isolation** | Experiments live in disposable templates, keeping your local machine clean. | +| **Collaboration** | Share a template link; reviewers jump into the _live_ environment with code and ports already running. | + +## Get Started + + + + + Use the **Settings → Cloud Templates** page to spin up a new cloud template from your repository. + + + + + Configure a setup script to run during template creation. + + + + Optimize performance, cost, and team workflows with proven tips. + + + + Quickly resolve provisioning, connection issues. + + + + +--- + +### More to Explore + +- [**Installation & Usage** – step-by-step setup guide](/web/machine-connection/cloud-templates/installation-and-usage) + +- [**Best Practices** – performance, cost, collaboration](/web/machine-connection/cloud-templates/best-practices) + +- [**Troubleshooting** – common fixes & FAQs](/web/machine-connection/cloud-templates/troubleshooting) + +Ready? Head to **Settings → Cloud Templates** and launch your first cloud template. Happy coding! diff --git a/docs/web/machine-connection/cloud-templates/installation-and-usage.mdx b/docs/web/machine-connection/cloud-templates/installation-and-usage.mdx new file mode 100644 index 00000000..42fb883e --- /dev/null +++ b/docs/web/machine-connection/cloud-templates/installation-and-usage.mdx @@ -0,0 +1,109 @@ +--- +title: Cloud Templates – Installation & Usage +description: Set up, connect to, and use Cloud Templates inside Factory sessions +--- + +A **cloud template** is a fully-configured, on-demand development environment that lives in the cloud. Cloud templates give you the same tools and dependencies you'd expect locally, so you can build, test, and run code directly from Factory. + + + To get the most out of cloud templates, configure environment variables and a setup script during template creation. The setup script installs dependencies and prepares your development environment automatically, ensuring every team member has an identical setup. + + +## System Requirements + +- A repository enabled in Factory +- Manager role or higher to create cloud templates + + + + + 1. In Factory, click the **Settings** icon from the left sidebar. + 2. Select **Cloud Templates**. + + + + 1. Click **Create Template**. + 2. Enter the repository you want to use. + 3. Give your template a friendly name (e.g., “frontend-template”). + 4. (Optional) Configure a setup script to run during template initialization. + 5. Click **Create**. + + Factory clones your repo and prepares the environment—this can take a minute for large projects. + + + + + The new template appears in the list with a status indicator. Once it shows **Ready**, you can use it from any session. + + + + +--- + +## Launching a Cloud Template inside a Session + + + + + Join any Factory session as usual. + + + + 1. On the session start page, click the Machine Connection button. + 2. Choose **Remote** tab. + 3. Select the template you created earlier. + 4. Factory attaches the cloud template to your session. + + + ![machine-connection-start.gif](/images/web/machine-connection-start.gif) + + + + + A green indicator and remote working directory appear on the top-right next to your profile dropdown menu. You’re now interacting with the cloud template. + + + + +--- + +## Everyday Usage + + + + + Use the **Terminal** toolkit to execute commands like: +
npm run dev
+pytest
+git status
+ Output streams live into chat and logs. +
+ + + Open files from the repo, make changes, and save. + Files persist in the cloud template and can be committed upstream when ready. + + + + Auto-save is disabled by default—enable it from the **Session Settings** panel whenever you want live file syncing. + + +
+ +--- + +## Troubleshooting & Help + + + + + Ensure you: + 1. Selected **Remote Machine** (not Local). + 2. Refresh the page, or try again in a different session + + + + + + Visit the full Cloud Template Troubleshooting Guide + diff --git a/docs/web/machine-connection/cloud-templates/setup-script.mdx b/docs/web/machine-connection/cloud-templates/setup-script.mdx new file mode 100644 index 00000000..a1e90783 --- /dev/null +++ b/docs/web/machine-connection/cloud-templates/setup-script.mdx @@ -0,0 +1,73 @@ +--- +title: Cloud Templates – Setup Script +description: Configure a setup script to run during template creation +--- + +The setup script is a shell script that Factory runs during template creation, after your repository is cloned and before the template is activated. Use this feature to set up your template and give droid tools to work with your codebase. + +## 1. How to define a setup script + +1. In the modal for template creation, in the "Setup Script (Optional)" section, add your initialization script. You can write a multi-line bash script with all the commands you need. +2. Submit. The script runs in the repo root with bash strict mode (consider using `set -euo pipefail` at the start of your script). Script failures will stop the build. +3. Keep your script non‑interactive and idempotent. Write commands that can be safely re-run. +4. Review build logs if anything fails to see detailed output from your script execution. + +Examples: + +**Node.js (Next.js):** +```bash +#!/usr/bin/env bash +set -euo pipefail + +npm ci +npm run build +``` + +**PNPM monorepo:** +```bash +#!/usr/bin/env bash +set -euo pipefail + +pnpm -w i +pnpm -w build +``` + +**Python:** +```bash +#!/usr/bin/env bash +set -euo pipefail + +pip install -r requirements.txt +pytest -q +``` + +**Multi-language project:** +```bash +#!/usr/bin/env bash +set -euo pipefail + +# Install Node.js dependencies +npm ci + +# Install Python dependencies +pip install -r requirements.txt + +# Run setup script +bash ./scripts/setup.sh +``` + +What happens under the hood: +- The script executes after repository cloning, inside the build container at the repo root. +- Environment variables specified in template settings are available during script execution. +- Errors are surfaced clearly (e.g., `Setup script failed: ...`) for quick fixes. + +## 2. Troubleshooting Tips + +| Issue | Fix | +|---|---| +| Setup fails with "Setup script failed: …" | Check the build logs for specific error messages. Run the script locally to debug, add error handling, use non‑interactive flags (e.g., `-y`), then retry. | +| Command not found | Install required tools earlier in your script or ensure they're available in the base Ubuntu image. | +| Permission denied (scripts) | Make scripts executable (`chmod +x ./scripts/setup.sh`) or invoke via interpreter (`bash ./scripts/setup.sh`). | +| Env var not found | Add it in Environment Variables section and reference as `$VAR`. Avoid echoing secrets in your script. | +| Long builds | Keep your script minimal; prefer cached installs (`npm ci` over `npm install`); avoid heavy, non‑essential work. | +| Path/file not found | Scripts run at the repo root. Verify relative paths and that files exist after clone. | diff --git a/docs/web/machine-connection/cloud-templates/troubleshooting.mdx b/docs/web/machine-connection/cloud-templates/troubleshooting.mdx new file mode 100644 index 00000000..66b298e0 --- /dev/null +++ b/docs/web/machine-connection/cloud-templates/troubleshooting.mdx @@ -0,0 +1,85 @@ +--- +title: Cloud Templates – Troubleshooting +description: Diagnose and resolve common problems when creating, connecting to, or working inside a cloud template +--- + +Even the smoothest cloud template can hit a snag. This guide walks you through the quickest fixes for the most common cloud template issues. + +## Quick Reference + +| Category | Typical Symptoms | +| ---------------------- | ----------------------------------------------------------------------------- | +| **Workspace Creation** | “Provisioning” forever, cloning errors, setup script fails | +| **Connection** | Can’t attach from session, pairing spinner never stops, “Machine unavailable” | +| **Performance** | Slow rebuilds, high latency in terminal, laggy editor | +| **Devcontainer** | Build errors, “command not found”, ports not reachable | +| **General Usage** | Git asks for credentials, disk full, permission denied | + +--- + +## 1. Workspace Creation Issues + + + + + **Diagnose** + - Error toast shows *“clone failed”* with a Git exit code + - Private repo? Missing OAuth scopes? + + **Resolve** + 1. Verify the repo is enabled and displays **Connected** in Integrations + 2. Refresh your OAuth token if prompted + + + + + +--- + +## 2. Connection Problems + + + + + In your session, click the **CPU** icon → ensure **Cloud Machine** is selected. + If it shows **Local Machine**, switch to **Cloud Machine** and pick the template. + + + + - Use **Chrome** or **Edge** (other browsers may block WebSocket upgrades). + - Disable VPN/proxy to rule out WebSocket filtering. + - Reload the session tab (⌘R / Ctrl-R). + + + + +--- + +## 3. Performance & Speed + +| Symptom | Fix | +| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| **Rebuild takes > 5 min** | Add `.dockerignore` for `node_modules`, `*.pyc`, build outputs• Use a lighter base image (e.g., alpine) | +| **Terminal latency** | Close unused browser tabs with heavy JS• Check local bandwidth (>5 Mbps recommended)• Pause real-time spell-checker extensions | +| **Editor lag** | Disable file watchers in dev tools (`nodemon`, `webpack --watch`) unless needed• Use auto-save only when collaborating | + +--- + +## 4. General Usage Troubles + +| Issue | Resolution | +| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | +| **Git prompts for credentials** | Make sure the repo integration is connected; cloud template injects HTTPS tokens automatically. | +| **Disk quota exceeded** | Clear package caches (`npm cache clean --force`, `pip cache purge`), remove large build artifacts, or rebuild template. | +| **Permission denied on file save** | File is outside the repo template; save inside `/workspaces//`. | +| **Cannot install global packages** | Use `npm install -g` or `pip install --user`. If still blocked, add commands to `postCreateCommand`. | +| **History lost after rebuild** | Anything outside `/workspaces` is cleared during rebuild. Commit important scripts or store them inside the repo. | + +--- + +## Need More Help? + +- **Best Practices** – Optimize performance with the [Cloud Template Best Practices guide](/web/machine-connection/cloud-templates/best-practices) +- **Support** – Reach out in your Factory support channel with template ID and error message + +> A quick rebuild fixes 80 % of issues—don’t hesitate to click **Rebuild** when in doubt.