Skip to content

Instantly share code, notes, and snippets.

@adamghill
Last active September 6, 2023 03:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamghill/ba816554995d1fe5e5b2195ec76eaef8 to your computer and use it in GitHub Desktop.
Save adamghill/ba816554995d1fe5e5b2195ec76eaef8 to your computer and use it in GitHub Desktop.
Settings, files, and a checklist to deploy a Django app to Render with gunicorn + redis and using `poetry` for dependencies.
  • GitHub for code
  • Render blueprint specified by render.yaml
    • Postgres
    • Redis
    • Linked to GitHub repo
    • Add environment variables for PYTHON_VERISON=3.9.7, ENVIRONMENT=live, and SECRET_KEY
  • Cloudflare for SSL and CNAME pointing to Render app domain
    • Force SSL with a Cloudflare rule
  • Namecheap for the domain
    • Point nameservers to Cloudflare
  • Sentry for error logging
  • Panelbear and Plausible for privacy-focused analytics
  • UptimeRobot to get alerts for when the site goes down
#!/usr/bin/env bash
set -o errexit
poetry install --no-dev
python manage.py collectstatic --noinput
python manage.py compress --force
python manage.py collectstatic --noinput
python manage.py migrate
services:
- type: web
name: something-web
env: python
repo: https://github.com/adamghill/something.com
region: ohio
scaling:
minInstances: 1
maxInstances: 2
targetMemoryPercent: 60 # optional if targetCPUPercent is set
targetCPUPercent: 60 # optional if targetMemory is set
buildCommand: ./render-build.sh
startCommand: gunicorn -c gunicorn.conf.py project.wsgi
plan: free
domains:
- something.com
- www.something.com
envVars:
- key: DATABASE_URL
fromDatabase:
name: something-postgres
property: connectionString
- key: REDIS_URL
fromService:
type: redis
name: something-redis
property: connectionString
- fromGroup: something
- type: redis
name: something-redis
ipAllowList: []
plan: free
region: ohio
databases:
- name: something-postgres
region: ohio
plan: standard
@adamghill
Copy link
Author

I am hopeful that render adds a release phase soon. Looks like it is "planned" according to https://render.canny.io/features/p/release-phase-script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment