PacoVK / tapir

A Private Terraform Registry
https://pascal.euhus.dev/tapir/
Apache License 2.0
187 stars 12 forks source link

Error trying to use Elasticsearch Backend #414

Closed gfranco-nos closed 3 months ago

gfranco-nos commented 3 months ago

Image: pacovk/tapir:0.6.3

Issue: Trying to setup Tapir using Helm Chart I'm receiving an error from the application in the step where it's supposed to connect to ElasticSearch:

2024-06-04 04:47:20,899 INFO  [io.quarkus] (main) Installed features: [amazon-dynamodb, amazon-s3, amazon-sts, cdi, config-yaml, elasticsearch-rest-client, hibernate-validator, oidc, quinoa, resteasy-reactive, resteasy-reactive-jackson, security, smallrye-context-propagation, smallrye-openapi, vertx]
2024-06-04 04:47:20,904 INFO  [cor.Bootstrap] (main) Validate GPG key configuration provided
2024-06-04 04:47:20,905 INFO  [cor.Bootstrap] (main) Start to bootstrap registry database [elasticsearch]
2024-06-04 04:47:21,224 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): org.apache.http.ConnectionClosedException: Connection is closed
    at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:920)
    at org.elasticsearch.client.RestClient.performRequest(RestClient.java:300)
    at org.elasticsearch.client.RestClient.performRequest(RestClient.java:288)
    at core.backend.elasticsearch.ElasticSearchRepository.createIndexIfNotExists(ElasticSearchRepository.java:310)
    at core.backend.elasticsearch.ElasticSearchRepository.bootstrap(ElasticSearchRepository.java:209)
    at core.backend.elasticsearch.ElasticSearchRepository_ClientProxy.bootstrap(Unknown Source)
    at core.Bootstrap.bootstrap(Bootstrap.java:33)
    at Main$TerraformRegistry.run(Main.java:22)
    at Main_TerraformRegistry_ClientProxy.run(Unknown Source)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at Main.main(Main.java:9)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:61)
    at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
Caused by: org.apache.http.ConnectionClosedException: Connection is closed

I've tried to use other ports in the Elastic definitions, but looking into the code I wasn't able to find any authentication method to Elastic, what's expected by it to accept connections, as the default behavior is to close connections without any auth method. This is a issue to me because when using the ECK deploy to Elastic, it isn't possible to deactivate the authentication to Elasticsearch.

PacoVK commented 3 months ago

Thanks for this issue. I had that on my radar, but never implemented it. I will release soon 0.7.3 which will then contain the config options

gfranco-nos commented 3 months ago

Thank you very much @PacoVK! I've updated the image and it just worked! I'll after just leave some suggestions and a PR to the Helm repo after.

Also, just to remind to update the info version in the Java Bootstrap, although I'm using the 0.7.3 version, the logs display 0.7.0 :P