-
Notifications
You must be signed in to change notification settings - Fork 298
Debugging Render's Docker
Keith Schacht edited this page Jun 14, 2024
·
7 revisions
If you want to locally run Docker just as it is in production, here are the steps to do so. For example, this is helpful if there is an asset compilation issue on Render which is not occurring locally and you want to fully replicate the production environment.
- Temporarily edit your
Dockerfile
, in the sectionSTART OF RENDER
and change PORT to 3000 - Temporarily edit
production.rb
to comment outconfig.force_ssl = true
- Build the image:
docker build --target render-production -t hostedgpt-deployment:latest .
- Temporarily edit your
docker-compose.yml
file to:
- Remove ALL references to
volumes:
- Remove the whole
build:
block and replace withimage: hostedgpt-deployment:latest
- Add these lines to the
environment:
section:
RAILS_ENV=production
RAILS_FORCE_SSL=false
RUN_SOLID_QUEUE_IN_PUMA=true
SECRET_KEY_BASE=[copy from Render or from local proj]
RAILS_MASTER_KEY=[copy from Render or from local proj]
- Run
docker compose up
and everything should start. NOTE: If you get an error about key length then change your RAILS_MASTER_KEY to be what is in your localmaster.key
file, Render seems to generate the wrong length key but somehow it works on Render's servers - Visit http://localhost:3000 but if you are incorrectly redirected to http:// try it in incognito, if you still are redirected then within Chrome go to chrome://net-internals/#hsts and within the "Delete domain security policies" search for "localhost" and Delete. Then try again.
- Note: Local changes to rails files will no longer be reflected in the running instance. You can connect to the running docker instance to inspect the filesystem by doing:
docker ps
and finding the container ID for "hostedgpt-base" then dodocker exec -it PASTE_ID /bin/sh