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

Reworks SSH Tunneling For SQL Databases #2708

Merged
merged 23 commits into from
Oct 9, 2024
Merged

Reworks SSH Tunneling For SQL Databases #2708

merged 23 commits into from
Oct 9, 2024

Conversation

nickzelei
Copy link
Member

@nickzelei nickzelei commented Sep 17, 2024

This PR reworks SSH Tunneling for SQL Databases.

We previously were starting a TCP server and proxying the network connections between it by exposing a host port and giving that to the database drivers.

We are no longer doing that in favor of creating driver-specific database connectors that now are providing with a custom DialFunc which, upon invocation, first connects to the configured jump box via the SSH Client. The dial is then passed to that connection to dial the actual database.

This is much cleaner because now we can just provide the database connection directly to sql.Open and all of the dialing complexities are handled behind the scenes by the system libs themselves. Nice!

This rework allows for much better tests and error propagation. Nice Nice!

Copy link

vercel bot commented Sep 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
neosync-docs ⬜️ Ignored (Inspect) Visit Preview Oct 4, 2024 9:40pm

@nickzelei nickzelei changed the title init Reworks SSH Tunneling Sep 17, 2024
@nickzelei nickzelei added the Tech Debt Created by Linear-GitHub Sync label Sep 17, 2024
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 35.86006% with 220 lines in your changes missing coverage. Please review.

Project coverage is 36.65%. Comparing base (939c88e) to head (4e017c3).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
backend/pkg/sqlconnect/sql-connector.go 32.50% 104 Missing and 4 partials ⚠️
internal/sshtunnel/dialer.go 0.00% 45 Missing ⚠️
...ackend/pkg/sqlmanager/postgres/postgres-manager.go 55.88% 13 Missing and 2 partials ⚠️
...1alpha1/connection-data-service/connection-data.go 0.00% 14 Missing ⚠️
backend/pkg/sqlmanager/sql-manager.go 0.00% 11 Missing ⚠️
...n-tunnel-manager/providers/sqlprovider/provider.go 41.66% 5 Missing and 2 partials ⚠️
...shtunnel/connectors/mysqltunconnector/connector.go 76.19% 3 Missing and 2 partials ⚠️
...unnel/connectors/postgrestunconnector/connector.go 71.42% 3 Missing and 1 partial ⚠️
backend/pkg/mongoconnect/connector.go 0.00% 3 Missing ⚠️
...rker/internal/connection-tunnel-manager/manager.go 77.77% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2708      +/-   ##
==========================================
- Coverage   36.99%   36.65%   -0.35%     
==========================================
  Files         286      286              
  Lines       26957    26568     -389     
==========================================
- Hits         9973     9738     -235     
+ Misses      15672    15524     -148     
+ Partials     1312     1306       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nickzelei nickzelei changed the title Reworks SSH Tunneling Reworks SSH Tunneling For SQL Databases Oct 3, 2024
@nickzelei nickzelei marked this pull request as ready for review October 8, 2024 16:28
@nickzelei nickzelei merged commit 5852b1c into main Oct 9, 2024
10 of 12 checks passed
@nickzelei nickzelei deleted the nick/tunnel-rework branch October 9, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tech Debt Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants