Closed MarSoft closed 7 years ago
Hello. Thanks for the issue!
I wrote these instructions a long time ago, so to be honest, I don't remember all the details. But looking at my instructions now I see that it contains a bullet about setting HOME_URL
.
And the prod
environment really relies on it https://github.com/gaynetdinov/ex_money/blob/master/config/prod.exs#L16
Did you set HOME_URL
correctly while following the instructions?
Yes, I did set the variable. But looks like it is not passed to the buildpack unless specifically allowed by the config. And when buildpack cannot see this var, it will do something wrong - and as a result, deployed app keeps redirecting to localhost
.
But strange enough, I couldn't reproduce it when using auto-deploy. I have partially implemented Deploy with Heroku button, it is still not fully functional (it doesn't configure task with Heroku Scheduler).
Hm, interesting. Just checked without the fix. When you open newly created app with https://
protocol, it works & asks you to create new user. But if you try to open it with http://
url then you are redirected to https://localhost
. I don't know why, as I am not familiar with Elixir.
With my fix though, HOME_URL variable is respected, but only at the time of building. So if you change it with heroku config:set HOME_URL=something.different
, that change will not be applied until you rebuild an app by pushing new version. Probably there is some better solution?
So the issue is that http://ex-money-heroku-url.com doesn't work(redirects to localhost), but https://ex-money-heroku-url.com works, right?
It seems like it redirects http to localhost, because url for port 80 is not set, in config/prod.exs
only port 443 is configured. I don't really know how to configure config/prod.exs
to make phoenix serve both 80 and 443 ports and to be honest, I don't see any reason why you'd do that(I mean accessing ex_money without https).
As for buildpack.config, I think you're right. You need to specify all system ENVs in config_vars_to_export
to make them accessible via Application.get_env(:ex_money, :my_var)
.
References
https://medium.com/@chibicode/some-gotchas-when-deploying-a-elixir-phoenix-app-to-heroku-6ae668d1667d#.jtkj9neib
http://wsmoak.net/2015/07/05/phoenix-on-heroku.html
When I tried to follow instructions to deploy on Heroku, I kept getting a redirect to "https://localhost" instead of any site page. In build log there was this warning:
So I updated config to export HOME_URL var as well, and this worked. Am I doing something wrong?