Files
nexus/wiki/sources/Trae远程开发部署指南.md

50 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Trae 远程开发部署指南"
type: source
tags: [trae, remote-ssh, ubuntu, docker, development]
date: 2025-03-29
---
## Source File
- [[raw/Vibe Coding/Trae远程开发部署指南.md]]
## Summary
- 核心主题Trae AI 代码编辑器通过 Remote SSH 连接 Ubuntu 服务器进行远程 Docker 项目开发的完整配置指南
- 问题域:本地机器算力/存储不足,需通过 Trae 远程连接 Ubuntu 服务器进行开发,同时管理多个 Docker 容器环境
- 方法/机制Remote SSH 插件 + Docker 插件 + 两种开发模式Attach 容器 / 宿主机编辑SSH Config 免密登录
- 结论/价值Trae 将 VS Code 远程开发能力与 Docker 容器管理结合,适合 Vibe Coding 场景下的远程服务器开发
## Key Claims
- Ubuntu 2192.168.3.45)为开发服务器(源码 + Bind MountUbuntu 1192.168.3.47)为生产服务器(仅镜像)
- SSH Config HostName 可填写 Tailscale IP如 100.x.x.x实现内网/外网无缝切换
- Trae Remote SSH 首次连接在服务器安装 VS Code Server 代理组件,耗时约几十秒
- 模式 AAttach 容器Docker 容器内运行 Trae Server环境完全隔离无需在宿主机安装语言环境
- 模式 B宿主机编辑 + Docker CLI直接编辑 Ubuntu 文件系统代码,在终端执行 docker compose 命令
- Git 凭证问题Trae/VS Code 自动转发本地 SSH Agent需在本地启动 ssh-agent 并添加私钥
- 文件权限UID/GID问题容器内生成的文件归属 root宿主机无法修改需在 Dockerfile 中指定 user 或使用 --user 参数
## Key Concepts
- [[Trae]]:基于 VS Code 的 AI 代码编辑器,原生支持 Remote SSH 和 Docker 插件
- [[Remote SSH]]:通过 SSH 连接远程服务器,在服务器上运行编辑器后端
- [[Docker Attach模式]]:直接"进入"已运行的 Docker 容器进行开发,环境完全隔离
- [[Bind Mount]]:宿主机目录挂载到容器内,代码修改实时生效(开发模式 A 的核心)
- [[SSH Agent转发]]:本地 SSH Agent 私钥通过 SSH 连接转发给远程服务器,供 Git 操作使用
## Key Entities
- [[Ubuntu2]]开发服务器IP 192.168.3.45,安装 Trae Server提供 /home/shenwei/docker/tiktok_pm 开发目录
- [[Ubuntu1]]生产服务器IP 192.168.3.47,运行 tiktok_pm 容器(镜像打包模式)
- [[Trae]]AI 代码编辑器,支持 VS Code 插件生态
## Connections
- [[Trae远程开发部署]] ← 开发环境 → [[Ubuntu2]]
- [[Trae远程开发部署]] ← 生产部署 → [[Ubuntu1]]
- [[Trae远程开发部署]] ← 开发模式 → [[Docker]](容器化开发环境)
- [[Trae远程开发部署]] ← 协作工具 → [[SSH Config]](多主机别名管理)
## Contradictions
## Related Wiki Pages
- [[Vibe Coding]]Trae 是 Vibe Coding 推荐工具之一
- [[Cursor]]Cursor 是另一个 AI 代码编辑器,与 Trae 功能高度重叠
- [[Ubuntu]]Ubuntu 2 和 Ubuntu 1 是双服务器架构的核心