ministryofjustice / prisoner-offender-search

Prisoner Offender Search
MIT License
4 stars 2 forks source link

Fix the build/config so that running locally on Windows 'Just Works' #155

Closed boydingham closed 1 year ago

boydingham commented 3 years ago

Expected Behavior

Following, step by step, the usage instructions in the "Running" section of the README, attempting to run the system locally should just work; without any need to edit anything.

Current Behavior

The system fails to run when—following verbatim—the usage instructions in the "Running" section of the README (full stack trace)...

...
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'globalSearchResource' defined in file [D:\development\projects\yjaf\pnomis\ycd.560\knowledge.transfer\prisoner-offender-search-main\build\classes\kotlin\main\uk\gov\justice\digital\hmpps\prisonersearch\resource\GlobalSearchResource.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'globalSearchService' defined in file [path.to.project/prisoner-offender-search-main/build/classes/kotlin/main/uk/gov/justice/digital/hmpps/prisonersearch/services/GlobalSearchService.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'indexStatusService' defined in file [path.to.project/prisoner-offender-search-main/build/classes/kotlin/main?uk/gov/justice/digital/hmpps/prisonersearch/services/IndexStatusService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'indexStatusRepository' defined in uk.gov.justice.digital.hmpps.prisonersearch.repository.IndexStatusRepository defined in @EnableElasticsearchRepositories declared on ElasticSearchConfiguration: Invocation of init method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.elasticsearch.repository.support.SimpleElasticsearchRepository]: Constructor threw exception; nested exception is org.springframework.dao.DataAccessResourceFailureException: Connection is closed; nested exception is java.lang.RuntimeException: Connection is closed

...

Caused by: org.apache.http.ConnectionClosedException: Connection is closed
    at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.endOfInput(HttpAsyncRequestExecutor.java:356)
    at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:261)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
    at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
    at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
    at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
    at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
    at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
    at java.base/java.lang.Thread.run(Thread.java:831)

> Task :bootRun FAILED

...

Context

I am an external developer of a non-DPS system. My system is specified to consume API endpoints exposed by this project.

Being able to run, test and integrate my system with a local deployment of this project, would...

  1. Speed up the delivery of my system
  2. Simplify the development process of my system

Steps to Reproduce

  1. Making zero changes to zero files of this project, follow verbatim the usage instructions in the "Running" section of the README...

prisoner offender search dependent services up and healthy 0 a


prisoner offender search dependent services up and healthy -1 b

Your Environment

petergphillips commented 3 years ago

Thanks for raising the issue.

I don't think any of us run windows either so might be tricky to fix I'm afraid. Can I ask why you need to run the prisoner offender search in intellij? Does docker-compose up work or doesn't that work either?

boydingham commented 3 years ago

Thank you for your reply @petergphillips.

"...Does docker-compose up work or doesn't that work either?..."

Yes sir. That is correct. In "Current Behavior" above, I report...

"...The system fails to run when—following verbatim—the usage instructions in the "Running" section of the README..."

...Where "verbatim" means, first I followed these instructions...

... Running all services locally:

docker-compose up

...

...And "The system fails to run". Then second I followed these instructions...

... Running all services except this application (hence allowing you to run this in the IDE))

docker-compose up --scale prisoner-offender-search=0 

...and "The system fails to run".

boydingham commented 3 years ago

...

TL;DR

I just need to call this project somehow.

--

To be clear

"...why you need to run the prisoner offender search in intellij?..."

I don't "need to run the prisoner offender search in intellij", sir.

I'm not doing any development per se on this project. That is, no code changes, no fixes, etc.

The non-DPS project that I am developing, consumes the resources (endpoints) of this project. Therefore, it would be ideal to be able to run this project locally as I develop my non-DPS project.

However, I presume that if I was provided with adequate instructions from DPS (or whoever), then I could do my development by consuming the remote dev deployment of this project.

Whether local deployment of this project is possible from the docker-compose command or from within an IDE—or even if my non-DPS application must call your remote dev deploymentI can be flexible.

boydingham commented 3 years ago

Thanks for your pgp-DT-1949-update-localstack branch @petergphillips,

The localstack service now starts up OK on Windows...

prisoner offender search dependent localstack compose all ready 0 a

...But the prisoner-offenders-search service is still failing to start. It fails with the same exception originally reported...

prisoner offender search bootrun bombs still 0 b

petergphillips commented 3 years ago

As I mentioned in slack to you, you need to wait for

Running on http://0.0.0.0:4571

output from localstack before starting prisoner offender search. The README now also contains more detailed instructions on starting up prisoner offender search and provides two options depending on whether you want prisoner offender search to be within docker too or not.

boydingham commented 3 years ago

Thank you @petergphillips,

"...mentioned in slack to you, you need to wait for..."

My Slack availability is limited. I plan to login to your channel later this afternoon though.

Also, since this is a public open source project in a public repo, then is it fair to presume that there is some value in publicly sharing whatever solutions are discovered?

By "sharing" I mean with potential non-DPS consumers of this project —other than myself—that might run into the same issue in the future.

petergphillips commented 1 year ago

closing old issues