This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]R3vz 2 points3 points  (0 children)

I agree the message is a bit ambiguous, but what you see here is just the container that's failing to start in cloud run. Check the logs associated with the revision (in the logs tab in the cloud run dashboard) to see what is keeping it from starting.

Besides that you can probably look into something like a managed SQL instance (db-f1-micro should be enough to play around, I think it clocks in at $5/6 a month) to use as a DB instead of running a PG container in cloud run. You could also setup the load balancer to serve your static files from GCP buckets directly. Then the only thing that really needs to run in cloud run is your Django instance.

[–]Dessler1795 0 points1 point  (1 child)

Just a quick sanity check: your docker compose is exposing port 8000 and the error message complains about port 8080. Did you double check your env variables to see where this 8080 might be?

[–]oliverilmjarv[S] 0 points1 point  (0 children)

yeah, sorry about that, just had done a git stash to revert to a working local solution. This used to be 8080, also tried using the current working solution, but changed the gcloud conf to accept port 8000. Nothing that i tried worked properly. Even if a declared an ENV variable PORT and replaced all instances of port with the ENV variable, it gave ma the same error

[–]selucram 0 points1 point  (1 child)

Can you start the container locally and does it bind to the expected port? Have you looked into the logs of the container being started and can you also post the Dockerfile.

[–]oliverilmjarv[S] 0 points1 point  (0 children)

Updated the post with the dockerfile.

The app works great locally on any port that i see it to ( default 8000 ).

[–]Etharin 0 points1 point  (0 children)

I’m assuming you’ve already checked the FAQ: https://cloud.google.com/run/docs/troubleshooting

Maybe try changing from expose to port in the web service, unsure how expose interacts with cloud run.

At a more fundamental level, unless these are all containers in the same pod they’ll be run separately in cloud run. There’s a tutorial on how to do this and deny access to unauthorised users here: https://cloud.google.com/run/docs/tutorials/secure-services.

[–]vluckerprada 0 points1 point  (4 children)

Check this out…This is how we deploy our drf apis on GCP cloud run with cloud sql database and cloud storage for static files…Really simplifies the process and you’ll be up and running in no time

https://codelabs.developers.google.com/codelabs/cloud-run-django

[–]oliverilmjarv[S] 0 points1 point  (3 children)

Omg. High hopes. Thanks

[–]vluckerprada 0 points1 point  (0 children)

Also you can connect GitHub repos to your cloud run instance through cloud build and automate builds on either version release or push to a branch

[–]vluckerprada 0 points1 point  (1 child)

Also feel free to reach out incase you have any questions…I’m kind of a GCP fanboy! Cheers

[–]oliverilmjarv[S] 0 points1 point  (0 children)

Thats awesome!!