sql-proxy icon indicating copy to clipboard operation
sql-proxy copied to clipboard

Usage description in README misses flag?

Open voigt opened this issue 4 years ago • 2 comments

Hi,

first of all, thank you for this tool - it was exactly what I was looking for. However, It took me an unnecessarily long time to get it running, following the description in the README.

The README states, that I have to spawn the proxy like this and connect with MySQL client:

docker run -p 127.0.0.1:3306:3306 planetscale/pscale-proxy \
  --host 0.0.0.0 \
  --org "$PLANETSCALE_ORG" \
  --database "$PLANETSCALE_DATABASE" \
  --branch "$PLANETSCALE_BRANCH" \
  --service-token "$PLANETSCALE_SERVICE_TOKEN" \
  --service-token-name "$PLANETSCALE_SERVICE_TOKEN_NAME" 

Following this instructions, sql-proxy complained that it could not connect to the host on :3307. I was able to fix it by providing the --remote-host flag and setting the host explicitly.

I don't know how pscale-proxy is supposed to work, but I somehow expected that it would "magically find" its host. As long as it doesn't do so, I'd suggest mentioning this in the guide.

Kind regards and keep up the great work!

voigt avatar Oct 16 '21 07:10 voigt

I am getting the same issue with port 3307 having its connection refused

{"app": "sql-proxy-client", "error": "couldn't connect to \"0.0.0.0:3307\": dial tcp 0.0.0.0:3307: connect: connection refused"}

I tried using the --remote-host fix mention above but am still having the same issue. Am I missing something / doing something wrong here? 😅

# docker-compose.yml
version: '3'

services:
    planetscale:
        image: planetscale/pscale-proxy:latest
        container_name: planetscale
        command: "\
            --host 0.0.0.0 \
            --remote-host 0.0.0.0 \
            --org $PLANETSCALE_ORG \
            --database $PLANETSCALE_DATABASE \
            --branch $PLANETSCALE_BRANCH \
            --service-token $PLANETSCALE_SERVICE_TOKEN \
            --service-token-name $PLANETSCALE_SERVICE_TOKEN_NAME"
        ports:
            - 127.0.0.1:3306:3306
        environment:
            PLANETSCALE_BRANCH: $PLANETSCALE_BRANCH
            PLANETSCALE_DATABASE: $PLANETSCALE_DATABASE
            PLANETSCALE_ORG: $PLANETSCALE_ORG
            PLANETSCALE_SERVICE_TOKEN: $PLANETSCALE_SERVICE_TOKEN
            PLANETSCALE_SERVICE_TOKEN_NAME: $PLANETSCALE_SERVICE_TOKEN_NAME

NuroDev avatar Nov 11 '21 10:11 NuroDev

You have to use the remote host from Planetscale ap-south.connect.psdb.cloud for example. You can find this in the connect box

nanduri1998 avatar Dec 22 '22 07:12 nanduri1998