Logo Medusa Deploy

Medusa Deploy

Tổ chức
OrcaQubits
medusa-deploy

Deploy Medusa v2 to production — build process, server vs worker mode, environment variables, hosting options, Redis caching, database configuration, and production checklist. Use when deploying Medusa applications.

Tổng quan

Nhà phát hànhOrcaQubits
Kho mãagentic-commerce-skills-plugins
Tên kỹ năngmedusa-deploy
Sao
40
Bản fork
17
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được OrcaQubits công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Medusa Deploy trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/medusa-commerce/skills/medusa-deploy
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OrcaQubits/agentic-commerce-skills-plugins.git /tmp/agentic-commerce-skills-plugins
mkdir -p .claude/skills
cp -r /tmp/agentic-commerce-skills-plugins/medusa-commerce/skills/medusa-deploy .claude/skills/medusa-deploy
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Medusa Deploy trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Medusa Deploy ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Medusa Deploy không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Medusa v2 Deployment

Before writing code

Fetch live docs:

  1. Web-search site:docs.medusajs.com deployment production for production deployment guides
  2. Web-search site:docs.medusajs.com medusa build for build process details
  3. Fetch https://docs.medusajs.com/resources/medusa-cli for CLI command reference
  4. Web-search site:docs.medusajs.com environment variables configuration for env var reference
  5. Web-search site:docs.medusajs.com redis cache events for Redis caching and event bus setup

Build Process

Build Commands

CommandPurpose
npx medusa buildCompile server + admin dashboard for production
npx medusa db:migrateRun pending database migrations
npx medusa startStart the production server
npx medusa workerStart the background worker process

The build step compiles TypeScript, bundles admin extensions (Vite), and prepares the .medusa/ output directory.

Build Output Structure

.medusa/
├── server/           — Compiled server code
│   ├── src/          — Custom modules, routes, workflows
│   └── medusa-config.js
└── admin/            — Bundled admin dashboard (static)

Server vs Worker Mode

Medusa v2 supports running the server and background workers as separate processes:

ModeCommandHandles
Servernpx medusa startHTTP requests, API routes, admin dashboard
Workernpx medusa workerWorkflows, scheduled jobs, event subscribers
CombinedDefault start behaviorBoth server and worker (single process)

When to Separate

  • Development — combined mode is fine
  • Production — separate for reliability and independent scaling
  • High traffic — scale server instances independently from workers
  • Worker mode requires Redis for job queue communication between processes

Environment Variables

Required Variables

VariablePurposeExample
DATABASE_URLPostgreSQL connection stringpostgres://user:pass@host:5432/medusa
COOKIE_SECRETSession cookie signingRandom 32+ character string
JWT_SECRETJWT token signingRandom 32+ character string
NODE_ENVRuntime environmentproduction

Optional but Recommended

VariablePurposeDefault
REDIS_URLRedis connection for cache/events/workersNone (in-memory)
STORE_CORSStore API CORS originshttp://localhost:8000
ADMIN_CORSAdmin API CORS originshttp://localhost:9000
AUTH_CORSAuth route CORS originsCombination of store + admin
PORTServer listen port9000
MEDUSA_ADMIN_ONBOARDING_TYPEAdmin onboarding flowdefault
MEDUSA_WORKER_MODEserver, worker, or sharedshared

Database Configuration

PostgreSQL Requirements

  • PostgreSQL required (see official docs for version compatibility)
  • Enable SSL in production: append ?sslmode=require to DATABASE_URL
  • Connection pooling recommended for high-traffic deployments

Migration Workflow

bash
# Generate migration after DML model changes
npx medusa db:generate <module_name>
# Apply migrations
npx medusa db:migrate
  • Always run migrations before starting the new server version
  • Back up the database before running migrations in production
  • Test migrations against a staging database first

Redis Configuration

Redis serves three roles in production Medusa:

RolePurposeRequired?
Event BusPub/sub for event-driven subscribersRecommended
CacheModule data caching layerRecommended
Worker QueueJob queue for background workflowsRequired for worker mode

Configure in medusa-config.ts by registering the Redis modules:

ts
// Fetch live docs for Redis module registration
// in medusa-config.ts modules array
  • Use separate Redis databases (db index) for cache vs events vs queues
  • Set appropriate maxmemory and eviction policies for cache
  • Monitor Redis memory usage and connection count in production

Hosting Options

PlatformTypeNotes
RailwayPaaSOne-click deploy, managed PostgreSQL and Redis
DigitalOcean App PlatformPaaSManaged infrastructure, auto-scaling
AWS (EC2/ECS/Fargate)IaaS/CaaSFull control, use with RDS and ElastiCache
Google Cloud RunServerless containersAuto-scaling, pay-per-use
RenderPaaSSimple deploy, managed databases
Self-hosted (Docker)ContainerFull control, use Docker Compose or Kubernetes
VercelServerlessAdmin/storefront hosting only (not the Medusa server)

Docker Deployment

dockerfile
# Fetch live docs for official Medusa Dockerfile
# and docker-compose.yml patterns

A typical Docker Compose setup includes three services: Medusa server, PostgreSQL, and Redis.

Production Checklist

Pre-Deploy

  • Set NODE_ENV=production
  • Configure unique COOKIE_SECRET and JWT_SECRET
  • Set DATABASE_URL with SSL mode enabled
  • Configure REDIS_URL for events, cache, and worker queue
  • Set CORS variables (STORE_CORS, ADMIN_CORS, AUTH_CORS)
  • Run npx medusa build successfully
  • Run npx medusa db:migrate against production database

Infrastructure

  • PostgreSQL with automated backups and point-in-time recovery
  • Redis with persistence enabled (RDB or AOF)
  • HTTPS termination (TLS certificate) via reverse proxy or load balancer
  • Health check endpoint configured for load balancer
  • Log aggregation (stdout/stderr to centralized logging)

Post-Deploy

  • Verify admin dashboard loads and login works
  • Verify store API responds with publishable key
  • Confirm background workers are processing jobs
  • Test payment provider webhooks reach the server
  • Monitor error rates and response times

Scaling Strategies

Horizontal Scaling

  • Run multiple server instances behind a load balancer
  • Use Redis-backed sessions for sticky-session-free scaling
  • Run multiple worker instances for parallel job processing

Vertical Scaling

  • Increase PostgreSQL connection pool size for heavier workloads
  • Allocate more memory to Redis for larger cache datasets
  • Use --max-old-space-size for Node.js memory limits

Best Practices

  • Separate server and worker — run as independent processes in production; scale each based on demand; use Redis as the communication backbone
  • Environment variable hygiene — never commit secrets to source control; use platform-native secret management (AWS Secrets Manager, Railway variables, etc.); rotate secrets periodically
  • Database management — always test migrations on staging first; automate backups; use connection pooling (PgBouncer) for high concurrency
  • Monitoring — track API response times, worker queue depth, database connection count, and Redis memory; set alerts for anomalies

Fetch the Medusa deployment documentation for exact build flags, Docker configuration, and platform-specific deployment guides before deploying.

Câu hỏi thường gặp

Kỹ năng AI Medusa Deploy làm được gì?

Deploy Medusa v2 to production — build process, server vs worker mode, environment variables, hosting options, Redis caching, database configuration, and production checklist. Use when deploying Medusa applications.

Vì sao nên dùng Medusa Deploy trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Medusa Deploy là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Medusa Deploy trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/medusa-commerce/skills/medusa-deploy. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Medusa Deploy?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Medusa Deploy với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Medusa Deploy với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Medusa Deploy có miễn phí không?

Có. Kỹ năng này được OrcaQubits phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