ollran
Hi,
I created a new Phoenix umbrella application. I am trying to configure it to use different port, but the port does not change.
$ mix phx.new test --umbrella --no-ecto
In test_umbrella/config/prod.exs:
I uncommented this line:
config :test_web, TestWeb.Endpoint, server: true
and configured the ip and the port:
config :test_web, TestWeb.Endpoint,
url: [ip: [0,0,0,0], port: 1234],
cache_static_manifest: "priv/static/cache_manifest.json"
Then I ran:
$ cd test_umbrella/
$ SECRET_KEY_BASE=$(mix phx.gen.secret) MIX_ENV=prod mix phx.server
The server starts, but cowboy listens on port 4000 instead of 1234.
08:14:34.496 [info] Running TestWeb.Endpoint with cowboy 2.6.3 at :::4000 (http)
08:14:34.498 [info] Access TestWeb.Endpoint at http://localhost:1234
08:15:13.928 request_id=Fa1_NZgFyPdDboEAACYH [info] GET /
08:15:13.929 request_id=Fa1_NZgFyPdDboEAACYH [info] Sent 200 in 1ms
$ curl 0.0.0.0:1234
curl: (7) Failed to connect to 0.0.0.0 port 1234: Connection refused
$ curl 127.0.0.1:1234
curl: (7) Failed to connect to 127.0.0.1 port 1234: Connection refused
$ curl 0.0.0.0:4000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
[...]
Some additional information:
$ elixir --version
Erlang/OTP 22 [erts-10.4.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.9.0 (compiled with Erlang/OTP 22)
$ mix phx.new --version
Phoenix v1.4.8
$ uname -a
Darwin MBPro.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-
4903.261.4~2/RELEASE_X86_64 x86_64
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Other Trending Topics
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #performance











Showing Posts 1 to 6- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ollran
Ah yes. I have to use the
PORTenvironment variable:Is this a bug? What happens if I use different port in the configuration file?
NobbZ
Just changing
prod.exsmight not necessarily help. Especially in an umbrella project you need to be very sure about when to edit which file.This though is dependant on you overall config structure.
Just open your umbrellas root
config/config.exsand try to play through theload_configcalls and see if you end up in your applicationsconfig/prod.exs.hubertlepicki
You must have somewhere something like
System.get_env("PORT")or{:system, "PORT"}. Try finding it in your project, you will learn where it’s being set and apparently it overwrites your configuration of prod.exsollran
Thanks! I found this in
test_umbrella/config/prod.secret.exs.Changing the port here works. I think I will configure my application to use the environment variable everywhere.
hubertlepicki
Glad I could help.
LostKobrakai
In short: The
:httpconfig is for listening part, while the:urlconfig is for the url/link generation.