Closed fcsousaunifesp closed 7 months ago
I've been analyzing the ./config/initializers/external_apis/doi.rb file, and I would also like more information on how I should fill in the fields below: Rails.configuration.x.doi.landing_page_url = 'https://my.doi.org/' Rails.configuration.x.doi.api_base_url = 'https://my.doi.org/api/' Rails.configuration.x.doi.auth_path = 'auth_path' Rails.configuration.x.doi.heartbeat_path = 'heartbeat' Rails.configuration.x.doi.mint_path = 'doi' Rails.configuration.x.doi.active = false
Best regards
Flavio Castro de Sousa
Hi @fcsousaunifesp
You will need to dig into the application logs to determine what is causing the error here.
Make sure that you have enabled the DataCite service as your DMP ID service. You do that in this configuration file
If that is enabled, you can change debug:
on this line to true
which will give you more information back from the gem that is used to send DataCite its XML.
I would also consider adding some debug statements in that same data cite_service.rb
to inspect the request and response items.
You may need to contact DataCite if your logs show that you are sending DataCite the record and they are not returning any detailed error information.
Ahh. The doi.rb
config file is out of date and no longer used. I must have forgotten to remove it. You want to use the data cite.rb
file.
landing_page_url
is the URL to the doi landing page. This is typically https://doi.org/
api_base_url
is the URL of the data cite API. This is what the system will call to register the DOI. See https://support.datacite.org/docs/api-create-doisThank you Brian, I will work tirelessly on this matter. Best regards
Flacio Castro
I say Flavio Castro... oh my god...
Good luck with your deployment of the PGDBR system! 😄
Hi @briri ,
We try all earlier configurations without success (we receiving the same error message: "Something went wrong and we were unable to acquire a DMP ID for your plan. Please try again. If the problem / persists please contact the help desk at ").
Above our dmptool/config/initializers/external_apis/datacite.rb file: Rails.configuration.x.datacite.name = 'datacite' Rails.configuration.x.datacite.description = 'The DataCite REST API: https://support.datacite.org/docs/api-create-dois' Rails.configuration.x.datacite.landing_page_url = 'https://doi.org/' Rails.configuration.x.datacite.api_base_url = 'https://api.test.datacite.org/dois'
Rails.configuration.x.datacite.mint_path = 'dois' Rails.configuration.x.datacite.update_path = 'dois/' Rails.configuration.x.datacite.delete_path = 'dois/'
Rails.configuration.x.datacite.hosting_institution = 'Instituto Brasileiro de Informação em Ciência e Tecnologia (IBICT)'
Rails.configuration.x.datacite.hosting_institution_identifier = 'https://ror.org/
Rails.configuration.x.datacite.repository_id = '
Can you help us for this case?
Hi @rwvaldivia I can't offer much more guidance here without seeing the Rails logs. Did you try any of the debug steps that I mentioned above?
"Make sure that you have enabled the DataCite service as your DMP ID service. You do that in this configuration file If that is enabled, you can change debug: on this line to true which will give you more information back from the gem that is used to send DataCite its XML. I would also consider adding some debug statements in that same data cite_service.rb to inspect the request and response items"
The issue could be in your application, an error from DataCite, or an issue processing the response. It is impossible to tell though without seeing any of the logs
Hi @briri We performed the configurations and verifications, but we received this error.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Started GET "/plans/67/mint" for 179.98.135.66 at 2023-08-04 15:10:26 -0300
Cannot render console from 172.16.16.5! Allowed networks: 127.0.0.0/127.255.255.255, ::1
Processing by PlansController#mint as HTML
Parameters: {"id"=>"67"}
D, [2023-08-04T15:10:26.761353 #1717774] DEBUG -- : Plan Load (0.6ms) SELECT "plans". FROM "plans" WHERE "plans"."id" = $1 LIMIT $2 [["id", 67], ["LIMIT", 1]]
D, [2023-08-04T15:10:26.761908 #1717774] DEBUG -- : ↳ app/controllers/plans_controller.rb:432:in `mint'
D, [2023-08-04T15:10:26.763959 #1717774] DEBUG -- : User Load (0.5ms) SELECT "users". FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]
D, [2023-08-04T15:10:26.764545 #1717774] DEBUG -- : ↳ app/controllers/plans_controller.rb:433:in mint' D, [2023-08-04T15:10:26.766104 #1717774] DEBUG -- : Role Load (0.3ms) SELECT "roles".* FROM "roles" WHERE "roles"."plan_id" = $1 [["plan_id", 67]] D, [2023-08-04T15:10:26.766583 #1717774] DEBUG -- : ↳ app/models/plan.rb:476:in
owner'
D, [2023-08-04T15:10:26.767874 #1717774] DEBUG -- : User Load (0.4ms) SELECT "users". FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]]
D, [2023-08-04T15:10:26.768342 #1717774] DEBUG -- : ↳ app/models/plan.rb:478:in `owner'
D, [2023-08-04T15:10:26.769938 #1717774] DEBUG -- : Identifier Load (0.3ms) SELECT "identifiers". FROM "identifiers" WHERE "identifiers"."identifiable_id" = $1 AND "identifiers"."identifiable_type" = $2 [["identifiable_id", 67], ["identifiable_type", "Plan"]]
D, [2023-08-04T15:10:26.770426 #1717774] DEBUG -- : ↳ app/models/plan.rb:622:in `dmp_id'
Started POST "/api/v0/authenticate" for 127.0.0.1 at 2023-08-04 15:10:26 -0300
ActionController::RoutingError (No route matches [POST] "/api/v0/authenticate"):
Class.DMPHub mint_dmp_id received a 404 response with:
++++++++++++++++++++++++++++++++++++++++++ Wouldn't it be the case to apply this command?
rake v3:init_dmphub # Adds the DMPHub for minting DMP IDs (DOIs)
Best Regards
Flavio Castro de Sousa
Hi @fcsousaunifesp
No, DMPHub is a separate Rails application that we run here to host our DMP ID metadata. If you are going to use DataCite directly then you should run rake v3:init_datacite
.
It's not clear to me from that log output. Where is it trying to do a POST to /api/v0/authenticate
? Is that one of the values you set in your config/initializers/external_apis/datacite.rb
?
To use DataCite, you will need to become a registered member organization. This will allow you to create DOIs. If you are a member, you should be able to find your client id/secret on their site and will then need to need to refer to their API documentation to make sure all of the other paths in the config file are correct. Here is the documentation for creating DOIs: https://support.datacite.org/docs/api-create-dois
Hi @briri Following your recommendations, when I test with the following command, I get a successful response. curl -X POST -H "Content-Type: application/vnd.api+json" --user XXXXXXX:YYYYYYYY -d @my_draft.json https://api.test.datacite.org/dois
Best Regards
Flavio Castro de Sousa
Ah ok good. So you're able to do it via curl
. That is good.
The data cite_service.rb was written a long time ago and is possibly out of date with the latest DataCite API rules. You will probably need to fix some things in the file.
The code is trying to use basic auth, make sure that is how DataCite wants you to authenticate. The line for the auth info is here: https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L162 The Line where it is used is here: https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L73
We use the Httparty gem for this, so checking their documentation may also be helpful if you need to change the auth settings.
Hi team.
I was not successful in configuring my dmptool fork regarding the DOI.
I have the datacite manufactures credentials. I performed these configurations in /dmptool/config/initializers/datacite.rb applying rake v3:init_datacite.
Could you tell me the complete path to configure the DOI attribution. So that I can understand where I'm going wrong?
If possible, indicate to me all the files where I must act to obtain success.
I need to finish this step so I can move on to the ORCID step.
Best Regards
Flavio Castro de Sousa
Em sex., 4 de ago. de 2023 Ã s 19:00, Brian Riley @.***> escreveu:
Ah ok good. So you're able to do it via curl. That is good.
The data cite_service.rb was written a long time ago and is possibly out of date with the latest DataCite API rules. You will probably need to fix some things in the file.
The code is trying to use basic auth, make sure that is how DataCite wants you to authenticate. The line for the auth info is here: https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L162 The Line where it is used is here: https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L73
We use the Httparty gem https://github.com/jnunemaker/httparty for this, so checking their documentation may also be helpful if you need to change the auth settings.
— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/499#issuecomment-1666220106, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYH75G2SNNLYFA2PDALXTVWIPANCNFSM6AAAAAA3ALCRQA . You are receiving this because you were mentioned.Message ID: @.***>
-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581
Hi Flavio,
I'm sorry to hear that you are not able to get the DataCite service working. We so not use DataCite for our DOI minting, we use EZID.
The system was structured so that you could "plug in" a DOI service. The DataCite service currently in the codebase is an example and has not been fully tested so it may need to be updated. Here are the files involved:
mint
action of the app/controllers/plans_controller.rb is called when the user clicks the button to "Register a DMP ID". mint_dmp_id
method of the abstract app/services/dmp_id_service.rb minter
method that defines which of the 2 services it will use dmphub_service.rb OR datacite_service.rb. Make sure you have commented out the dmphub_service
here!EDITOR=vim rails credentials:edit
and some from the config/dmproadmap.yml. Verify that the application is pulling in the right values by running rails config:trace
this will tell you where each value the application uses is coming from (e.g. credentials, regular config files, the ENV, etc.)basic_auth
is what they are expecting. If they no longer want you to use basic auth and instead want you to use OAuth, you can refer to the DmphubService code for an example of how to do thatThanks Brian...
I will implement your guidelines and get back to you with the results.
Best regards
Flavio Castro de Sousa
Em qui., 24 de ago. de 2023 Ã s 12:11, Brian Riley @.***> escreveu:
Hi Flavio,
I'm sorry to hear that you are not able to get the DataCite service working. We so not use DataCite for our DOI minting, we use EZID.
The system was structured so that you could "plug in" a DOI service. The DataCite service currently in the codebase is an example and has not been fully tested so it may need to be updated. Here are the files involved:
- The mint action of the app/controllers/plans_controller.rb https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/controllers/plans_controller.rb#L431 is called when the user clicks the button to "Register a DMP ID".
- That controller invokes the mint_dmp_id method of the abstract app/services/dmp_id_service.rb https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/dmp_id_service.rb#L8
- That controller determines which DOI service you have "plugged in" and want to use. It has a minter method https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/dmp_id_service.rb#L82 that defines which of the 2 services it will use dmphub_service.rb OR datacite_service.rb. Make sure you have commented out the dmphub_service here!
- The DataCiteService has a corresponding configuration file located in config/initializers/external_apis/datacite.rb https://github.com/CDLUC3/dmptool/blob/v4.0.9/config/initializers/external_apis/datacite.rb. That file retrieves some of its values from the Rails credentials file EDITOR=vim rails credentials:edit and some from the config/dmproadmap.yml https://github.com/CDLUC3/dmptool/blob/v4.0.9/config/dmproadmap.yml. Verify that the application is pulling in the right values by running rails config:trace this will tell you where each value the application uses is coming from (e.g. credentials, regular config files, the ENV, etc.)
- The app/services/external_apis/datacite_service.rb https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L68 is the code that communicates with the DataCite API. Again, I must stress that we do not use DataCite directly so we cannot guarantee that the code works as-is. You will need to refer to the DataCite API documentation and verify that this service is formatting the call correctly. The 4 most important parts would be to:
- Make sure that you are able to authenticate and mint a DOI through DataCite using curl first! If you can do this successfully, compare what you are doing with curl to what the system is doing when it calls DataCite. You can see what it is doing in detail by setting 'debug: true' here https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/datacite_service.rb#L73C1-L73C1
- Verify that basic_auth is what they are expecting. If they no longer want you to use basic auth and instead want you to use OAuth, you can refer to the DmphubService code https://github.com/CDLUC3/dmptool/blob/50807bf43efddae5f5c1ef6d3dbe989d8a514809/app/services/external_apis/dmphub_service.rb#L176 for an example of how to do that
- make sure that all of your headers are correct
- make sure that the format of the DataCite JSON is valid for the current version of the DataCite schema. The file that constructs the JSON is at app/views/datacite/_minter.json.jbuilder https://github.com/CDLUC3/dmptool/blob/v4.0.9/app/views/datacite/_minter.json.jbuilder
— Reply to this email directly, view it on GitHub https://github.com/CDLUC3/dmptool/issues/499#issuecomment-1691870596, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHT6WYB2HACF2D7BZX3FCYDXW5VLRANCNFSM6AAAAAA3ALCRQA . You are receiving this because you were mentioned.Message ID: @.***>
-- Flavio Castro de Sousa Técnico em Tecnologia da Informação Superintendência de Tecnologia da Informação UNIFESP - Reitoria Rua Sena Madureira, 1500 – 4º andar Voip 8581
What version of the DMPRoadmap code are you running? (e.g. v4.0.9)
Good night team. We are in the final stages of launching the PGDBR, a fork platform of dmptool, and we have a DOI registration failure:
"Something went wrong and we were unable to acquire a DMP ID for your plan. Please try again. If the problem / persists please contact the help desk at pgd@apps.ibict.br".
We entered the Datacite factory credentials, however we were unsuccessful. Can you suggest a way to solve this case?
Best Regards
Flavio Castro de Sousa