shotleybuilder

shotleybuilder

Endpoint config when deploying to Gigalixir using mix

Hi
Just after the ‘secret sauce’ to get my links working correctly after the app is deployed. They all stubbornly display localhost

Here’s where I’ve been with prod.exs

url: ["${APP_NAME}.gigalixirapp.com"] I’m deploying with mix not distillery and I think this is the config for the latter

APP_NAME is available by default, and so I tried

url: ["#{System.get_env("APP_NAME")}.gigalixirapp.com"] but no luck

and of course

url: ["example.com"] which is where I started from

At a loss to know what to try next. Something so simple seems very opaque in the docs and it’s not always clear with other resources which of the three deploy methods the author is using. And lots of the help resources are now dated.

Not sure to include PORT or not. Sometimes it’s included and other times not. I have this in prod.exs too

http: [port: {:system, "PORT"}]

Any help welcomed.

Marked As Solved

LostKobrakai

LostKobrakai

Are you sure you added it to url: […] and not http: []? The :url config is meant for that exact case.

Also Liked

LostKobrakai

LostKobrakai

# prod.exs
config :bob_versions_web, BobVersionsWeb.Endpoint,
  http: [:inet6, port: System.get_env("PORT") || 4000],
  url: [scheme: "https", port: 443],
  force_ssl: [rewrite_on: [:x_forwarded_proto], host: nil],
  check_origin: ["//*.kobrakai.de", "//*.gigalixirapp.com"]

# releases.exs
config :bob_versions_web, BobVersionsWeb.Endpoint,
  secret_key_base: System.fetch_env!("SECRET_KEY_BASE")

This is what I deploy to gigalixir using releases.

Generally you should not need to configure url: [host: …] unless you’re using MyAppWeb.Endpoint for url generation (of non-relative paths) instead of a conn. The latter does hold the current request host and simply uses that one.

LostKobrakai

LostKobrakai

You don’t want port 4000 for the url, but 80 or 443 depending on if you use http or https.

:url is the config used only for url generation. Ports for urls look like this: example.com:4000 unless the scheme is http and the port 80 or the scheme https and the port 443, when the port is skipped.

All this is completely separate from configuring where phoenix listens on incoming requests, which is configured on the :http/:https key. Here you want to set the port to something gigalixir routes requests to.

shotleybuilder

shotleybuilder

Yeah, the app has been deployed and working for a while, it was just touching the url config that was causing the probs. This seems to have fixed it. Very simple, but not in the Gigalixir docs nor any tutorial that I’ve been able to find. No doubt I will find the very instruction in hindsight - everything is so blindingly obvious then :slight_smile:

Last Post!

van-mronov

van-mronov

Hey, I have the same problem with Gigalixir :slightly_smiling_face:
Your app is failing health checks, which means it isn't listening on port 4000

How did you handle it? Add any healthcheck endpoint?
I could find anything related in Gigalixir docs too :slightly_smiling_face:

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement