From 473638d82d3fc8f96196846b90aa4db0ed376ae2 Mon Sep 17 00:00:00 2001 From: cbluebird Date: Mon, 16 Dec 2024 16:50:04 +0800 Subject: [PATCH 1/5] doc(devbox): add fqa in devbox doc Signed-off-by: cbluebird --- .../5.0/i18n/zh-Hans/user-guide/devbox/faq.md | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md index 16df14162b4..4659426a5d6 100644 --- a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md +++ b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md @@ -71,4 +71,69 @@ upstream connect error or disconnect/reset before headers. retried and the lates ## 6、本地 localhost 能打开项目但是公网地址打不开 -代码里暴露地址由于网络原因必须从 `localhost` 改为 `0.0.0.0`。 \ No newline at end of file +代码里暴露地址由于网络原因必须从 `localhost` 改为 `0.0.0.0`。 + +## 7、在Devbox中可以正常运行程序,但是在发版之后,程序无法正常运行 + +在发版之前请确保能在终端中运行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 +``` + +修改`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. \ No newline at end of file From e06600759e0096acab770f13c1774dd7d5ccc399 Mon Sep 17 00:00:00 2001 From: cbluebird Date: Tue, 17 Dec 2024 10:53:46 +0800 Subject: [PATCH 2/5] doc(devbox): fix the devbox faq lint Signed-off-by: cbluebird --- .../5.0/i18n/zh-Hans/user-guide/devbox/faq.md | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md index 4659426a5d6..caabed1b6c1 100644 --- a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md +++ b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md @@ -73,46 +73,47 @@ upstream connect error or disconnect/reset before headers. retried and the lates 代码里暴露地址由于网络原因必须从 `localhost` 改为 `0.0.0.0`。 -## 7、在Devbox中可以正常运行程序,但是在发版之后,程序无法正常运行 +## 7、在 Devbox 中可以正常运行程序,但是在发版之后,程序无法正常运行 -在发版之前请确保能在终端中运行entrypoint.sh(这是推荐的发版后的启动脚本),如果需要公网服务,也请同时检查公网地址是否联通. +在发版之前请确保能在终端中运行 `entrypoint.sh` (这是推荐的发版后的启动脚本),如果需要公网服务,也请同时检查公网地址是否联通。 ```bash ./entrypoint.sh ``` -如果遇到下面的问题 +如果遇到下面的问题: ```bash bash: ./entrypoint.sh: Permission denied ``` -可以在终端中输入如下的命令,并再次运行entrypoint脚本,并确保结果与期望的相同 +可以在终端中输入如下的命令,并再次运行 `entrypoint` 脚本,并确保结果与期望的相同。 ```bash sudo chmod +x entrypoint.sh ``` -同时,建议先在devbox中预先构建完项目代码后并测试,测试成功后再发版,这可以有效避免在发版后的启动时的错误和oom问题 +同时,建议先在 Devbox 中预先构建完项目代码后并测试,测试成功后再发版,这可以有效避免在发版后的启动时的错误和 oom 问题。 -## 8、应用程序监听的端口为1-100时,应用程序启动失败 +## 8、应用程序监听的端口为 80 时,应用程序启动失败 -在使用devbox时,本地编辑器(vscode、cursor等) -默认的用户为devbox,使用1-100端口是root用户的特权.如果需要正常使用,请使用root权限运行你的程序吗,例如在go的devbox中,可以使用下面的命令. +在使用 Devbox 时,本地编辑器(vscode、cursor 等) +默认的用户为 Devbox,使用 1-100 端口是 root 用户的特权。 如果需要正常使用,请使用 root 权限运行你的程序吗,例如在 go 的 +Devbox 中,可以使用下面的命令: ```bash sudo go run main.go ``` -或者变更你的端口. +或者变更你的端口。 -## 9、如何在devbox中更换默认的用户为root用户 +## 9、如何在 Devbox 中更换默认的用户为root用户 -如果你需要在打开本地编辑器时,链接到devbox的用户为root,可以参考以下的步骤. -首先请确保你的devbox在使用默认的配置时,可以正常连接. -打开本地电脑的`~/.ssh/sealos/devbox_config`,如果不清楚这个文件在哪里,请参考问题2. +如果你需要在打开本地编辑器时,链接到 Devbox 的用户为 root,可以参考以下的步骤。 +首先请确保你的 Devbox 在使用默认的配置时,可以正常连接。 +打开本地电脑的 `~/.ssh/sealos/devbox_config`,如果不清楚这个文件在哪里,请参考问题2。 -找到你需要切换为root用户的配置,例如 +找到你需要切换为 root 用户的配置,例如: ```config Host usw.sailos.io_ns-rqtny6y6_devbox1234 @@ -124,7 +125,7 @@ Host usw.sailos.io_ns-rqtny6y6_devbox1234 StrictHostKeyChecking no ``` -修改`User`为`root`,例如: +修改 `User` 的值为 root,例如: ```config Host usw.sailos.io_ns-rqtny6y6_devbox1234 @@ -136,4 +137,4 @@ Host usw.sailos.io_ns-rqtny6y6_devbox1234 StrictHostKeyChecking no ``` -保存之后退出打开了devbox的本地编辑器,重新打开编辑器,连接到devbox,此时的用户已经切换为root. \ No newline at end of file +保存之后退出打开了 Devbox 的本地编辑器,重新打开编辑器,连接到 Devbox,此时的用户已经切换为 root。 \ No newline at end of file From 9955db1c4964bbbdff9ab629f2fe2a78e6c36a77 Mon Sep 17 00:00:00 2001 From: cbluebird Date: Tue, 17 Dec 2024 12:04:00 +0800 Subject: [PATCH 3/5] doc(devbox): add en devbox faq Signed-off-by: cbluebird --- docs/5.0/docs/user-guide/devbox/faq.md | 73 +++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/docs/5.0/docs/user-guide/devbox/faq.md b/docs/5.0/docs/user-guide/devbox/faq.md index 00c4f4921a2..235229a8e16 100644 --- a/docs/5.0/docs/user-guide/devbox/faq.md +++ b/docs/5.0/docs/user-guide/devbox/faq.md @@ -71,4 +71,75 @@ Try to open Cursor's extension market. If the extension market cannot be loaded ## 6. The local localhost can open the project but the public network address cannot be opened -The exposed address in the code must be changed from `localhost` to `0.0.0.0` due to network reasons. \ No newline at end of file +The exposed address in the code must be changed from `localhost` to `0.0.0.0` due to network reasons. + +## 7. The Program Runs Normally in Devbox, but Fails to Run After Deployment + +Before deploying, please ensure you can execute `entrypoint.sh` in the terminal (this is the recommended startup script +post-deployment). If public services are required, also check that the public address is accessible. + +```bash +./entrypoint.sh +``` + +If you encounter the following issue: + +```bash +bash: ./entrypoint.sh: Permission denied +``` + +You can run the following command in the terminal to modify the script's permissions, and then attempt to execute the +`entrypoint` script again, ensuring the outcome aligns with your expectations. + +```bash +sudo chmod +x entrypoint.sh +``` + +Additionally, it is advisable to build and test the project code in Devbox before deployment. Once testing is +successful, you can proceed with the deployment. This can effectively prevent errors and out-of-memory (OOM) issues +during the startup phase after deployment. + +## 8. Application Startup Fails When Listening on Port 80 + +When using Devbox, the default user for local editors (such as VSCode, Cursor, etc.) is `devbox`. Ports in the range of +1-100 are restricted to the root user. If you need to use these ports, please run your application with root privileges. +For example, in the Go Devbox, you can execute the following command: + +```bash +sudo go run main.go +``` + +Alternatively, you could change your application's port. + +## 9. How to Change the Default User to Root in Devbox + +If you want to connect to Devbox as the root user when opening a local editor, please follow these steps. First, ensure +your Devbox can connect properly using the default configuration. Open the file `~/.ssh/sealos/devbox_config` on your +local machine. If you are uncertain about the file's location, please refer to Question 2. + +Locate the configuration that you wish to modify to use the root user, for example: + +```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 +``` + +Change the `User` value to root, as follows: + +```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 +``` + +After saving the changes, exit the local editor connected to Devbox and then reopen the editor. You should now be +connected to Devbox as the root user. \ No newline at end of file From 7ce26ec5fd9ad7ed297e89894473178d13ebc859 Mon Sep 17 00:00:00 2001 From: cbluebird Date: Thu, 19 Dec 2024 11:03:04 +0800 Subject: [PATCH 4/5] doc(devbox): fix the port range in devbox faq Signed-off-by: cbluebird --- docs/5.0/docs/user-guide/devbox/faq.md | 7 ++++--- docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/5.0/docs/user-guide/devbox/faq.md b/docs/5.0/docs/user-guide/devbox/faq.md index 235229a8e16..41fb84a6df1 100644 --- a/docs/5.0/docs/user-guide/devbox/faq.md +++ b/docs/5.0/docs/user-guide/devbox/faq.md @@ -101,9 +101,10 @@ during the startup phase after deployment. ## 8. Application Startup Fails When Listening on Port 80 -When using Devbox, the default user for local editors (such as VSCode, Cursor, etc.) is `devbox`. Ports in the range of -1-100 are restricted to the root user. If you need to use these ports, please run your application with root privileges. -For example, in the Go Devbox, you can execute the following command: +When using Devbox, the default user for local editors (such as VSCode, Cursor, etc.) is devbox. +Ports in the range of 1-1023 are restricted to the administrator user. +If you need to use these ports normally, please run your program with administrator privileges. For example, in the Go +Devbox, you can use the following command: ```bash sudo go run main.go diff --git a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md index caabed1b6c1..c71de3d2d29 100644 --- a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md +++ b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md @@ -98,7 +98,7 @@ sudo chmod +x entrypoint.sh ## 8、应用程序监听的端口为 80 时,应用程序启动失败 在使用 Devbox 时,本地编辑器(vscode、cursor 等) -默认的用户为 Devbox,使用 1-100 端口是 root 用户的特权。 如果需要正常使用,请使用 root 权限运行你的程序吗,例如在 go 的 +默认的用户为 Devbox,监听 1-1023 端口是管理员用户的特权。 如果需要正常使用,请使用管理员账户运行你的程序,例如在 go 的 Devbox 中,可以使用下面的命令: ```bash From c101c60bd5c4ab0bacd2ac092f3f8df38a90b70c Mon Sep 17 00:00:00 2001 From: cbluebird Date: Thu, 19 Dec 2024 18:13:28 +0800 Subject: [PATCH 5/5] doc(devbox): fix the devbox faq lint Signed-off-by: cbluebird --- docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md index c71de3d2d29..794a022a44f 100644 --- a/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md +++ b/docs/5.0/i18n/zh-Hans/user-guide/devbox/faq.md @@ -107,7 +107,7 @@ sudo go run main.go 或者变更你的端口。 -## 9、如何在 Devbox 中更换默认的用户为root用户 +## 9、如何在 Devbox 中更换默认的用户为 root 用户 如果你需要在打开本地编辑器时,链接到 Devbox 的用户为 root,可以参考以下的步骤。 首先请确保你的 Devbox 在使用默认的配置时,可以正常连接。