Deploy to Render

Domains, Blueprints and Previews

30 min

Custom domains

In the service's Settings → Custom Domains, add www.yourdomain.com and the apex. Render shows the DNS records to create (a CNAME for www, and an A/ALIAS record for the apex). Once DNS resolves, certificates are issued and renewed automatically. Redirect to one canonical host.

Blueprints: render.yaml

Describe your whole stack in the repository:

services:
  - type: web
    name: pandadev
    runtime: python
    buildCommand: ./render-build.sh
    startCommand: gunicorn wsgi:app -c gunicorn.conf.py
    healthCheckPath: /api/health
    envVars:
      - key: DATABASE_URL
        fromDatabase:
          name: pandadev-db
          property: connectionString
      - key: SECRET_KEY
        generateValue: true
      - key: WEB_CONCURRENCY
        value: "1"
      - key: STRIPE_SECRET_KEY
        sync: false            # set in the dashboard, never committed

databases:
  - name: pandadev-db
    plan: basic-256mb

Benefits: the setup is reviewed in pull requests, reproducible in a new account or region, and documents itself. Check Render's Blueprint reference for the current plan names and fields.

Preview environments

Render can create a temporary copy of your services for each pull request, with its own URL, so you and your clients can test changes before merging. Use separate secrets and a small preview database, never production data.

Deploy controls

  • Auto-deploy on push can be turned off for manual control.
  • Deploy hooks: a secret URL that triggers a deploy, handy from CI after tests pass.
  • Rollback: redeploy any previous successful deploy from the Events list.

Exercise

Write a render.yaml for your web service, database, worker and cron job; create the stack from the Blueprint; and trigger deploys from GitHub Actions with a deploy hook only after tests pass.

Check yourself

  • Why describe infrastructure in render.yaml?
  • What does sync: false mean for an environment variable?
  • How do you roll back a bad deploy?

Votre progression est enregistrée dans ce navigateur uniquement.

Envoyer pour relecture (10 points)