Skip to content

Commit b8f90db

Browse files
committed
docs: add production database connection guide
Add instructions for maintainers to connect to the production PostgreSQL database, including Cloud Shell (recommended) and local machine methods, plus read-only session configuration for safety.
1 parent 52e3744 commit b8f90db

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/administration/admin-operations.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This is a brief guide for admins and moderators managing content on the registry
88
- If you are a maintainer and would like an account, ask in the Discord
99
- `gcloud` CLI installed and configured
1010
- `curl` and `jq` installed
11+
- `kubectl` installed with `gke-gcloud-auth-plugin` (for database access)
1112

1213
## Authentication
1314

@@ -16,6 +17,43 @@ This is a brief guide for admins and moderators managing content on the registry
1617
./tools/admin/auth.sh
1718
```
1819

20+
## Connecting to the Production Database
21+
22+
For debugging or data analysis, you can connect directly to the production PostgreSQL database. Use caution and prefer read-only access.
23+
24+
### Prerequisites
25+
26+
Install the GKE auth plugin if you haven't already:
27+
28+
```bash
29+
gcloud components install gke-gcloud-auth-plugin
30+
```
31+
32+
### Connect
33+
34+
```bash
35+
# Get cluster credentials
36+
gcloud container clusters get-credentials mcp-registry-prod --zone us-central1-b --project mcp-registry-prod
37+
38+
# Get the database password
39+
kubectl get secret registry-pg-app -o jsonpath='{.data.password}' | base64 -d
40+
41+
# Port-forward and connect (enter the password from above)
42+
kubectl port-forward svc/registry-pg-rw 15432:5432 &
43+
sleep 2
44+
psql -h localhost -p 15432 -U app -d app
45+
```
46+
47+
### Read-Only Access
48+
49+
To prevent accidental writes, set your session to read-only after connecting:
50+
51+
```sql
52+
SET default_transaction_read_only = on;
53+
```
54+
55+
Any write attempts will fail with an error until you disconnect.
56+
1957
## Edit a Specific Server Version
2058

2159
Use this when you need to modify details of a specific version (e.g., fix description, update status, modify packages).

0 commit comments

Comments
 (0)