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:

Where Next?

Popular in Questions Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&query=perfume&page=2, I would like to get: ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41539 114
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
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement