refactor(cli): keep alteration scripts folder writable by gid 0 #6328
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
One possible approach to address #6327.
Ensures that /etc/logto/packages/cli/alteration-scripts is present and writable by gid 0.
Does not remove/replace this directory each time, just removes the contents. This ensures that
the writabiliy remains (and also allows this to be a separately-mounted directory.
The reasons for doing this are described in #6327, but briefly, the desire is to let logto be
run from within docker as a non-root user (although gid 0 would still be required unless
the alteration-scripts are on a separately-mounted directory with appropriate permissions).
I propose this approach rather than making all of /etc/logto/packages/cli as writable by gid 0 since keeping more things read-only just seems safer overall.
Testing
So far I have only tested by running with a custom docker-compose.yml that is modified to have
user: 1001:0
for the app container, and it does apply seeding as desired. I have not testedon openshift/k8s yet (will need to build a container image accessible to my openshift cluster
to do that), but wanted to put this out there for possible discussion.
Checklist
.changeset
Not sure which of these you would want for this type of change (I think this may qualify at most as a
@logto/cli: minimal
under .changeset, but accept input on that).