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

fix(cmd): move unix domain sockets to /var/run #11944

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

brentos
Copy link
Contributor

@brentos brentos commented Nov 8, 2023

Summary

Unix domain socket files located in the prefix directory cause problems when mounting that directory in containers. In addition, it is common practice to store socket files in /var/run which is cleaned up automatically on server restart.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • [Implement ...]

Issue reference

Fix KAG-328

@CLAassistant
Copy link

CLAassistant commented Nov 8, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the chore Not part of the core functionality of kong, but still needed label Nov 8, 2023
@brentos brentos force-pushed the fix/kag-328-relocate-unix-domain-sockets branch from e6aae4e to 615944a Compare November 8, 2023 23:37
@brentos brentos force-pushed the fix/kag-328-relocate-unix-domain-sockets branch 3 times, most recently from e5d21a2 to dca52e6 Compare November 21, 2023 00:14
@@ -44,22 +44,6 @@ if [[ "$1" == "kong" ]]; then
if [[ "$2" == "docker-start" ]]; then
kong prepare -p "$PREFIX" "$@"

# remove all dangling sockets in $PREFIX dir before starting Kong
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will still need the logic, but instead removing dangling sockets in /var/run/kong directory.
I was wrong with my previous comment some days ago, it appears the /run or /var/run directory is not a volatile fs inside container; it's only volatile in a normal system. So the contents under this directory persists between container restarts.

@fffonion
Copy link
Contributor

fffonion commented Nov 21, 2023

Please also consider use cases when user doesn't start Kong through systemd (e.g. a plain kong start). In such case, even the ReadWritePaths I mentioned above won't work because no party is going to create that directory. So does the systemd-tmpfiles approach after a system reboot.

In conclusion, we need to consider following use cases:

  • container based
  • systemd controlled services
  • kong start
    All above use cases should work with fresh install, or after a system (container) restart.

@brentos brentos force-pushed the fix/kag-328-relocate-unix-domain-sockets branch from 72b9a53 to 8a5a1ba Compare November 30, 2023 01:29
@locao locao marked this pull request as draft December 19, 2023 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants