zatae
Phoenix dev mode Google Cloud Run
Is this possible to deploy a Phoenix application to Google Cloud Run with MIX_ENV=dev ? For some reasons when I try deploy in dev mode, it just crash when the application starts.
Since Cloud Run is using gVisor, could this be possible that Phoenix is making some system calls that gVisor would consider as dangerous and just kill the process?
Marked As Solved
timothy
So I did some testing and it appears Google Cloud kills the application because the healthcheck fails. It test if the application is reachable on the given port. Since Phoenix runs on 127.0.0.1 in dev environment it isn’t available. So changing the ip configuration in config/dev.exs fixed the issue for me.
config :phoenix_cloud_run, PhoenixCloudRunWeb.Endpoint,
# Binding to loopback ipv4 address prevents access from other machines.
# Change to `ip: {0, 0, 0, 0}` to allow access from other machines.
- http: [ip: {127, 0, 0, 1}, port: 4000],
+ http: [ip: {0, 0, 0, 0}, port: 4000],
Also Liked
timothy
Which “execution environment” are you using? The second generation, which is still in preview though, might fix these system calls. This is what we are currently using.
According to the docs:
The second generation execution environment provides full Linux compatibility rather than system call emulation.
timothy
I tested with both first-and second generation.
Did you change the port configuration on Cloud Run too? By default Cloud Run uses 8080 but Phoenix uses 4000 in dev environment.
zatae
That was it, totally forgot about that! Thank you very much for your help.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #podcasts
- #code-sync
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









