sergio

sergio

1 umbrella app, can I host different apps to different Heroku apps?

I’ve been trying for two days to get an Elixir umbrella app to work on Heroku with a proxy app on a single heroku application to no success. It seems like I’m hammering my head against a wall haha.

I was wondering if I have this umbrella app:

  • App
  • App (elixir)
  • AppWeb (phoenix)
  • AppMarketing (phoenix)

Can I deploy it to two different Heroku apps in such a way that AppWeb runs on one app, and AppMarketing runs on a different heroku app? While both can share the business rule library of App?

This umbrella application is in a single git repository by the way.

Appreciate any helps with this! As my last recourse I’ll just use a single monolith phoenix app with scoped routes, but I would hate to do that if I can avoid it.

Most Liked

orestis

orestis

Umbrella applications are code-design concepts - just an easy way to develop related applications together and share code etc.

What you want is to create two different releases:

Release A will run App + AppWeb
Release B will run App + AppMarketing

This will work if the App is a library application, i.e., just a bunch of functions without its own supervision tree. If however it starts its own tree, which for example is the case if it uses Ecto, you would be better placed to run it only once. You will need to add extra configuration to your apps to teach them how to find the other nodes, and deal with Heroku’s daily restarts, firewalls, internal networking and so on.

All that said, as you’ve found out, dealing with complicated releases and distributed Erlang/Elixir adds significant complexity in your Ops. Since you don’t need to change your code dramatically to do this split later on, it’s best to start by running everything on a single node.

nivanson

nivanson

I’ve been serving multiple apps with a custom endpoint proxying to the other endpoints. The other endpoints had server: false in their configuration. However I recently started using websockets and that’s where this setup fell short. Now I use a nginx proxy in front of the application. So still one application on heroku serving multiple applications with multiple endpoints.

https://hexdocs.pm/phoenix/1.3.0-rc.1/phoenix_behind_proxy.html

cblavier

cblavier

Hi @arjun289
I’m running an umbrella app with websockets on Heroku for over a year now, without any trouble

Here is my setup: https://gist.github.com/cblavier/0c2cf3f101d82c32503774f179a66a3f

wmnnd

wmnnd

Elixir and Erlang/OTP do allow for communication between applications on different nodes but if you’re only just getting started and you’re not experiencing any actual problems with the current setup, using just one Heroku app for your whole umbrella application is probably the best way to go :slight_smile:

What is your reasoning for wanting to use multiple Heroku instances instead?

domvas

domvas

Hi,
maybe it’s not what I should do but I won’t answer the question “How can I have 2 heroku apps with one umbrella” but talking about my experience about the first case: one umbrella with a proxy deployed on heroku.

I presume that you know this resource: https://github.com/wojtekmach/acme_bank
Which is a (working) example of an umbrella app deployed to heroku with a proxy.
I followed this example for my own project and it works fine.

But Is encountered 2 problems:

  • it is for phoenix 1.2 and as you know, phoenix 1.3 is out
  • the phoenix-based apps are complete phoenix app as you expect a mix ph(oeni)x.new to build. But if you have ever done a mix ph(oeni)x.new --umbrella, you’ve seen that structure is quite different (and more interesting): it is like this
    project_umbrella
    |_ project
    |_ project_web
    Adding parts to this structure is intuitive, and in fact, the project app will hold the proxy code

Working example is better than words, especially considering my poor english.
Feel free to look at: https://github.com/dominique-vassard/vinculi
where I’ve implement these structure (with phoenix 1.3) which is deployed to heroku via travis.

Hope it helps and don’t hesitate if you have any question.
I’m kind of elixir newbie but be pleased to help :slight_smile:

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement