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

Set SHARKD_SOCKET to be usable by node user #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ COPY --from=intermediate /out /out
RUN cd / && tar zxvf /out/sharkd.tar.gz && rm -rf /out/sharkd.tar.gz

ENV CAPTURES_PATH=/captures/
ENV SHARKD_SOCKET=/home/node/sharkd.sock
Copy link
Member

Choose a reason for hiding this comment

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

I've had a good degree of success placing the SHARKD_SOCKET within the CAPTURES_PATH since its pretty much guaranteed to be available, writeable and exclusive regardless of the container build or username. thoughts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I chose this one because it exists in the node:20-bookworm container we are building off of and is writable by the default node user that I set the docker container to run as. I am not opposed to putting it somewhere else.

I do have a concern with /captures/, as if that directory were shared between multiple instances, we could either delete a socket or use a sharkd instance that belongs to another container. We could also have problems in the unlikely event that /capture/ ends up on a mountpoint that doesn't support unix sockets (NFS, CIFS, FAT, NTFS, ...).


# RUN git clone --single-branch --branch master https://github.com/qxip/node-webshark /usr/src/node-webshark
COPY --chown=node . /usr/src/node-webshark
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# sharkd daemon fails to start if the socket already exists
rm "$SHARKD_SOCKET"
[ -f "$SHARKD_SOCKET" ] && rm "$SHARKD_SOCKET"

exec npm start