-
Notifications
You must be signed in to change notification settings - Fork 73
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
clp-package: Add support for running package as root (fixes #500). #464
Conversation
@@ -268,6 +277,14 @@ def start_queue(instance_id: str, clp_config: CLPConfig): | |||
DockerMount(DockerMountType.BIND, queue_logs_dir, rabbitmq_logs_dir), | |||
] | |||
rabbitmq_pid_file_path = pathlib.Path("/") / "tmp" / "rabbitmq.pid" | |||
|
|||
container_user = f"{os.getuid()}:{os.getgid()}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can factor this code into a function as well, but it could be a bit tricky to reason about
def set_permission_and_get_user(list_paths: List[str]):
container_user = f"{os.getuid()}:{os.getgid()}"
if os.getuid() == 0:
# Use the default container user and make the directories
# writable by the default user if the current user is root
container_user = "mongodb"
for path in list_paths:
chown_recursively(path, 999, 999)
return container_user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the PR title, how about:
clp-package: Add support for running package as root (fixes #500).
components/clp-package-utils/clp_package_utils/scripts/start_clp.py
Outdated
Show resolved
Hide resolved
components/clp-package-utils/clp_package_utils/scripts/start_clp.py
Outdated
Show resolved
Hide resolved
components/clp-package-utils/clp_package_utils/scripts/start_clp.py
Outdated
Show resolved
Hide resolved
Co-authored-by: haiqi96 <[email protected]>
Description
When running container as root user, redis, results cache and rabbitmq containers lose the write permission to log and data directories.
This PR adds a temporary fix. We let the container run with their default user and change the ownership of the log directories when the current user is root.
Also adds a start up check for redis
Validation performed