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
Are you sure you added it to url: […] and not http: []? The :url config is meant for that exact case.
Also Liked
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
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
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 ![]()
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
- #code-sync
- #javascript
- #podcasts
- #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









