Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Alma data triggered by webhook: daily updates and basedump #1159

Closed
6 tasks done
dr0i opened this issue Mar 15, 2021 · 22 comments
Closed
6 tasks done

Index Alma data triggered by webhook: daily updates and basedump #1159

dr0i opened this issue Mar 15, 2021 · 22 comments
Assignees
Labels
Projects
Milestone

Comments

@dr0i
Copy link
Member

dr0i commented Mar 15, 2021

Complements #1112 .
Fundamental to solve #1162.

@blackwinter has implemented a webhook which would call a (to be implemented) webhook listener to inform it about when the updates/basedump files are ready.

  • implement a webhook listener
  • index the data when webhook listener gets triggered
  • put webhook listener into monit to ensure its living (as it is part of lobid's web app it is already monitored)
  • get SSL certificate
  • restrict to SSL
  • configure webhook listener in the webhook

Deletions are atm not important but would complement this issue.

@dr0i dr0i added this to the almaMigration milestone Mar 15, 2021
@dr0i dr0i added this to Backlog in lobid board via automation Mar 15, 2021
@dr0i dr0i self-assigned this Mar 15, 2021
@blackwinter
Copy link
Member

blackwinter commented Mar 15, 2021

There are two possible webhooks (per type of run):

  1. baseline: Gets triggered when a baseline run finishes.
  2. update: Gets triggered when an update run finishes.

Both URLs may contain the following optional placeholders:

  • %{job}: The job to trigger (in our case: Jenkins job name); configurable per type of run (see above).
  • %{token}: A secret to protect the listener from unauthorized access (in our case: Jenkins Authentication Token); configurable per type of run (see above).
  • %{cause}: Some metadata pertaining to the run triggering the webhook; dynamic per run.

For Jenkins, our URL would currently look like:

http://JENKINS_HOST/job/%{job}/build?token=%{token}&cause=%{cause}

@dr0i dr0i moved this from Backlog to Working in lobid board Mar 15, 2021
@dr0i dr0i changed the title Daily updates of Alma data Index Alma data triggered by webhook: daily updates and basedump Mar 18, 2021
dr0i added a commit that referenced this issue Mar 26, 2021
- copy lobid-resources ETL morph resources to play resources

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- copy lobid-resources ETL morph resources to play resources
- configure routes
- use Global configs

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- increase minor version number

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- increase minor version number

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- increase minor version number

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- increase minor version number
- add github local repository to build.sbt

See #1159.
dr0i added a commit that referenced this issue Mar 26, 2021
- increase minor version number
- make github install jar into local repository to make it accessible in
  build.sbt

See #1159.
dr0i added a commit that referenced this issue Mar 29, 2021
dr0i added a commit that referenced this issue Mar 29, 2021
- add GET
- send email

See #1159.
dr0i added a commit that referenced this issue Mar 29, 2021
Don't catch a possible exception, so that a caller can treat the
exception, e.g. the Webhook.

See #1159.
dr0i added a commit that referenced this issue Mar 29, 2021
dr0i added a commit that referenced this issue Mar 29, 2021
dr0i added a commit that referenced this issue Mar 30, 2021
- refactor logging

See #1159.
@dr0i
Copy link
Member Author

dr0i commented Mar 30, 2021

Webhook listener deployed, called like:
http://alma.lobid.org/resources/webhook/update-alma?token=$secret and
http://alma.lobid.org/resources/webhook/basedump-alma?token=$secret.
Waiting for @blackwinter to configure the listener in their Webhook.

@dr0i dr0i assigned blackwinter and unassigned dr0i Mar 30, 2021
@dr0i dr0i moved this from Working to Review in lobid board Mar 30, 2021
@dr0i
Copy link
Member Author

dr0i commented Mar 30, 2021

Uh, wait: we should stick to SSL because of the secret token. Will assign @blackwinter again if the https URIs are properly configured.

@dr0i dr0i assigned dr0i and unassigned blackwinter Mar 30, 2021
@blackwinter
Copy link
Member

The webhook endpoint should only enqueue an indexing job, not run it immediately (at least not synchronously). We're not going to wait for the indexing process to finish. If you can't/won't adjust your webhook listener, we'd need to change the trigger to avoid waiting for a response.

@dr0i
Copy link
Member Author

dr0i commented Apr 7, 2021

Ah, yes I see, I did that wrong. Will fix this so that the endpoint is going to immediately ack when triggered.

@dr0i
Copy link
Member Author

dr0i commented Apr 20, 2021

Ups, hadn't deployed. Shouldn't do something quickly before lunch .... Please try again.

@dr0i
Copy link
Member Author

dr0i commented Apr 20, 2021

(the multiple started processes seem to be in connection with update.xml.bgzf beeing only 122 bytes small, resulting in just a little "locked" status. If you call the listener fast enough, it should work).

@dr0i
Copy link
Member Author

dr0i commented Apr 20, 2021

Hm, something is strange and I cannot see the logs ETL program. Have to check.

@blackwinter
Copy link
Member

Let me know if/when I shall give it another try. It's configured now and will be included when publishing starts again next week.

dr0i added a commit that referenced this issue Apr 20, 2021
@dr0i
Copy link
Member Author

dr0i commented Apr 20, 2021

Got logging to work (had to copy the log4j.xml to web/conf). Give it another try.

@dr0i dr0i assigned blackwinter and unassigned dr0i Apr 20, 2021
@blackwinter
Copy link
Member

LGTM.

@dr0i
Copy link
Member Author

dr0i commented Apr 22, 2021

Thx for reviewing and configuring! Closing.

@dr0i dr0i closed this as completed Apr 22, 2021
lobid board automation moved this from Working to Done Apr 22, 2021
dr0i added a commit that referenced this issue Apr 26, 2021
Don't create the index name when starting the app but when starting
the ETl of basedump.

See #1159.
dr0i added a commit that referenced this issue Apr 26, 2021
Don't create the index name when starting the app but when starting
the ETl of basedump.

See #1159.
dr0i added a commit that referenced this issue Apr 26, 2021
@dr0i
Copy link
Member Author

dr0i commented Apr 26, 2021

Uh. There was a bug in the creation of the index name, resulting in an overwriting of the existing production index. This happened 2 hours ago with the Webhook listener triggered from the BGFZ creation after NZ publishing.
Switched back to an index pre #1214 (Thursday last week) , fixed the bug in 5caa61d and restarted deploying new index.

@dr0i dr0i reopened this Apr 26, 2021
lobid board automation moved this from Done to Ready Apr 26, 2021
@dr0i dr0i moved this from Ready to Review in lobid board Apr 26, 2021
dr0i added a commit that referenced this issue Apr 26, 2021
Using two logging systems on one file is not working when this file
is rolled: one of the logging systems looses the rolled file.
Solution is to to use two log files when using two logging
configurations.

See #1159.
@dr0i
Copy link
Member Author

dr0i commented Apr 26, 2021

ETLed the basedump of today and made it productive. Closing.

@dr0i dr0i closed this as completed Apr 26, 2021
lobid board automation moved this from Review to Done Apr 26, 2021
@TobiasNx TobiasNx added the ALMA label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants