clawcloudrun-vps

clawcloudrun-vps
TownMarshal1 Claw cloud 容器改造 VPS, 实现 SSH 远程登录
Claw cloud 注册地址:
https://console.run.claw.cloud/signin?link=2L5PAUQS0LNO
项目地址:
https://github.com/vevc/ubuntu
1.1容器特点
容器一般只运行一个前台进程(PID=1)
容器重启后,未挂载存储的数据会丢失
容器内部端口需要映射到外部,才可以访问
1.2家目录初始化
1.2.1、权限设置
1 | ls -l /home |
1.2.2、终端字体颜色美化、ls -l 命令别名设置等
1 | curl -sk -o ~/.bashrc https://raw.githubusercontent.com/vevc/ubuntu/refs/heads/main/.bashrc |
注意事项
需要长期保存的数据,请一定存放在用户家目录,重要数据定期备份
通过 apt install 安装的应用重启后会丢失(需要在构建镜像时安装)
1.2.3、Claw cloud 搭建 3x-ui xhttp 节点
3x-ui 项目地址:
https://github.com/MHSanaei/3x-ui
3x-ui 默认端口:2053
3x-ui 默认用户名/密码:admin/admin
2 Claw cloud 容器改造 VPS, 使用 supervisor 管理容器进程,实现应用开机自启、自动保活、cron 规则持久化
项目地址:
https://github.com/vevc/ubuntu
Supervisor 官网及项目地址:
https://supervisord.org
https://github.com/Supervisor/supervisor
进程管理工具选择
❌ systemctl: 宿主机一般不会给特权模式
✅ supervisor: 作为1号进程启动,管理其他进程,让容器拥有多进程自启、保活功能
改造前
2.1.1启动测试进程
1 | sudo /usr/sbin/cron |
2.1.2添加一个定时任务
1 | cat > /home/$USER/cron.sh << EOF |
2.1.3、重启容器,cron 进程停止、http.server 服务进程停止、cron 定时任务规则丢失
改造
2.2.1、准备配置文件
1 | mkdir ~/boot # 家目录文件可持久化保存 |
1 | cat > /home/$USER/boot/supervisord.conf << EOF |
1 | cat > /home/$USER/boot/init.sh << EOF |
2.2.2、更新容器启动参数
Arguments: [“supervisord”, “-c”, “/home/town/boot/supervisord.conf”](注意路径中的用户名)
改造后
重启容器测试
kill 进程保活测试
常见问题
supervisord.conf 配置文件不小心写错怎么恢复
删除爪云里面的Arguments参数保存重启,再加上保存重启
3 Claw cloud 容器 vps 优雅重启,supervisorctl 管理工具的使用
项目地址:
https://github.com/vevc/ubuntu
Supervisor 官网及项目地址:
https://supervisord.org
https://github.com/Supervisor/supervisor
容器重启
Claw cloud 改造的 vps 怎么重启?
- Web 页面
- reboot
为什么容器 reboot 命令不生效?
容器共享宿主机的内核,它没有自己独立的内核可以重启。
解决方案
结合容器的重启策略:–restart=unless-stopped,关闭所有进程,模拟 reboot 命令。
1 | kill -SIGTERM 1 |
这个命令在 ghcr.io/vevc/ubuntu:25.7.14 版本已集成到镜像里。
tag 更新说明
在 Claw cloud 上,latest 标签并不总是实时指向最新的镜像,可能存在缓存。
GitHub 样例命令已调整为实际版本号,后续保持更新。
应用重启
supervisorctl 重启应用
/home/town/boot/supervisord.conf
添加修改以下内容
1 | [unix_http_server] |
1 | [program:init] |
完整配置参考:https://github.com/vevc/ubuntu/blob/main/supervisord.sample.conf
supervisorctl 常用命令
1 | sudo supervisorctl status |
supervisorctl 别名配置
1 | echo "alias sctl='sudo supervisorctl'" >> ~/.bashrc |
4 Claw cloud 容器 VPS 安装 xray | 提取复用 3x-ui 配置,手动部署 xray 代理 | All in one 容器 VPS
3x-ui 包含 Xray-core
3x-ui 和 Xray-core 的职责 类似jdk jre jvm
3x-ui: 配置管理
Xray-core: 代理、流量转发
安装 xray
4.1. 下载 Xray-core
1 | mkdir ~/xray |
4.2. 提取 3x-ui 配置
https://github.com/vevc/one-node/blob/main/claw-cloud/xray-config.json
使用 xray 检查配置文件是否正确
3. 使用 supervisor 管理 xray
[program:xray]
command=/home/town/xray/xray -c /home/town/xray/config.json
autostart=true
autorestart=true
user=town
sudo supervisorctl update xray
- 添加端口映射
5 Claw cloud 容器 VPS 安装 ttyd,在浏览器 web 页面登录和使用 ssh 终端
下载
1 | mkdir ~/ttyd |
启动命令
1 | ~/ttyd/ttyd -p 7681 -c town:Ts123** -W bash |
使用 nohup 后台启动
1 | nohup ~/ttyd/ttyd -p 7681 -c town:Ts123** -W bash 1>/dev/null 2>&1 & |
使用 Supervisor 管理并启动
1 | [program:ttyd] |
免密登录小技巧
Basic Auth 鉴权
GET /private/index.html HTTP/1.1
Host: vevc.dpdns.org
Authorization: Basic YWRtaW46cGFzc3dvcmQ=
echo -n ‘admin:password’ | base64
URL 地址中的格式
https://town:Ts123**@xqqxogmsncut.us-east-1.clawcloudrun.com/
6 Claw cloud 容器 VPS 安装 Node.js 开发环境,搭建 Uptime Kuma 免费开源监控神器
博文地址:https://vevc.dpdns.org/archives/10.html
容器 VPS 项目地址:
https://github.com/vevc/ubuntu
Uptime Kuma 官网及项目地址:
https://uptime.kuma.pet
https://github.com/louislam/uptime-kuma
Node.js 官网:
https://nodejs.org
nvm 项目地址:
https://github.com/nvm-sh/nvm
Why
网站监控(节点监控)
定时请求保活
Uptime Kuma, Node.js, nvm 的关系Uptime Kuma 项目使用 Node.js 语言开发,运行在 Node.js 环境中
nvm (Node Version Manager): Node.js 的版本管理工具
nvm 优点方便安装最新版 Node.js, apt install 安装的版本老旧
多版本 Node.js 任意切换
安装的所有文件存放在用户家目录
使用 Supervisor 管理并启动
[program:uptime-kuma]
environment=PATH=”/home/town/.nvm/versions/node/v20.x/bin:/usr/sbin:/usr/bin:/sbin:/bin”
directory=/home/town/uptime-kuma
command=node server/server.js
autostart=true
autorestart=true
user=town
Node.js Release info



