Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(devbox): add fqa in devbox doc #5289

Merged
merged 5 commits into from
Dec 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 66 additions & 1 deletion docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,69 @@ upstream connect error or disconnect/reset before headers. retried and the lates

## 6、本地 localhost 能打开项目但是公网地址打不开

代码里暴露地址由于网络原因必须从 `localhost` 改为 `0.0.0.0`
代码里暴露地址由于网络原因必须从 `localhost` 改为 `0.0.0.0`

## 7、在Devbox中可以正常运行程序,但是在发版之后,程序无法正常运行

Copy link
Contributor

@nowinkeyy nowinkeyy Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

中英文之间加一个空格,中文句子的符号也使用中文格式(逗号、句号和括号等)。

在发版之前请确保能在终端中运行entrypoint.sh(这是推荐的发版后的启动脚本),如果需要公网服务,也请同时检查公网地址是否联通.

```bash
./entrypoint.sh
```

如果遇到下面的问题

```bash
bash: ./entrypoint.sh: Permission denied
```

可以在终端中输入如下的命令,并再次运行entrypoint脚本,并确保结果与期望的相同

```bash
sudo chmod +x entrypoint.sh
```

同时,建议先在devbox中预先构建完项目代码后并测试,测试成功后再发版,这可以有效避免在发版后的启动时的错误和oom问题

## 8、应用程序监听的端口为1-100时,应用程序启动失败

在使用devbox时,本地编辑器(vscode、cursor等)
默认的用户为devbox,使用1-100端口是root用户的特权.如果需要正常使用,请使用root权限运行你的程序吗,例如在go的devbox中,可以使用下面的命令.

```bash
sudo go run main.go
```

或者变更你的端口.

## 9、如何在devbox中更换默认的用户为root用户

如果你需要在打开本地编辑器时,链接到devbox的用户为root,可以参考以下的步骤.
首先请确保你的devbox在使用默认的配置时,可以正常连接.
打开本地电脑的`~/.ssh/sealos/devbox_config`,如果不清楚这个文件在哪里,请参考问题2.

找到你需要切换为root用户的配置,例如

```config
Host usw.sailos.io_ns-rqtny6y6_devbox1234
HostName usw.sailos.io
User devbox
Port 40911
IdentityFile ~/.ssh/sealos/usw.sailos.io_ns-rqtny6y6_devbox1234
IdentitiesOnly yes
StrictHostKeyChecking no
```

Copy link
Contributor

@nowinkeyy nowinkeyy Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉 root 跟 115 行的 root 格式保持一致比较好,都不加 `` 或者都加。

修改`User``root`,例如:

```config
Host usw.sailos.io_ns-rqtny6y6_devbox1234
HostName usw.sailos.io
User root
Port 40911
IdentityFile ~/.ssh/sealos/usw.sailos.io_ns-rqtny6y6_devbox1234
IdentitiesOnly yes
StrictHostKeyChecking no
```

保存之后退出打开了devbox的本地编辑器,重新打开编辑器,连接到devbox,此时的用户已经切换为root.
Loading