-
-
Notifications
You must be signed in to change notification settings - Fork 137
Enable DomainSocket support for both mysql and postgresql #176
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
============================================
- Coverage 80.21% 80.10% -0.11%
- Complexity 1022 1023 +1
============================================
Files 258 258
Lines 3740 3745 +5
Branches 466 469 +3
============================================
Hits 3000 3000
- Misses 541 542 +1
- Partials 199 203 +4
Continue to review full report at Codecov.
|
Stale pull request message |
Huge thanks to the author of this PR (@andy-yx-chen). This saved my tail yesterday. 🙏 I'm under a tight deadline to finish an app and yesterday (a few days before deadline) I think to myself "I should probably test the deployment to make sure everything works". You know get the DNS straightened out and whatnot. Anyways, I'm planning to deploy my app on GCP via cloud run and connect to cloud sql. Turns out GCP ONLY supports unix socket connection in their serverless environment stuff. I spent almost all of yesterday googling ways around this because jasync does not currently support unix sockets. Turns out the only way around this is to use a private IP / VPC network with a "VPC serverless connector" that costs between $12 and $70 a month (no thanks). Felt like I was hosed. Would either have to rewrite my entire data layer to use hikari or some shit (gross). Or my expected server costs would rise by ~$600 a year just so I could connect to a stupid database (also gross). ANYWAYS, I found this PR from issue #175, and was able to cobble together a solution that allowed me to use unix sockets. So, I'm now using jasync in production with GCP unix sockets and things are working great so far. Thanks!! Will explain my solution for any poor soul who was in my predicament yesterday.
fun dbConnectionPool(config: DbConfig): SuspendingConnection {
return PostgreSQLConnectionBuilder.createConnectionPool {
if (config.host != null) {
host = config.host
}
database = config.database
username = config.user
password = config.password
if (config.unixSocketFile != null) {
unixSocket = DomainSocketAddress(config.unixSocketFile)
}
}.asSuspending
} (in GCP the config.unixSocketFile would be the string I needed to import netty into my app just to use the Anyways I fired it up and crossed my fingers. And what-do-you-know, works like a charm. ✨ Thanks again to the author of this PR. If I ever get some time, I am going to try to come back submit a real PR. |
Thanks for posting that here. A PR in the future will be awesome! |
why this awesome PR not merged? we really need it! |
I can reopen this if you would like. the original reason for not having this merged was lack of testing: #175 (comment) |
@oshai Thanks your response! The feature of unix domain socket is too important(e.g. in GCP AppEngine), I will review the code and resubmit a PR if i can. |
Thank you! |
Implemented in #319 |
No description provided.