POST https://localhost:3008/v1/login net::ERR_CONNECTION_REFUSED
I had a setup to deploy a React app and a nodejs server with their services. https://github.com/Binomi0/gbpd/tree/develop/pods/gbpd
I can start all without errors but:
If runs kubectl exec -it "gbpd-front-xxxxx" -- /bin/bash
and then curl https://gbpd-api
No answer
If runs kubectl exec -it "gbpd-front-xxxxx" -- /bin/bash
and then curl gbpd-api
No answer
If runs kubectl exec -it "gbpd-front-xxxxx" -- /bin/bash
and then curl https://gbpd-api:3008
Gets this answer:
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
As far as I know, with lastone it gets a response so why getting the title error in web?
I got a docker-compose
file https://github.com/Binomi0/gbpd/blob/develop/docker-compose.yml that runs ok.
...
args:
REACT_APP_API_URL: https://localhost:3008
Then I can run docker-compose up
and get everything connecting OK.
What I can see:
Project needs to be built with then ENV var set before build process?.
Then if i set environment: - foo=bar
it goes to container but the app misses it. So we can't use environment vars in this kind of setup?
When runs docker-compose up
we are building the image and passing as args
to Dockerfile
ARG and setting the right ENV vars before building.
#Dockerfile
FROM node:12
WORKDIR /usr/src/app/front
ARG REACT_APP_API_URL
RUN echo $REACT_APP_API_URL
ENV REACT_APP_API_URL=$REACT_APP_API_URL
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
RUN npm install -g serve
EXPOSE 3000
CMD ["serve", "-s", "build", "-l", "3000"]
I'm lost in how to connect front to back with this setup, so will be very appreciated if someone can show some light on it. Why can't connect using localhost like in development or deploying with compose? Why even creating build passing gbpd-api
it gets refused?
I can give more feedback if needed.
Thx in advance!!