-
Notifications
You must be signed in to change notification settings - Fork 465
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 RENDERand change PORT to 3000 - Temporarily edit
production.rbto comment outconfig.force_ssl = true - Build the image:
docker build --target render-production -t hostedgpt-deployment:latest . - Temporarily edit your
docker-compose.ymlfile 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 upand 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.keyfile, 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 psand finding the container ID for "hostedgpt-base" then dodocker exec -it PASTE_ID /bin/sh