socotecio / django-socio-grpc-example

Simple examples of how to use DSG
Apache License 2.0
1 stars 2 forks source link

correct docker-compose file for full local development ? #13

Open markdoerr opened 10 months ago

markdoerr commented 10 months ago

Dear @AMontagu and @legau, the vue3 frontend example works nicely, if the backend is dockerized (as in the main branch).

I am currently trying to make a docker-compose file for local front- and backend development. For that purpose, only an envoy proxy would be required, accepting requests by the front-end client and forwarding them to the gRPC server, that should run on localhost. I generated a new docker-compose.dev.yaml file with the corresponding envoy-dev.yaml file: s. https://github.com/socotecio/django-socio-grpc-example/tree/feature/local-frontend-development

I tried several configurations of the docker compose network, but non allowed access to the local gRPC server.

Have you had, by any chance, the same issue and know a quick solution ? (just in case you know already the answer, otherwise I will continue experimenting - or put the server back into the docker container) Merci, mark

markdoerr commented 10 months ago

Here is the Error, I get: POST http://localhost:9991/dsg_example.example_bib_app.AuthorController/Create net::ERR_CONNECTION_REFUSED

AMontagu commented 10 months ago

Hello @markdoerr if you are trying to chnage the port you also have to change the envoy.yaml file. See: https://django-socio-grpc.readthedocs.io/en/latest/how-to/grpc-web.html#the-envoy-proxy-docker-image

markdoerr commented 10 months ago

Thanks, @AMontagu, for the hint - I know, that's why I created a "local" envoy config version in the corresponding branch: https://github.com/socotecio/django-socio-grpc-example/blob/feature/local-frontend-development/envoy/envoy-dev.yaml

(and the related Dockerfile, using it: https://github.com/socotecio/django-socio-grpc-example/blob/feature/local-frontend-development/envoy/Dockerfile-dev ) But I am not lucky with the network configuration - addressing local networks through docker / compose is not really straight forward...

AMontagu commented 10 months ago

my bad i didn't see the file in the commit.

How did you come up with address: lan_access (not saying that this is an issue we never used this outised docker) Did you try putting localhost, 0.0.0.0 or http://localhost isntead of lan_access ?

markdoerr commented 10 months ago

here I am trying to use the bridged network specified in: https://github.com/socotecio/django-socio-grpc-example/blob/feature/local-frontend-development/docker-compose.dev.yaml

AMontagu commented 10 months ago

ho yes because as your back is not in docker you need to get access to your computer network.

following this: https://huzaima.io/blog/connect-localhost-docker you should try to use host network and then using localhost. Here is for the docker compose configuration: https://docs.docker.com/compose/compose-file/compose-file-v3/#network_mode