- 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
, andSECRET_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
Last active
September 19, 2024 12:30
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workers = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
poetry==1.2.2 |
Oh, I hadn't seen https://render.com/docs/databases#connection-pooling before! This looks perfect, I'll try this out soon.
Hey Adam - thanks for providing this info!
Let me know if you have any luck with the dockerfile approach. I'm finding they don't have any good alternative to the build script which makes it problematic to run things like migrations in a clean way. More here: https://community.render.com/t/release-command-for-db-migrations/247/7
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
I avoided deploying to Render using Dockerfiles so far. They recently published documentation about how to setup pgbouncer on their platform. This is the Dockerfile that they advise to use: https://github.com/render-oss/docker-pgbouncer