Skip to content

debugging locally reproducing production error

Carlo Beltrame edited this page Apr 11, 2023 · 7 revisions

Locally reproducing an error that only appears on a deployment

First, locally build the container in which the problem happens. E.g. for frontend:

docker build -t ecamp/ecamp3-frontend:dev -f .docker-hub/frontend/Dockerfile .

💡 See the various "build and push" jobs in the continuous deployment workflow to find the exact parameters for other containers.

Then, modify docker-compose.yml to use your built image instead of the normal one in use during development:

services:
  frontend:
    image: ecamp/ecamp3-frontend:dev
    container_name: 'ecamp3-frontend'
    volumes:
      - ./frontend/public/environment.js:/app/environment.js

💡 Make sure to remove the user: line, because on the deployment, currently all containers run as root.

Finally, run the project normally using docker compose up.

After adjusting code, you need to rebuild the container image using the docker build command from above again, and then replace the running container with a new one:

docker compose stop frontend && docker compose up -d --no-deps frontend

This will take some time and manual effort on every code change, which is the reason we normally use a completely separate development setup with hot reloading.