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

feat(proxy): allow proxy to connect to separate compute compared to mock cplane #10178

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

conradludgate
Copy link
Contributor

@a-masterov was asking for a way to test compute via proxy. This change allows for an easy way to mock the cplane api in a standalone postgres, while testing against a separate neon compute.

The following guide will be added to the proxy/README.md after some workshopping:


To setup locally, run a postgres server with the following schema:

CREATE SCHEMA neon_control_plane;
CREATE TABLE neon_control_plane.endpoints (
    endpoint_id text PRIMARY KEY,
    allowed_ips text,
    host text not null,
    port integer not null
);

And insert a host/port for your endpoint accordingly.

Create a certificate pair for proxy

openssl req -new -x509 -days 365 -nodes -text -out proxy.crt -keyout proxy.key -subj '/CN=*.localtest.me'

Run proxy

cargo run --bin proxy \
    --auth-backend postgres \
    --auth-endpoint "$CPLANE_MOCK" \
    -c proxy.crt -k proxy.key \
    --proxy "127.0.0.1:5432" \
    --mgmt "127.0.0.1:8080"

And connect to proxy via

psql "postgresql://${username}:${password}@${ENDPOINT}.localtest.me/dbname?sslmode=require"

Caveat, the username and password must be exactly the same in both postgres databases for this to work - in fact the salts need to be the same too which likely less useful 🙃 but it is still possible to do using CREATE ROLE role WITH ENCRYPTED PASSWORD '...'

Copy link

7095 tests run: 6785 passed, 12 failed, 298 skipped (full report)


Failures on Postgres 17

Failures on Postgres 16

Failures on Postgres 15

Failures on Postgres 14

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_proxy_http_allowed_ips[release-pg14] or test_proxy_http_allowed_ips[release-pg14] or test_proxy_http_allowed_ips[release-pg15] or test_proxy_http_allowed_ips[release-pg15] or test_proxy_http_allowed_ips[release-pg16] or test_proxy_http_allowed_ips[release-pg16] or test_pageserver_small_inmemory_layers[debug-pg17-False] or test_proxy_http_allowed_ips[release-pg17] or test_proxy_http_allowed_ips[release-pg17] or test_proxy_http_allowed_ips[debug-pg17] or test_proxy_http_allowed_ips[release-pg17] or test_proxy_http_allowed_ips[release-pg17]"
Flaky tests (2)

Postgres 17

Postgres 15

  • test_physical_replication_config_mismatch_too_many_known_xids: release-arm64

Test coverage report is not available

The comment gets automatically updated with the latest test results
a93639a at 2024-12-17T21:09:42.126Z :recycle:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant