pb-deploy
Skill này làm gì
Skill này hướng dẫn bạn đưa một ứng dụng PocketBase lên máy chủ thực tế. Skill dành cho lập trình viên chuyển dự án PocketBase từ máy tính của mình lên môi trường production.
Khi nào nên dùng
- ✓Khi bạn muốn chạy PocketBase trên máy chủ Linux như một dịch vụ.
- ✓Khi bạn cần HTTPS, reverse proxy hoặc thiết lập Docker cho PocketBase.
- ✓Khi bạn muốn sao lưu, cài đặt email hoặc tăng cường bảo mật cho môi trường production.
Liên kết skill
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/pocketbase/pb-deploy/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Giúp tôi triển khai ứng dụng PocketBase lên máy chủ Linux với HTTPS và tự khởi động lại.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent thiết lập file nhị phân PocketBase duy nhất, thêm một dịch vụ systemd với các thiết lập bảo mật, cấu hình reverse proxy và TLS, rồi lên kế hoạch sao lưu.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
PocketBase Production Deployment
Single Binary Deployment
PocketBase is a single binary. No runtime dependencies.
# Download
wget https://github.com/pocketbase/pocketbase/releases/download/v0.X.X/pocketbase_0.X.X_linux_amd64.zip
unzip pocketbase_*.zip
chmod +x pocketbase
# Run
./pocketbase serve --http="0.0.0.0:8090"
Data stored in pb_data/ (SQLite DB, uploaded files, logs).
systemd Service
# /etc/systemd/system/pocketbase.service
[Unit]
Description=PocketBase
After=network.target
[Service]
Type=simple
User=pocketbase
Group=pocketbase
LimitNOFILE=4096
Restart=always
RestartSec=5s
WorkingDirectory=/opt/pocketbase
ExecStart=/opt/pocketbase/pocketbase serve --http="127.0.0.1:8090"
# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/pocketbase/pb_data /opt/pocketbase/pb_hooks /opt/pocketbase/pb_migrations
PrivateTmp=true
# Memory limit (adjust to your server)
# MemoryMax=512M
[Install]
WantedBy=multi-user.target
# Setup
sudo useradd --system --no-create-home pocketbase
sudo mkdir -p /opt/pocketbase
sudo cp pocketbase /opt/pocketbase/
sudo chown -R pocketbase:pocketbase /opt/pocketbase
# Enable & start
sudo systemctl daemon-reload
sudo systemctl enable pocketbase
sudo systemctl start pocketbase
sudo systemctl status pocketbase
# Logs
sudo journalctl -u pocketbase -f
File descriptor limit
For high-traffic deployments, increase the limit:
# In the [Service] section:
LimitNOFILE=65535
Also set system-wide in /etc/security/limits.conf:
pocketbase soft nofile 65535
pocketbase hard nofile 65535
Go memory limit
For constrained environments:
Environment=GOMEMLIMIT=400MiB
Docker
Dockerfile
FROM alpine:latest
ARG PB_VERSION=0.25.0
RUN apk add --no-cache \
unzip \
ca-certificates
# Download and install PocketBase
# NOTE: verify the checksum in production — see https://github.com/pocketbase/pocketbase/releases
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /pb/ && rm /tmp/pb.zip
# Copy hooks and migrations
COPY ./pb_hooks /pb/pb_hooks
COPY ./pb_migrations /pb/pb_migrations
EXPOSE 8090
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8090"]
docker-compose.yml
services:
pocketbase:
build: .
ports:
- "127.0.0.1:8090:8090" # bind to localhost only — expose via reverse proxy
volumes:
- pb_data:/pb/pb_data
- ./pb_hooks:/pb/pb_hooks
- ./pb_migrations:/pb/pb_migrations
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8090/api/health"]
interval: 30s
timeout: 5s
retries: 3
volumes:
pb_data:
Reverse Proxy
Caddy (recommended — auto TLS)
# /etc/caddy/Caddyfile
myapp.com {
reverse_proxy localhost:8090
}
That's it. Caddy handles TLS certificates automatically via Let's Encrypt.
nginx
# /etc/nginx/sites-available/pocketbase
server {
listen 80;
server_name myapp.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name myapp.com;
ssl_certificate /etc/letsencrypt/live/myapp.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myapp.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50M;
# Block public access to the admin dashboard
location /_/ {
return 403;
}
location / {
proxy_pass http://127.0.0.1:8090;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# SSE support for realtime
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 3600s;
}
}
Critical for realtime: proxy_buffering off and proxy_read_timeout must be set for SSE subscriptions to work.
# Let's Encrypt with nginx
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d myapp.com
SMTP Configuration
Configure in Dashboard > Settings > Mail settings, or via hooks:
``
Câu hỏi thường gặp
PocketBase có cần cài thêm phần mềm nào không?
Không. PocketBase là một file nhị phân duy nhất, không có phụ thuộc runtime, và dữ liệu nằm trong thư mục pb_data.
Skill có bao gồm sao lưu không?
Có. Skill bao gồm sao lưu, cùng lưu trữ S3 và cài đặt email SMTP.
Các file tải lên được lưu ở đâu?
Chúng được lưu trong thư mục pb_data, cùng với cơ sở dữ liệu và nhật ký.
Chi tiết
Mô tả gốc của tác giả
Production deployment for PocketBase. Use when deploying PocketBase to a server, setting up Docker, configuring systemd, reverse proxy (nginx/Caddy), TLS, SMTP, backups, S3 storage, rate limiting, or hardening for production. Provides ready-to-use configs.
Độ phổ biến
- Sao GitHub
- 33k
- Vị trí xếp hạng
- #8872
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
owasp-security
33kDạy agent hướng dẫn bảo mật OWASP cho ứng dụng web, API, di động, container và agent AI, để nhận ra các điểm yếu phổ biến và gợi ý cách sửa.
agent-management
33kCho phép agent của bạn tạo, liệt kê, cho ngủ đông, đánh thức, đổi tên và xóa các agent AI bằng dòng lệnh AI Maestro, quản lý vòng đời của từng agent.
agent-messaging
33kCho phép agent của bạn gửi, nhận và trả lời tin nhắn có chữ ký giữa các agent AI, dùng Agent Messaging Protocol, chủ yếu trên máy của bạn.
docs-search
33kCho phép agent của bạn tìm trong tài liệu code được tạo tự động, như chữ ký hàm, định nghĩa lớp và chú thích, để kiểm tra API thật trước khi sửa code.
Skill tương tự
openclaw-update
394kGiúp agent của bạn cập nhật OpenClaw Gateway đang có, chọn cách cập nhật phù hợp với cách cài đặt và giữ phiên làm việc của bạn hoạt động.
diagnose-gateway
394kGiúp agent của bạn tìm hiểu vì sao OpenClaw Gateway bị lỗi bằng cách kiểm tra cài đặt, kênh và cổng mà không thay đổi gì.
crabbox-apps
394kGiúp agent của bạn mở và chạy một app trên máy đám mây tạm thời, rồi hiển thị giao diện của nó trong thanh bên của chat.