Đăng ký Đăng nhập
n/os · 17 ngày trước · Đã sửa · 1,2 N lượt xem
u/hakdVương giả
n/osu/hakd · 17 ngày trước

2G内存的免费新容器uppcoder,部署Node应用实战,支持ssh,现在还能注册(含定制来源AFF)

上个月在youtube上搜索,发现了一个免费容器uppcoder,有一个stack的免费容器。而且给的配置很是大方。

官网声明免费档 Spark 价格:€0/月,永久免费,状态 Active

  • 1 个 Stack:1 个常驻应用栈,含 1 个数据库
  • 2GB 内存、2GB 磁盘(每个 Stack)
  • 每天 500 CPU 秒(每个 Stack),即CPU 100%运行1秒算一次,大多数都不会出现100%CPU的情况。
  • 常驻在线不休眠:面板和定价页都写的是 "1 always-on stack",没出现休眠提示
  • 浏览器内编辑器、终端、SSH:免费档也含
  • 自动 TLS 证书:部署的应用自带 HTTPS,但免费档不能自定义域名,得使用他给的域名
  • 每晚备份:免费档也含,每个应用的文件和数据库每天备份到另一台服务器,保留最近 7 天每天一份、最近 4 周每周一份

应Uppcoder官方补充说明条款:
服务条款7.1中明确有说明不能在上面开隧道、代理。VPN 和隧道在 Uppcoder 上是不允许的,否则这类应用会被自动停掉、账户会被关闭。

免费档的用度情况:

免费档本身不花钱,也不会自动扣费。注册、邮箱验证、来回部署和删除Stack全免费,也没有出现要绑卡啥的操作,所以暂时可以放心。不过这个平台很新,2026年10月中才上线的,能否稳定,还待验证。

我是来回折腾了很久,才成功将Node项目给部署上,并实现前端访问的。坑的是这个网站的说明文档真的很少,全靠自己摸索。下面说一下全过程,全程避免大家踩坑(坑我都帮大家踩完了)。

1、注册。这一步我就不多说了。建议使用GitHub直接来就好,免得使用邮箱注册后,还要再关联GitHub,还不如一步到位。

2、创建一个Stack,第1个Stack是免费的,后续再想多创建的话就是收费的了。
在这里可以选择支持Node的 Next.js 和 Express,当然你也可以选择 Jam.py 这种支持python的,主要看你自己了。我的项目只是基本的 Express的,所以我就选择了 Express + SQLite 这项。

3、配置Stack,按图片来即可。有一点需要说明,我上面选择的是Express + SQLite 这项,所以默认就有一个Express 组件要配置,SQLite是可选择的配置项,如果有需要可以从右侧选择对应的数据库项,右侧所有高亮的都是可选择的数据库,不要被SQLite这个词影响了,它甚至可以选择MySQL,PGSQL这种组成数据库,要选择哪个主要看你项目集成的是哪个数据库。我这个项目使用的是Node默认集成的SQLite,所以就不选择数据库的插件了。
我部署的项目地址,大家可以参考一下(欢迎点Start和Fork):
https://github.com/hakd-code/gallery.git

4、点击右上的 Deploy 完成部署,等待一下就可以完成了。完成后会收到邮件。下图是部署成功后的情况。

这个时候,你点击访问网站,发现前端返回的是nginx的502,说白了就是不通。我就是在这里自己摸索了好久,查了不少文档,问了AI不少问题才搞通的。

5、从上图中,进入ssh网页版本。在这里可以直接ssh操作整个Stack容器。

我发现在这里按 npm start 项目也是无法访问到前端的。直到我意外翻到了日志目录,看了所有日志输出才找到了基本的入口。这个Stack启动时,找的文件是 index.js 文件,并且监听了 8000 端口。

再继续找,发现了 /opt/start-scripts/start-express.sh 这个容器启动时的主要文件。仔细读了源码,发现这个启动脚本的逻辑非常清晰,而且平台本身专门预留了自定义启动钩子!

