You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/10/18 09:19:14 UTC

[GitHub] [incubator-devlake] klesh opened a new issue, #3466: [Feature][framework] Preventing multiple devlake instance sharing the same database

klesh opened a new issue, #3466:
URL: https://github.com/apache/incubator-devlake/issues/3466

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar feature requirement.
   
   
   ### Description
   
   ### Why
   
   There is an incident reported by our users, and it happened twice:
   
   1. In jira connection page, entered token and tested it successfully, saved it.
   2. Go to any related `blueprint` detail page, click **Run Now**
   3. The pipeline might fail on jira with error message `authentication failed`
   
   Before you can understand the root cause of the phenomenon, here are some prerequisite knownledge:
   
   1. `devlake` has this `encKey`, it would be generated automatically and stored into `.env` file when it is empty, normally during the first launch.
   2. All sensitive fields will be encrypted with this key before saving to the database
   3. The sensitive fields will be decrypted using the same key when needed
   4. Decrypt with the wrong key gets an empty result...
   5. Each `devlake` would launch a background thread/gorountine to execute pending pipelines in the database
   
   So, obviously, when 2 `devlake` instances with different `encKey`s, one of them would fail to decrypt the sensitive token, hence `authentication failed`
   
   The problem is relatively simple when explained, but not during the debugging process, it is hard and time-consuming to pinpoint the root cause, so, I propose that we set up some kinds of mechanism to prevent multiple `devlake`s from sharing the same database
   
   ### What
   
   Use the `sha1 hash` of the `encKey` as a claim for the database, `devlake` should exit with error when conflicting.
   
   1. Create a table `_devlake_claims` with columns `id` and `created_at` and `updated_at`
   2. Whenever `devlake` connected to the database, generate the `id` by `sha(encKey)`, make sure the table contains no records or the `id` are matched, or panic with error.
   3. If no records in the table, insert one record
   4. If the record existed and matched, refresh the `updated_at` column
   5. If the record existed and didn't matched, panic with error
   6. The table must be locked during the whole process
   
   
   
   ### Use case
   
   1. Save time for users to solve the problem
   2. Save time for developers to pinpoint the root causethe
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] github-actions[bot] commented on issue #3466: [Feature][framework] Preventing multiple devlake instance sharing the same database

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #3466:
URL: https://github.com/apache/incubator-devlake/issues/3466#issuecomment-1319385223

   This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh closed issue #3466: [Feature][framework] Preventing multiple devlake instance sharing the same database

Posted by GitBox <gi...@apache.org>.
klesh closed issue #3466: [Feature][framework] Preventing multiple devlake instance sharing the same database
URL: https://github.com/apache/incubator-devlake/issues/3466


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org