ryanswapp

ryanswapp

Having trouble deploying Phoenix 1.7

I built a fresh app with the new Phoenix 1.7.0-rc.0 build and am attempting to deploy it to Digital Ocean like I normally do. I’m having some issues though… My build typically follows this path:

  1. Push code from local to github repo
  2. Pull code to deployment server at /home/app
  3. Build release with MIX_ENV=prod mix distillery.release
  4. Copy build to /opt/app
  5. tar -xzf app.tar.gz
  6. bin/app start

The app starts and there is nothing in the log files indicating a problem, however I get a 502 Bad Gateway error from NGINX.

I’ve confirmed that I have enabled server: true in the endpoint config as well as config :phoenix, :serve_endpoints, true

As a test, I built the release with just mix release and when I start the release it works perfectly (I can go to the url and nginx forwards everything appropriately). However, I’d like to use distillery for the upgrade functionality. I’m just wondering if something changed in Phoenix 1.7 that would cause it to not work correctly? Having trouble diagnosing the issue with no errors in the logs. It seems like the app is not being started on port 4000 for NGINX to forward to. But I don’t know how to check why that is or what port it actually is being set to.

Here is the relevant config in runtime.exs scoped under prod:

  config :my_app, MyAppWeb.Endpoint,
    http: [port: 4000],
    url: [host: host, port: 80],
    secret_key_base: secret_key_base,
    server: true

  config :phoenix, :serve_endpoints, true

Any help is appreciated.

Marked As Solved

ryanswapp

ryanswapp

I figured it out! Distillery ignores runtime.exs. I looked at the module config with Application.get_env in the remote console and noticed that all the runtime config of the endpoint was missing. I moved that code to prod.exs and everything works as expected.

Where Next?

Popular in Questions Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
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
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43622 214
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
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
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
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
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement