Tháng trước mình lên YouTube tìm thử thì phát hiện một container miễn phí tên là uppcoder, có gói miễn phí 1 stack. Cấu hình cho khá là hào phóng.
Trang chủ ghi gói miễn phí Spark: €0/tháng, miễn phí vĩnh viễn, trạng thái Active
- 1 Stack: 1 stack ứng dụng chạy thường trực, gồm 1 database
- 2GB RAM, 2GB ổ đĩa (mỗi Stack)
- 500 CPU giây/ngày (mỗi Stack), tức là chạy CPU 100% trong 1 giây tính 1 lần; đa số sẽ không rơi vào trường hợp CPU 100%.
- Online thường trực không sleep: panel và trang giá đều ghi "1 always-on stack", không thấy cảnh báo sleep
- Trình soạn thảo, terminal, SSH trong trình duyệt: gói free cũng có
- Chứng chỉ TLS tự động: app deploy sẵn có HTTPS, nhưng gói free không được custom domain, phải dùng domain của họ
- Backup mỗi tối: gói free cũng có, file và database của mỗi app được backup hằng ngày sang một server khác, giữ 7 ngày gần nhất mỗi ngày một bản, 4 tuần gần nhất mỗi tuần một bản
Xin bổ sung theo điều khoản của Uppcoder chính thức:
Mục 7.1 trong điều khoản dịch vụ nói rõ là không được mở tunnel, proxy trên đó. VPN và tunnel không được phép trên Uppcoder, nếu không mấy loại app này sẽ bị tự động dừng, tài khoản sẽ bị đóng.
Tình hình mức dùng của gói free:
Gói free bản thân không tốn tiền, cũng không tự động trừ phí. Đăng ký, xác minh email, deploy rồi xoá Stack qua lại đều miễn phí, cũng không thấy yêu cầu bind thẻ gì đó, nên tạm thời có thể yên tâm. Có điều nền tảng này rất mới, tầm giữa tháng 10/2026 mới lên, có ổn định không thì còn phải kiểm chứng.
Mình đã mò mẫm qua lại rất lâu mới deploy được project Node và truy cập được frontend. Cái khó chịu là tài liệu của trang này cực ít, gần như tự mò hết. Dưới đây là toàn bộ quá trình, để mọi người tránh hết mấy cái hố (hố thì mình đã dẫm hết rồi).
-
Đăng ký. Bước này mình không nói nhiều. Khuyên dùng GitHub luôn cho nhanh, khỏi phải đăng ký bằng email rồi lại liên kết GitHub, làm một bước cho gọn.
-
Tạo một Stack, Stack đầu tiên miễn phí, về sau muốn tạo thêm thì sẽ tính phí.
Ở đây có thể chọn Next.js và Express hỗ trợ Node, tất nhiên cũng có thể chọn Jam.py kiểu hỗ trợ Python, chủ yếu tuỳ bạn. Project của mình chỉ là Express cơ bản, nên mình chọn mục Express + SQLite.
-
Cấu hình Stack, làm theo hình là được. Có một điểm cần nói rõ: ở trên mình chọn mục Express + SQLite, nên mặc định có một component Express cần cấu hình; SQLite là mục cấu hình tuỳ chọn. Nếu cần thì chọn database tương ứng bên phải; tất cả mục được highlight bên phải đều là database có thể chọn, đừng để chữ SQLite làm ảnh hưởng, nó thậm chí có thể chọn MySQL, PGSQL để ghép thành database, chọn cái nào chủ yếu xem project của bạn tích hợp database nào. Project của mình dùng SQLite tích hợp sẵn mặc định của Node, nên không chọn plugin database.
Địa chỉ project mình deploy, mọi người có thể tham khảo (hoan nghênh bấm Start và Fork):
https://github.com/hakd-code/gallery.git
-
Bấm Deploy ở góc trên bên phải để hoàn tất deploy, đợi một chút là xong. Xong sẽ nhận được email. Hình dưới là tình trạng sau khi deploy thành công.
Lúc này bạn bấm vào truy cập website sẽ thấy frontend trả về 502 của nginx, nói thẳng ra là không thông. Mình chính ở chỗ này mò mẫm hồi lâu, tra kha khá tài liệu, hỏi AI không ít câu mới làm thông được.
-
Từ hình trên, vào bản web của ssh. Ở đây có thể ssh trực tiếp để thao tác toàn bộ container Stack.
Mình phát hiện ở đây bấm npm start thì project cũng không truy cập được frontend. Mãi đến khi mình tình cờ lật tới thư mục log, xem hết output log mới tìm ra entry cơ bản. Khi Stack này khởi động, file nó tìm là index.js, và lắng nghe ở port 8000.
Tìm tiếp thì mình phát hiện /opt/start-scripts/start-express.sh, file chính khi container khởi động. Đọc kỹ source thì thấy logic của script khởi động này rất rõ ràng, và bản thân nền tảng có để sẵn custom startup hook!
Từ source của start-express.sh có thể thấy hai cơ chế cốt lõi:
- Custom entry có độ ưu tiên cao nhất: dòng 38-41 của script ghi rõ, chỉ cần
/home/uppcoder/app/startup-app.shtồn tại, nó sẽ bỏ qua luônnode --watch index.jsphía sau, chuyển sang chạystartup-app.shcủa bạn. - Biến môi trường port là
APP_PORT: tức là mặc định nền tảng mong app của bạn lắng nghe ở${APP_PORT:-8000}(tức port 8000), cònserver.jscủa mình đọcprocess.env.PORT, và ghi port là 3100.
Nội dung script start-express.sh, ai quan tâm có thể xem
#!/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
-
Hiểu cơ chế chạy của Stack từ bên trên rồi thì giải quyết vấn đề dễ thôi.
Hoặc mình viết một startup-app.sh, trong file này khởi động project trực tiếp; hoặc đổi server.js trong project thành index.js và mặc định khi khởi động project lắng nghe ở port 8000. Cả hai hướng đều được. -
Mình tự viết một 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
-
Truy cập lại địa chỉ project, thấy giờ đã bình thường.
Chia sẻ ảnh: https://px331bi9-express-pic.apps-5.websson.cloud/
-
Bổ sung phần ssh
Container này hỗ trợ ssh, ngoài webssh của site gốc đã giới thiệu ở trên, còn có thể dùng công cụ ssh của mình để kết nối.
Trước tiên vào phần settings tạo một key for ssh, tạo xong thường file sẽ tự động được tải về máy bạn, máy Windows thường tải vào thư mục Downloads, tự tìm nhé.
Tìm khối ssh tương ứng trong Stack, ở đây có chỉ rõ cách ssh. Bạn hoàn toàn có thể copy nguyên chuỗi thông tin này, mở PowerShell trên Windows rồi chạy trực tiếp, nhưng khả năng cao sẽ báo lỗi. Vì quyền của file bạn tải về quá lớn, hệ thống yêu cầu thu hẹp quyền chỉ cho user hiện tại đọc thôi.
Nên cách tốt nhất là upload file uppcoder_20261109-161014_ed25519 đã tải về (user khác thời điểm khác thì tên file không giống hẳn, nhớ đổi thành tên file của bạn nhé) lên hệ thống Linux của bạn, như vậy dễ kiểm soát quyền hơn. Ví dụ mình upload lên /root trong WSL Ubuntu 22.04 trên Windows, cấp quyền 600 trước, rồi dùng chuỗi ssh họ đưa, sửa tên file cho đúng là ssh ngon lành.
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 px331bi9@px331bi9-express-pic.apps-3.websson.cloud
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$
Tổng kết:
Vì không có docs, project toàn phải tự mò. Nhưng may là đã hiểu được cơ chế chạy của project.
File start-express.sh là entry thực thi, có thể làm rất nhiều thứ ở đây, kể cả dựng node gì đó, nhưng mình không khuyên mọi người làm vậy, dù sao cũng có khả năng bị ban account.
Entry của các project khác nhau có thể khác, ở đây chủ yếu lấy Express + SQLite để minh hoạ; muốn biết cơ chế load của project thì xem log tương ứng là rõ ngay.
Địa chỉ đăng ký Uppcoder (kèm nguồn AFF tùy chỉnh, để nhận diện nguồn giới thiệu):
#AFF https://portal.uppcoder.com/?utm_source=nodeloc&utm_medium=tutorial&utm_campaign=hakd
Địa chỉ project Node demo (hoan nghênh dùng, Start, Fork):
https://github.com/hakd-code/gallery.git
上个月在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 px331bi9@px331bi9-express-pic.apps-3.websson.cloud
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
Dịch bằng AI từ 简体中文Bản gốc (简体中文)

可以共享、可以push的免费邮箱,更可使用自定义域名,完美契合您的各项需求。
32 phản hồi
Sắp xếp