从 start-express.sh 的源码可以看出两个核心机制:

  • 自定义入口优先级最高:脚本第 38-41 行写明,只要 /home/uppcoder/app/startup-app.sh 存在,它就会直接跳过后面的 node --watch index.js,转而执行你的 startup-app.sh。
  • 端口环境变量是 APP_PORT:即平台默认期望你的应用监听在 ${APP_PORT:-8000}(即 8000 端口),而我的 server.js 读取的是 process.env.PORT,写的端口是3100。
start-express.sh 脚本内容,有兴趣可以看一下
#!/bin/bash
# =============================================================================
# Start Express.
#
# Express is a BACKEND: it has no /api proxy to generate, it is the thing other
# tiers proxy AT. What it needs from service discovery is the other direction --
# the database it was composed with.
#
# Nothing can pre-install a database client, because a combination expressed as
# a template row does not know its database until it is provisioned and the
# platform offers 21 of them. So the connection string's SCHEME decides, and
# the client is installed on first start and written into package.json.
# =============================================================================
set -eo pipefail

APP_DIR="${APP_DIR:-/home/uppcoder/app}"

_START_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=lib-service-discovery.sh
. "$_START_DIR/lib-service-discovery.sh"

main() {
    cd "$APP_DIR"

    if ! command -v npm >/dev/null 2>&1; then
        echo "ERROR: npm not found. No Node.js environment available." >&2
        ls -1 /opt/pixi/.pixi/envs/ 2>/dev/null >&2 || true
        exit 1
    fi

    if [ ! -d node_modules ]; then
        echo "Running npm install..."
        npm install
    fi

    ensure_node_db_client

    if [ -f "$APP_DIR/startup-app.sh" ]; then
        echo "Running user startup command..."
        exec bash "$APP_DIR/startup-app.sh"
    fi

    # 🚨 --watch, because an agent's edit has to take effect without anybody
    # knowing to restart anything.
    #
    # This was `exec node index.js`, which made Express the ONLY framework here
    # that does not reload: every sibling runs a dev server that does (npm run
    # dev for vite/next/nuxt/astro/svelte/preact/react/vue, npm run start:dev
    # for nest, uvicorn --reload for fastapi).
    #
    # Measured 2026-09-11 on a builder project: the agent wrote correct routes
    # at 11:58:28 against a process started 11:57:46, so the app kept serving
    # the pre-edit file. A 404 on a route that is plainly in the source reads as
    # a broken build -- and the agent then spent turns "fixing" Express 5
    # routing and, on an earlier run, unset DATABASE_URL and started its own
    # database, because the evidence in front of it said its code was not
    # running. It was not; nothing had restarted it.
    #
    # Stable since Node 22 (the fullstack-node env ships 22.13). Fall back if
    # the runtime is older, so a changed pixi env cannot leave a dead app.
    # 🚨 NOT `node --watch --eval ""` -- node refuses that combination outright
    # ("either --watch or --eval can be used, not both", exit 9), so the probe
    # failed on a runtime that supports --watch perfectly well and every app
    # silently took the fallback. Ask whether the flag EXISTS instead.
    if node --help 2>/dev/null | grep -q -- "--watch"; then
        echo "Starting Express on port ${APP_PORT:-8000} (watching for changes)..."
        exec node --watch index.js
    fi
    echo "Starting Express on port ${APP_PORT:-8000} (no --watch on $(node -v))..."
    exec node index.js
}

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
    main "$@"
fi

6、从上面了解了Stack的运行机制后,就很好解决问题了。
我们要么写一个 startup-app.sh ,在这个文件中直接启动项目,要么就将项目中的 server.js 改成 index.js 并默认启动项目时监听在8000端口就行。两种方向均可。

7、我自己写了一个 startup-app.sh 。

# 写入startup-app.sh文件
cat << 'EOF' > /home/uppcoder/app/startup-app.sh
#!/bin/bash
export PORT="${APP_PORT:-8000}"
exec npm install
exec npm run seed
exec npm start
EOF
# 给文件添加执行权限
chmod +x /home/uppcoder/app/startup-app.sh
# 重启框架模块
supervisorctl restart framework

