elmercante

elmercante

Hi @axelson, thanks for putting together main_proxy. I want to use it to do the same thing you’ve used it for: running multiple applications from one BEAM instance. I have an umbrella application with three phoenix endpoints (3 separate child apps): one for an e-commerce shop, another for the store’s admin area, and a third for its cms admin area. I want to route the requests for the admin areas to the single exposed web port for the e-commerce shop since the other two will never see much traffic. However, I’m having difficulty getting it to work with my release.

I have the functionality working correctly in both my local dev and prod environments, but once I use mix release to produce a release nothing is served when I start it. I’m seeing logs such as Configuration :server was not enabled for MyAppWeb.Endpoint, http/https services won't start for each web app that I’m trying to spin up locally in my release. Upon deployment (we build & start the release on Render) I’m seeing those logs plus the following ==> No open HTTP ports detected on 0.0.0.0, continuing to scan...

Do you have any idea what the issue could be?

Showing Posts 1 to 10

stefanluptak

stefanluptak

You probably don’t have this part in your config/runtime.exs:

config :main_proxy,
  server: true,
  http: [
    port: 8080,
    ip: {0, 0, 0, 0}
  ],
  # ...

Change the port accordingly.

elmercante

elmercante OP

Hey @stefanluptak thanks for the suggestion. I had port already in config/config.exs and I’ve added ip (tried them in both config.exs and runtime.exs), but I’m still running into the same error logs.

hubertlepicki

hubertlepicki

Two suspects:

  1. Are you starting MyApp.Proxy (or whatever you called it) in your application.ex in the supervision tree? This is this step in the readme:
children = [
  # ... other children
  MyApp.Proxy,
]

This should be done in one of the applications you have in app/. In my case I created a separate application just to serve that.

  1. Are you including and starting the application mentioned in the paragraph above (may be your “ui” or “web” app too if you don’t use dedicated one for proxy) in the release configuration?

You should have something like this in the top-level mix.exs of your project

deps: deps(),
releases: releases()
...

defp releases do
  [
    my_app: [
      applications: [
         proxy: :permanent
         ...
       ]
    ]
  end

I strongly suspect you’re not doing 1 or 2 or both and the OTP application that should have main proxy as a child either does not start at all, or does not start the child.

stefanluptak

stefanluptak

I am also suspecting not exposing ports in Docker, if it is being used.

elmercante

elmercante OP

Hey @hubertlepicki thanks! #2 fixed the release locally and I’m now seeing the other two apps when I start it. The app deployed correctly and I’m no longer seeing the No open HTTP ports detected logs. Unfortunately the admin apps still aren’t being served according to the backends I defined in MyApp.Proxy. What could I be doing wrong there?

elmercante

elmercante OP

I’m not using Docker.

hubertlepicki

hubertlepicki

Do you include these admin apps in the release as well? They both should have entries with :permanent just like your main app does.

elmercante

elmercante OP

Yea one entry for the main app, one each for the admin apps, and now one for the proxy app.

hubertlepicki

hubertlepicki

And it’s broken as well on the local release and when you deploy, or only when you deploy?

But it works when you start with iex -S mix ?

Also: what does it mean it’s broken. It renders 404 page out of the main app?

elmercante

elmercante OP

Only when I deploy. The local release is starting normally and I can access the admin apps from the domains defined in backends. On the deployed version I’m seeing a “This site can’t provide a secure connection my-shop-admin.my-app-lhrl.onrender.com uses an unsupported protocol.” page (ERR_SSL_VERSION_OR_CIPHER_MISMATCH). It doesn’t actually produce a log with more information.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
ryanwinchester
apply_graft/2 doesn’t rewrite an add_many sub-workflow’s deps on an add step. Grafted jobs cancel with “upstream job was deleted” Version...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews