- 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
-
-
Save adamghill/ba816554995d1fe5e5b2195ec76eaef8 to your computer and use it in GitHub Desktop.
workers = 3 |
#!/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 |
poetry==1.2.2 |
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
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.
I think that's actually left over from my Heroku set-up. Gonna clean that up now, thanks!
This is interesting, I'm specifying 3.9.x because I use
orjson
as a dependency which won't build with 3.7. I wonder if a better approach would be a Dockerfile? That way I could also experiment withnginx
in front ofgunicorn
and potentiallypgbouncer
as well (similar to the Heroku buildpacks I had set up in https://gist.github.com/adamghill/9c11687eb87e98951adb11c4dacdb709)?