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

[Feature][installation] Make .env file readonly to fix the encKey ENCODE_KEY complication once and for all #5235

Closed
2 of 3 tasks
klesh opened this issue May 19, 2023 · 1 comment · Fixed by #5374, apache/incubator-devlake-website#550, #5399, #5408 or #5410
Assignees
Labels
type/feature-request This issue is a proposal for something new
Milestone

Comments

@klesh
Copy link
Contributor

klesh commented May 19, 2023

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Use case

As a user, I would like to upgrade the devlake smoothly without losing my data.

Description

Why do we need it?

The encKey or ENCODE_KEY was introduced a long time ago to encrypt sensitive information (e.g. access token, password, etc) stored in the database.

What went wrong?

We decided to generate the encryption key and save it to the .env file automatically on the first boot if it was omitted in order to make the installation process smoother.

However, it has been proven problematic along the way:

  1. bad naming
  2. the devlake container must be deployed as a stateful set, since we have to write the key back to the .env file
  3. users often do not aware of the key and run into encKey after upgrading if they chose to deploy a completely new instance with the existing database

What can we do about it?

Users should be properly informed about the encryption key, and how should they do about it.

Plan of attack

  1. Unify encKey ENCODE_KEY to encryptionSecret / ENCRYPTION_SECRET both codebase and documentation
  2. Make .env file Readonly and Optional in codebase: devlake backend could still read setting from dotenv file IFF it exists
  3. Remove the auto-generate logic from our code base, devlake should fail if no ENCRYPTION_SECRET is provided
  4. v0.18 Installation Guide to ask users to generate the ENCRYPTION_SECRET manually with some example command, and ask them to store it properly if they want to deploy a brand new instance using the existing database.
  5. v0.18 Upgrade Guide should guide users to extract the existing ENCODE_KEY and set it up on the new version
  6. v0.18 Release Note must warn users it is a BREAKING change, and ask users to follow the Upgrade Guide @abeizn
  7. Proceed issue Run devlake as a deployment instead of statefulset incubator-devlake-helm-chart#130

Note

Please NOTE that we are deprecating the reading/wrting from devlake to the .env, you may still use it as env_file in the docker-compose.yml, it is not related to the topic.

Related issues

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@klesh klesh added the type/feature-request This issue is a proposal for something new label May 19, 2023
@klesh klesh added this to the v0.18.0 milestone May 19, 2023
@klesh klesh changed the title [Feature][installation] Fix the encKey ENCODE_KEY complication once and for all [Feature][installation] Deprecate .env file to fix the encKey ENCODE_KEY complication once and for all May 19, 2023
@abeizn abeizn self-assigned this May 30, 2023
@abeizn abeizn reopened this Jun 6, 2023
@abeizn abeizn changed the title [Feature][installation] Deprecate .env file to fix the encKey ENCODE_KEY complication once and for all [Feature][installation] Make .env file only read to fix the encKey ENCODE_KEY complication once and for all Jun 6, 2023
@klesh
Copy link
Contributor Author

klesh commented Jun 7, 2023

@IronCore864 The .env file is optional now, we can now proceed to update the helm chart to use the user-generated ENCRYPTION_SECRET from Environment Variable, check apache/incubator-devlake-website#550 for detail

@klesh klesh changed the title [Feature][installation] Make .env file only read to fix the encKey ENCODE_KEY complication once and for all [Feature][installation] Make .env file readonly to fix the encKey ENCODE_KEY complication once and for all Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment