如何使用heroku在同一个域中运行两个不同的应用程序

时间:2021-10-17 14:04:26

I have a Rails app at example.com, which is a Heroku app running under that domain. However, the marketing team would like something more dynamic to use to change the material on the main landing page.

我在example.com上有一个Rails应用,它是一个在这个域中运行的Heroku应用。然而,营销团队希望使用更动态的东西来更改主页上的内容。

My questions therefore are:

因此我的问题是:

  • Can I run a different system than Rails under the same domain (example.com is one system, example.com/* is the old Rails app)
  • 我可以在同一个域中运行不同于Rails的系统吗(example.com是一个系统,example.com/*是旧的Rails应用)
  • Can those 2 systems be in the same Ruby app?
  • 这两个系统能在同一个Ruby应用程序中吗?
  • Can those 2 systems be in different languages (different Heroku apps)
  • 这两个系统是否可以使用不同的语言(不同的Heroku应用)

I've done these kinds of setups on custom servers. Just wandering whether it's possible to do this on Heroku.

我在定制服务器上做过这些设置。只是徘徊在Heroku上是否有可能。

1 个解决方案

#1


2  

No you can't. Heroku allows to associate zero or more custom domains to the same app, but it's not possible to associate two apps with the same domain and somehow split the routing.

不,你不能。Heroku允许将0个或多个自定义域关联到同一个应用程序,但不可能将两个应用程序关联到同一个域并以某种方式分割路由。

It's also very hard to have two different applications co-existing under the same umbrella. You can create more rack-based applications inside the same project and mount them under the same Rails router (for instance you can mount a Sinatra or Lotus application at a specific path in a Rails project).

在同一个保护伞下共存两个不同的应用程序也是非常困难的。您可以在同一个项目中创建更多基于rack的应用程序,并将它们挂载到相同的Rails路由器下(例如,您可以在Rails项目的特定路径上挂载Sinatra或Lotus应用程序)。

You cannot write the apps in two different languages, because it's not possible to build a single Heroku app with two different buildpacks. Well, in theory, you can write your own buildpack... but it's not trivial.

你不能用两种不同的语言编写应用程序,因为不可能用两种不同的buildpacks来构建一个单独的Heroku应用程序。嗯,理论上,你可以编写自己的构建包……但它不是微不足道的。

The only viable solution is to have more Rack-based applications mounted under the same Rails or Rack router (you can have N Rack applications, 1 Rails and N Rack, but it's hardly possible to have N Rails).

唯一可行的解决方案是在同一个Rails或机架路由器下安装更多基于机架的应用程序(您可以有N个机架应用程序、1个机架和N个机架,但是几乎不可能有N个机架)。

#1


2  

No you can't. Heroku allows to associate zero or more custom domains to the same app, but it's not possible to associate two apps with the same domain and somehow split the routing.

不,你不能。Heroku允许将0个或多个自定义域关联到同一个应用程序,但不可能将两个应用程序关联到同一个域并以某种方式分割路由。

It's also very hard to have two different applications co-existing under the same umbrella. You can create more rack-based applications inside the same project and mount them under the same Rails router (for instance you can mount a Sinatra or Lotus application at a specific path in a Rails project).

在同一个保护伞下共存两个不同的应用程序也是非常困难的。您可以在同一个项目中创建更多基于rack的应用程序,并将它们挂载到相同的Rails路由器下(例如,您可以在Rails项目的特定路径上挂载Sinatra或Lotus应用程序)。

You cannot write the apps in two different languages, because it's not possible to build a single Heroku app with two different buildpacks. Well, in theory, you can write your own buildpack... but it's not trivial.

你不能用两种不同的语言编写应用程序,因为不可能用两种不同的buildpacks来构建一个单独的Heroku应用程序。嗯,理论上,你可以编写自己的构建包……但它不是微不足道的。

The only viable solution is to have more Rack-based applications mounted under the same Rails or Rack router (you can have N Rack applications, 1 Rails and N Rack, but it's hardly possible to have N Rails).

唯一可行的解决方案是在同一个Rails或机架路由器下安装更多基于机架的应用程序(您可以有N个机架应用程序、1个机架和N个机架,但是几乎不可能有N个机架)。