2

The pry gem was in the test group:

group :test do
  gem 'pry', '~> 0.12.2'
end

It was working.

I moved it the another group.

group :development, :test do
  gem 'pry', '~> 0.12.2'
end

If I execute rspec, the binding.pry works. It halts execution however if I just run docker-compose up to start the local dev env, and add binding.pry somewhere, it does not work.

I followed the link here and rebuilt the container. Started the container however, binding.pry still doesn't work. It doesn't halt execution.

Any insight would be appreciated.

Here's my docker-compose.yml

services:

# Port 3010 is used for accessing running app in test mode from selenium service.
# Shm size needed for tests: https://github.com/elgalu/docker-selenium/issues/20
  app:
    extends:
      file: common-services.yml
      service: evt_portal_app
    command: docker/wait-for-postgres.sh db docker/start-${RAILS_ENV}.sh
    shm_size: 256M
    ports:
      - "${PORT}:${SERVER_PORT}"
      - "3010:3010"
    links:
      - db
      - webpack_dev_server
    networks:
      - default

and here's my docker-compose.develop.yml

services:

# Port 3010 is used for accessing running app in test mode from selenium service.
# Shm size needed for tests: https://github.com/elgalu/docker-selenium/issues/20
  app:
    extends:
      file: common-services.yml
      service: evt_portal_app
    command: docker/start-${RAILS_ENV}.sh
    shm_size: 128M
    ports:
      - "8083:3003"
    expose:
      - "3010"
    restart: always
    mem_limit: 4g
    memswap_limit: 4g
    depends_on:
      - delayed_job
    tty: true
    stdin_open: true

Here's a picture of the attached terminal (one created using docker attach <container ID>): enter image description here

As you can see, the execution is not halted.

1 Answer 1

2

Are you running Puma? If so the pry will be stuck in a given thread and we wont be able to access it.

In config/puma.rb you will see that there is a variable to define the number of threads.

ENV.fetch("RAILS_MAX_THREADS") { 5 }

So just make sure you set RAILS_MAX_THREADS to 1.

Then attach to the container and the pry should stop there:

docker attach <container_name>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.