将Rails引擎安装到生产中的多个应用程序的最佳做法 [英] Best practices to mount Rails engine to several apps on production

查看:147
本文介绍了将Rails引擎安装到生产中的多个应用程序的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点混淆组织Rails应用程序和可安装引擎的生产。



我有N个应用程序,它们使用1个可安装的引擎(它设置一些

在开发中它的工作方式如此。

文件夹:

  |  -  app1 
| - app2
| - my_engine

宝石文件:

  gem'my_engine',路径:../my_engine

所以所有的应用程序都从1个来源安装。

我想保持这个逻辑在生产中。 / p>

在我的vps应用程序这样组织(使用Capistrano部署):

  | -apps_folder 
| - - app1
| - - - 当前(sym链接)
| - - - 发布
| - - - 共享

| - - app2
| - - - 当前(sym链接)
| - - - 发布
| - - - 共享

| - git
| - - app1.git
| - - app2.git

您可以描述我的工作流程:如何将my_engine部署到我的生产中并将其连接到服务器上的所有应用程序。谢谢。

解决方案

你的意思是如何部署共享rails引擎?如果共享引擎安装在每个rails应用程序中,则不需要单独部署引擎。在将rails应用程序部署到生产之后,运行 bundle install 将会安装所有的应用依赖关系,包括共享引擎。这是我们在部署中所做的。


I'm a little bit confused about organizing Rails applications and mountable engine in production.

I have N apps, which are using 1 mountable engine (it sets some cookies for apps).
In development it works this way.
Folders:

|— app1
|— app2
|— my_engine

In apps Gemfile:

gem 'my_engine', path: "../my_engine"

So all of the apps are mounting it from 1 source.
And I'd like to keep this logic in production.

On my vps apps organized this way (using Capistrano for deploy):

|—apps_folder
|— — app1
|— — — current (sym link)
|— — — releases
|— — — shared

|— — app2
|— — — current (sym link)
|— — — releases
|— — — shared

|— git
|— — app1.git
|— — app2.git

Can you describe me workflow: how to deploy my_engine to my production and connect it to all of the apps on the server. Thanks.

解决方案

Did you mean how to deploy the shared rails engine? If the shared the engine is mounted in each rails app, there is no need to deploy the engine alone. After deploy rails app to the production, running bundle install will install all the apps dependency, including the shared engine. This is what we did in our deployment.

这篇关于将Rails引擎安装到生产中的多个应用程序的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