8、重新访问项目地址,发现现在可以正常了
图片分享:https://px331bi9-express-pic.apps-5.websson.cloud/

9、补ssh这一块
这个容器是支持ssh的,除了上面介绍过的源站的webssh外,还可以用自己的ssh工具连接的。
先在设置这一块创建一个key for ssh,创建好后一般会自动将这个文件下载到你的电脑中的,Window电脑一般是下载到你的下载目录的,自己找一下。

找到 Stack中对应的ssh块,这里有明确告诉你如何ssh。你完全可以复制你的这一串信息,在你Windows中打开powshell后直接执行,但大概率会报错。因为你下载的这个文件的权限太大了,系统要求缩小权限为当前用户只读才行。

所以最好的方式是将这个下载好的 uppcoder_20261109-161014_ed25519 文件(不同用户不同时间生成的文件名不全相同,这里改成你的文件名哦)上传到你的linux系统中,这样方便做权限控制,例如我上传到的Windows中的WSL子系统 Ubuntu22.04下的/root 中,先给600权限,再用ssh中给你的串,将文件名改正确就可以完好的ssh了。

root@IWKPC:~# ls
uppcoder_20261109-161014_ed25519
root@IWKPC:~# chmod 600 uppcoder_20261109-161014_ed25519
root@IWKPC:~# ssh -i uppcoder_20261109-161014_ed25519 -o StrictHostKeyChecking=accept-new -p 2222 [email protected]
Warning: Permanently added '[px331bi9-express-pic.apps-3.websson.cloud]:2222' (ED25519) to the list of known hosts.

Environment: web-express

Two pixi environments available:
  default      - System tools      | add <pkg>, remove <pkg>
  web-express  - Framework packages | pixi add <pkg>

Quick commands:
  add vim            # Install vim
  pixi add numpy     # Add numpy to your app
  supervisorctl      # Manage services

uppcoder@uppcoder:~/app$ ls
README.md  docs      node_modules       package.json  pixi.toml  server.js  startup-app.sh
data       index.js  package-lock.json  pixi.lock     public     src        tests
uppcoder@uppcoder:~/app$

总结:
由于没有文档,项目全靠自行摸索。但好在已完成了解项目的运行机制。
start-express.sh 文件是执行入口,可以在这里做很多想做的事情,包括建节点啥的,但我不建议大家这么做,毕竟有可能会删号。
不同项目的入口可能会不同,这里主要是以Express + SQLite 为说明,想知道项目的加载机制,可以看一下对应的日志就很清楚了。

Uppcoder 注册地址(含定制来源AFF,配合识别推广来源):
#AFF https://portal.uppcoder.com/?utm_source=nodeloc&utm_medium=tutorial&utm_campaign=hakd

演示Node项目地址(欢迎使用,Start, Fork):
https://github.com/hakd-code/gallery.git

126
28
Đăng nhập để tham gia thảo luận.

28 phản hồi

