-
Notifications
You must be signed in to change notification settings - Fork 7
Socket map for check virtual users and virtual domains #281
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
Draft
Aravinda-HWK
wants to merge
5
commits into
LSFLK:main
Choose a base branch
from
Aravinda-HWK:socket-map-virtual-users
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e7859dd
feat: socketmap for virtual-users
Aravinda-HWK dbb85fa
fix: add mutex for cache access to ensure thread safety
Aravinda-HWK e0493b4
feat: enhance socketmap service with health checks and graceful shutdown
Aravinda-HWK 9d0f103
feat: enhance user validation in socketmap with specific mailbox checks
Aravinda-HWK 2070508
feat: update userExists response to return mailbox path for Postfix cβ¦
Aravinda-HWK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Binaries | ||
| socketmap | ||
| *.exe | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
|
|
||
| # Test binary | ||
| *.test | ||
|
|
||
| # Output of the go coverage tool | ||
| *.out | ||
|
|
||
| # Dependency directories | ||
| vendor/ | ||
|
|
||
| # Go workspace file | ||
| go.work | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Socketmap Service Dockerfile | ||
| FROM golang:1.21-alpine AS builder | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| # Copy go module files | ||
| COPY go.mod ./ | ||
| RUN go mod download | ||
|
|
||
| # Copy source code | ||
| COPY main.go ./ | ||
|
|
||
| # Build the binary | ||
| RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o socketmap . | ||
|
|
||
| # Final stage | ||
| FROM alpine:3.19 | ||
|
|
||
| # Install ca-certificates and netcat for healthcheck | ||
| RUN apk --no-cache add ca-certificates netcat-openbsd | ||
|
|
||
| # Create a non-root user and group | ||
| RUN addgroup -S appgroup && adduser -S appuser -G appgroup | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Copy binary from builder | ||
| COPY --from=builder /build/socketmap . | ||
|
|
||
| # Set ownership for the app directory and binary | ||
| RUN chown -R appuser:appgroup /app | ||
|
|
||
| # Switch to the non-root user | ||
| USER appuser | ||
|
|
||
| # Expose socketmap port | ||
| EXPOSE 9100 | ||
|
|
||
| # Run the service | ||
| CMD ["./socketmap"] | ||
|
Comment on lines
+39
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better security, the container should not run as the |
||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
The
socketmap-serverservice is missing ahealthcheck. Adding one would improve the reliability of your stack, especially sincesmtp-serverdepends on it. Without a healthcheck,depends_ononly waits for the container to start, not for the service to be ready. You could then change the dependency tocondition: service_healthy.Note that the healthcheck command needs to send a valid netstring request, which can be tricky with
sh -c. You may want to consider adding a simpler healthcheck mechanism to the Go service itself.