1

I'm rather a newbie to GCP so please forgive my ignorance. I'm trying to connect a few bits together, namely:

  • A Node instance running on App Engine
  • A ChatScript instance running on Cloud Run with a Dockerfile
  • An SQL instance running on Cloud SQL
  • Some scheduler tasks via Cloud Functions
  • and a Firestore database for good measure

I'm trying to get the Node instance to talk to the ChatScript instance via a websocket. However, when doing so I get the strangest response, but I don't know if it's coming from GCP or ChatScript:

\u0015\u0003\u0001\u0000\u0002\u0002F

This is when connecting via port 443 using either the canonical URL or IP of the CR instance. I am also certain it's not anything to do with Node.

There were some commands in a Medium article which I tried running to allow websockets and port forwarding but I get the feeling that's a red herring. The ChatScript server is being told to run on $PORT from the Dockerfile so that should surely do the port forwarding automagically?

I also updated the firewall rules to allow 443 and 8080 but I don't think that's correct either.

I guess the main thing that's making me struggle to troubleshoot the issue is that I have no idea what the response is meant to mean. Does the fact there's a response of any kind suggest that GCP is doing its job, and it's the binary running on that port that's causing the issue?

I'm also wondering whether I'm getting some of the config from different GCP services mixed up and blending them all together...?

Anyway, here are the files I'm using. Any help would be appreciated.

Dockerfile

FROM ubuntu:trusty

RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty main' >/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty-security main' >>/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty-updates main' >>/etc/apt/sources.list
RUN echo 'deb http://archive.ubuntu.com/ubuntu trusty universe' >>/etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y --force-yes autoconf \
curl \
git \
wget \
unzip

COPY chatscript-client /bin/
RUN chmod +x /bin/chatscript-client

ENV DEBIAN_FRONTEND noninteractive

COPY build/Botname /bin/Botname

RUN ls -lah /bin/
RUN ls -lah /bin/Botname

RUN chmod +x /bin/Botname/BINARIES/LinuxChatScript64

USER root

CMD ["/bin/chatscript-client"]

chatscript-client

#!/bin/bash

echo "Listening on port $PORT"

cd /bin/Botname/
./BINARIES/LinuxChatScript64 PORT=$PORT

app.flexible.yaml

env: flex

env_variables:
  DB_USER: foo
  DB_PASS: foo
  DB_NAME: foo
  CLOUD_SQL_CONNECTION_NAME: foo:europe-west1:foo

beta_settings:
  cloud_sql_instances:foo:europe-west1:foo

network:
  forwarded_ports:
    - 65080
    instance_tag: websocket
  • 2
    Hmm, just seen https://cloud.google.com/run/docs/issues#grpc_websocket - "Inbound WebSockets and gRPC streaming are not currently supported for Cloud Run (fully managed). However, those protocols do work outbound and unary gRPC is supported." – Matt Fletcher Oct 30 '19 at 11:46
  • I assume what I'm trying to do is inbound? Does this mean I'd have to just set up an everyday ubuntu server? – Matt Fletcher Oct 30 '19 at 11:46

1 Answers1

1

Yes, you are right (as per your comments), for port manipulation I would suggest to spin up a GCE VM Ubuntu server, then mount your server there (GCP Firewall rules are also needed, but it seems you already have this covered).

Frank
  • 361
  • 1
  • 7