Sắp xếp
  1. tufei Kim cương 17 ngày trước

    很详细的教程,感谢大佬的分享。

    2
  2. deephub Vàng 17 ngày trước

    我是直接开隧道了,使用正常,核时也不高

    2
  3. hakd Vương giả Chủ thớt 2 NĂM 16 ngày trước

    Đục lỗ thì sợ bị ban nick mất.

    Dịch bằng AI từ 简体中文

    1
  4. only Bạc 3 NĂM 16 ngày trước

    Node này ở đâu vậy?

    Dịch bằng AI từ 简体中文

    0
  5. Rison Kim cương 3 NĂM 17 ngày trước

    详细的教程,支持大佬使劲折腾

    1
  6. hakd Vương giả Chủ thớt 2 NĂM 13 ngày trước

    Đã nói chuyện với ông chủ của Uppcoder, đặt làm link giới thiệu đến từ NL, đồng thời gắn luôn Id của mình trên forum vào.
    Hiện tại chỉ đang chạy AFF quảng bá giúp, chưa có thu nhập gì. Nhưng sản phẩm của bên đó đúng là có thể vọc vạch mấy thứ để test, nhất là cái khoản tích hợp ssh + plugin, ý tưởng thật sự khá hay.

    Dịch bằng AI từ 简体中文

    1
  7. songnilikai8 Vàng 17 ngày trước

    看看能做什么

    0
  8. Cravingrain Bạc 17 ngày trước

    整一个试试看

    0
  9. tianlanga 17 ngày trước

    教程很详细啊

    0
  10. wghdi Vàng 16 ngày trước

    Cảm ơn bác đã chia sẻ nhé!

    Dịch bằng AI từ 简体中文

    0
  11. SnappyBrook18 Bạc 16 ngày trước

    Cảm ơn đã chia sẻ :04-zan:. Nhiều deal hời quá, gom không xuể luôn

    Dịch bằng AI từ 简体中文

    0
  12. yongheng Vàng 2 NĂM 16 ngày trước

    Cảm ơn, để mình xem thử

    Dịch bằng AI từ 简体中文

    0
  13. zzhzhou Bạc 3 NĂM 16 ngày trước

    Giải thích chi tiết khá ổn đấy

    Dịch bằng AI từ 简体中文

    0
  14. iop Vàng 16 ngày trước

    Chi tiết lắm, xem thử đi

    Dịch bằng AI từ 简体中文

    0
  15. shoock_jio Bạc 16 ngày trước

    Dùng được, cảm ơn nhé

    Dịch bằng AI từ 简体中文

    0
  16. marisn Vàng 2 NĂM 16 ngày trước

    Bị ban ngay lập tức

    Dịch bằng AI từ 简体中文

    0
  17. huhuhuhuhuhu_huhuhu Vàng 16 ngày trước

    Gặp đúng ông giống mình rồi, xài được nửa tiếng thì bị ban, chạy cái proxy python thì không vào được, rồi thêm vài phút sau là bị ban luôn

    Dịch bằng AI từ 简体中文

    0
  18. hakd Vương giả Chủ thớt 2 NĂM 15 ngày trước

    Nếu dùng để đục lỗ (NAT traversal) thì chắc cũng sẽ bị chặn. Nên nếu dùng bình thường thì vẫn khá ổn.

    Dịch bằng AI từ 简体中文

    0
  19. kproton Vàng 16 ngày trước

    Cảm ơn bác đã chia sẻ

    Dịch bằng AI từ 简体中文

    0
  20. aion Bạch kim 2 năm 16 ngày trước

    Quá đỉ, chỉ tiếc là chắc không trụ được lâu.

    Dịch bằng AI từ 简体中文

    0
  21. 965_worker Vàng 16 ngày trước

    Cảm ơn đã chia sẻ!

    Dịch bằng AI từ 简体中文

    0
  22. zcecho1234 Bạc Không rời không bỏ 15 ngày trước

    Cảm ơn bạn đã chia sẻ

    Dịch bằng AI từ 简体中文

    0
  23. jackb Vàng 15 ngày trước

    Cảm ơn bro, để xem đã nhé

    Dịch bằng AI từ 简体中文

    0
  24. jiumei Bạc 15 ngày trước

    Dùng từ lâu rồi

    Dịch bằng AI từ 简体中文

    0
  25. poin Bạc 13 ngày trước

    Nghiên cứu

    Dịch bằng AI từ 简体中文

    0
  26. jkn Đồng 13 ngày trước

    Spark miễn phí vĩnh viễn 2G RAM đúng là ngon thật, còn vụ官方 bảo không được bật tunnel proxy thì mình ghi nhớ rồi, deploy app Node là dùng tới liền.

    Dịch bằng AI từ 简体中文

    0
  27. simplesue Bạc 8 ngày trước

    Hôm nay mình vừa bị ban ngay lập tức, tự dưng nảy ra ý tưởng thả một con chim ác là magpie, rồi bị xoá ngay, ban ngay... 😂

    Dịch bằng AI từ 简体中文

    0
  28. TsriGero Bạc 6 ngày trước

    Thế mà lại không dùng được project Docker.

    Dịch bằng AI từ 简体中文

    0