Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Cannot execute code directly from repository #508

Open
stl-steve-moore opened this issue Nov 11, 2020 · 2 comments
Open

Cannot execute code directly from repository #508

stl-steve-moore opened this issue Nov 11, 2020 · 2 comments

Comments

@stl-steve-moore
Copy link

This might be pilot error. I want to be able to run the code directly and not in Docker. My end goal is to add new test cases.

I cloned the code repo and ran the commands as documented
bundle install
bundle exec rake db:create db:schema:load
bundle exec rackup

It complains about not being able to reach http:validator_service:4567 (see below for more complete dump)

I assumed that service was to run on my localhost host, so I updated by /etc/hosts file to map validator_service to 127.0.0.1. I still have the same error. I tried on both the master and develop branches and had the same issue.

Environment: macOS Catalina (10.15.7)

Steve Moore
[email protected]

INFO | Inferno | Checking that validator is available at http://validator_service:4567
ERROR | Inferno | Unable to reach validator at http://validator_service:4567
INFO | Inferno | Checking that validator is available at http://validator_service:4567
ERROR | Inferno | Unable to reach validator at http://validator_service:4567
^CTraceback (most recent call last):
47: from /usr/local/opt/ruby/bin/bundle:23:in <main>' 46: from /usr/local/opt/ruby/bin/bundle:23:in load'
45: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:34:in <top (required)>' 44: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in with_friendly_errors'
43: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/exe/bundle:46:in block in <top (required)>' 42: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in start'
41: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in start' 40: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in dispatch'
39: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in dispatch' 38: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command'
37: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' 36: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in exec'
35: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in run' 34: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in kernel_load'
33: from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in load' 32: from /usr/local/lib/ruby/gems/2.7.0/bin/rackup:23:in <top (required)>'
31: from /usr/local/lib/ruby/gems/2.7.0/bin/rackup:23:in load' 30: from /usr/local/lib/ruby/gems/2.7.0/gems/rack-2.2.3/bin/rackup:5:in <top (

@radamson
Copy link
Contributor

TL;DR

Preferred Fix:

  • Run docker run -p 3000:4567 infernocommunity/fhir-validator-service:latest
  • Update Line 42 of config.yml to external_resource_validator_url: http://localhost:3000

Alternate Fix:

  • Update Line 38 of config.yml to resource_validator: internal

More details on what's happening here...
This is a gap in the documentation for running the service locally that probably came about when we changed how validation works by default. Let me try and explain what's going on here:

Inferno's FHIR resource validation capability is configurable. It can either use its internal validation capabilities or delegate validation to an external service. Here is the relevant part of the config:

https://github.com/onc-healthit/inferno/blob/d1e9b92b3283122c8862a99d94eeb1183df5196e/config.yml#L33-L42

The easiest option here would be to set resource_validator to "internal" and then running inferno. The external validator can handle doing more comprehensive validation and has features that help with test generation - which is why it is currently the new default.

In order to use the external validator you'll need to run an external FHIR validator service. This is what the dockerized version of inferno does and what the current config is set to (note the named container validator_service):

https://github.com/onc-healthit/inferno/blob/d1e9b92b3283122c8862a99d94eeb1183df5196e/docker-compose.yml#L12-L13

The validation server is available on DockerHub and can be run with: docker run -p 3000:4567 infernocommunity/fhir-validator-service:latest. You'll need to update the config appropriately too: external_resource_validator_url: http://localhost:3000. I choose port 3000, but it can be any of your choosing.

You could also provide your own validator service that conforms to this API, but I wouldn't recommend that to start 😉 .

Refer to the TL;DR up top for the recommended fix.

@nathanloyer
Copy link

It would be helpful for the repo to have the default configuration work when running locally. If not that, then having an error message that could hint us in the direction of the fix would be OK. Or even just having it in the readme to change the setting when running locally.

I ran into this problem last week and a colleague who had run this before was able to help me work around it by setting it to internal validation mode.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants