搜索

PythonReactSEOPDF
GitHub Skill

render

Deploys web applications on Render with automatic builds, managed databases, and zero-config SSL. Use when deploying web services, static sites, or setting up managed infrastructure.

mgd34msu☆ 3 仓库 Stars0 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Render

Cloud platform for deploying web services, static sites, and databases with automatic builds from Git.

Quick Start

  1. Connect GitHub/GitLab at render.com
  2. Create new Web Service
  3. Select repository
  4. Render auto-detects framework
  5. Deploy

Service Types

Web Service

Long-running HTTP servers:

# render.yaml
services:
  - type: web
    name: api
    runtime: node
    buildCommand: npm install && npm run build
    startCommand: npm start
    envVars:
      - key: NODE_ENV
        value: production
Static Site

Frontend applications:

services:
  - type: web
    name: frontend
    runtime: static
    buildCommand: npm install && npm run build
    staticPublishPath: ./dist
Background Worker

Non-HTTP processes:

services:
  - type: worker
    name: worker
    runtime: node
    buildCommand: npm install && npm run build
    startCommand: npm run worker
Cron Job

Scheduled tasks:

services:
  - type: cron
    name: daily-cleanup
    runtime: node
    buildCommand: npm install
    startCommand: npm run cleanup
    schedule: "0 0 * * *"

Configuration

render.yaml (Blueprint)
# render.yaml
services:
  - type: web
    name: my-app
    runtime: node
    region: oregon

    # Build
    buildCommand: npm ci && npm run build
    startCommand: npm start

    # Environment
    envVars:
      - key: NODE_ENV
        value: production
      - key: DATABASE_URL
        fromDatabase:
          name: mydb
          property: connectionString

    # Health check
    healthCheckPath: /health

    # Scaling
    plan: starter
    numInstances: 1

    # Auto-deploy
    autoDeploy: true

    # Branch
    branch: main

databases:
  - name: mydb
    plan: starter
    databaseName: myapp
    user: myuser

envVarGroups:
  - name: shared-settings
    envVars:
      - key: LOG_LEVEL
        value: info
Environment Variables
envVars:
  # Static value
  - key: API_KEY
    value: my-secret-key

  # Sync from group
  - key: LOG_LEVEL
    fromGroup: shared-settings

  # From database
  - key: DATABASE_URL
    fromDatabase:
      name: mydb
      property: connectionString

  # From service
  - key: API_URL
    fromService:
      name: api
      type: web
      property: host

Node.js Deployment

package.json
{
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  },
  "engines": {
    "node": "20"
  }
}
Express/Fastify
const port = process.env.PORT || 10000;

app.listen(port, '0.0.0.0', () => {
  console.log(`Server running on port ${port}`);
});

Next.js Deployment

Configuration
services:
  - type: web
    name: nextjs-app
    runtime: node
    buildCommand: npm ci && npm run build
    startCommand: npm start
    envVars:
      - key: NODE_ENV
        value: production

Render auto-detects Next.js and configures appropriately.

Static Site Deployment

React/Vite
services:
  - type: web
    name: react-app
    runtime: static
    buildCommand: npm ci && npm run build
    staticPublishPath: ./dist
    routes:
      - type: rewrite
        source: /*
        destination: /index.html
Headers & Redirects
services:
  - type: web
    name: static-site
    runtime: static
    staticPublishPath: ./dist
    headers:
      - path: /*
        name: X-Frame-Options
        value: DENY
    routes:
      - type: redirect
        source: /old-path
        destination: /new-path
        status: 301

Databases

PostgreSQL
databases:
  - name: mydb
    plan: starter  # starter, standard, pro
    databaseName: myapp
    user: myuser
    region: oregon
Redis
services:
  - type: redis
    name: cache
    plan: starter
    maxmemoryPolicy: allkeys-lru
Connection
envVars:
  - key: DATABASE_URL
    fromDatabase:
      name: mydb
      property: connectionString

  - key: REDIS_URL
    fromService:
      name: cache
      type: redis
      property: connectionString

Scaling

Instance Types
Plan RAM CPU
Free 512 MB Shared
Starter 512 MB 0.5
Standard 2 GB 1
Pro 4 GB 2
Pro Plus 8 GB 4
Horizontal Scaling
services:
  - type: web
    name: api
    plan: standard
    numInstances: 3
Auto-Scaling (Team plans)

Configure in dashboard:

  • Min/max instances
  • CPU/memory thresholds

Custom Domains

  1. Add domain in service settings
  2. Configure DNS:
# A record
@ -> render IP

# CNAME for subdomain
www -> your-app.onrender.com
  1. SSL certificate auto-provisioned

Health Checks

services:
  - type: web
    healthCheckPath: /health
app.get('/health', (req, res) => {
  res.status(200).json({ status: 'ok' });
});

Dockerfile Deployment

services:
  - type: web
    name: docker-app
    runtime: docker
    dockerfilePath: ./Dockerfile
    dockerContext: .
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./
RUN npm ci --only=production

COPY . .
RUN npm run build

EXPOSE 10000

CMD ["node", "dist/index.js"]

Preview Environments

Enable in service settings:

  1. Pull Request Previews: On
  2. Each PR gets unique URL
  3. Auto-deleted on merge

Monorepo Support

Root Directory
services:
  - type: web
    name: api
    rootDir: apps/api
    buildCommand: npm ci && npm run build
    startCommand: npm start
Multiple Services
services:
  - type: web
    name: web
    rootDir: apps/web
    buildCommand: npm ci && npm run build
    staticPublishPath: ./dist

  - type: web
    name: api
    rootDir: apps/api
    buildCommand: npm ci && npm run build
    startCommand: npm start

Persistent Disk

services:
  - type: web
    name: app
    disk:
      name: data
      mountPath: /data
      sizeGB: 10

Private Services

Internal services not exposed to internet:

services:
  - type: pserv  # Private service
    name: internal-api
    runtime: node
    buildCommand: npm ci && npm run build
    startCommand: npm start

Access via internal DNS: internal-api:10000

CLI (Render CLI)

# Install
npm install -g @render/cli

# Login
render login

# Deploy
render deploy

# Logs
render logs --service my-app

# SSH
render ssh my-app

See references/configuration.md for complete render.yaml options.

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-01-20
索引更新时间
2026-01-28
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!