简体   繁体   English

YAWS Embedded 作为 rebar3 问题中的依赖项

[英]YAWS Embedded as dependence in rebar3 issue

I'm trying to use YAWS in an application (as dep) in embedded mode.我正在尝试在嵌入式模式下的应用程序(作为 dep)中使用 YAWS。 I'm using rebar3.我正在使用 rebar3。 My application gets yaws as dep & builds via rebar3 (after some tweaking) & releases fine, but when I launch it YAWS is crashing out.我的应用程序在 dep 和通过 rebar3 构建(经过一些调整后)并正常发布时获得偏航,但是当我启动它时,YAWS 崩溃了。 It appears it is trying to start up even through it should be in embedded mode.即使它应该处于嵌入式模式,它似乎也在尝试启动。

I'm attempting to configured the yaws.app.src into embedded mode env as follows:我正在尝试将 yaws.app.src 配置为嵌入模式 env,如下所示:

{application,yaws,
 [{description,"yaws WWW server"},
  {vsn, {cmd, "sed -ne '1,/^YAWS_VSN=/s/^YAWS_VSN=//p' vsn.mk 2>/dev/null"}},
  {modules,[]},
  {registered, []},
  {mod,{yaws_app,[]}},
  {env, [
           {embedded, true}             % true | false
        ]},
  {applications,[kernel,stdlib@APPDEPS@]}]}.

I think it is starting automatically since it is listed as an application in my app.src file.我认为它会自动启动,因为它在我的 app.src 文件中被列为应用程序。 (Not sure though) If I remove from here I don't get files in release for YAWs. (虽然不确定)如果我从这里删除,我不会获得 YAW 发布的文件。 But when launched it is looking for config file and not acting like in embedded mode.但是当它启动时,它正在寻找配置文件,而不是在嵌入模式下运行。

=INFO REPORT==== 2-Sep-2015::19:00:58 ===
Yaws: Using config file /Users/someuser/csvp/_build/default/lib/yaws/etc/yaws/yaws.conf

What am I missing??我错过了什么?? Why is it still launching and why it is using the config file?为什么它仍在启动以及为什么它使用配置文件?

I suspect that you're specifying that Yaws should start up when the release starts, same as other applications in the release;我怀疑您指定 Yaws 应该在发布开始时启动,与发布中的其他应用程序一样; basically, the equivalent of calling application:start(yaws).基本上,相当于调用application:start(yaws). What you should be doing instead is loading Yaws but not starting it — the equivalent of application:load(yaws) — which I believe you can do by specifying {yaws, load} in the relx section of your rebar.config file.你应该做的是加载 Yaws 但不启动它——相当于application:load(yaws) ——我相信你可以通过在rebar.config文件的 relx 部分指定{yaws, load}来做到这rebar.config You should then follow these instructions in the Yaws documentation under the "Starting under your own supervisor" section.然后,您应该按照 Yaws 文档中“在您自己的主管下开始”部分下的这些说明进行操作 Depending on your specific needs, you'd call one of the yaws_api:embedded_start_conf/1,2,3,4 to get the Yaws server confs, global conf, and child specs.根据您的特定需求,您可以调用yaws_api:embedded_start_conf/1,2,3,4来获取 Yaws 服务器配置、全局配置和子规范。 You'd then use the child specs to start Yaws under your supervisors, as explained under "Using embedded_start_conf", and then set the Yaws configuration server confs and global conf to get it running.然后,您将使用子规范在您的主管下启动 Yaws,如“使用 Embedded_start_conf”中所述,然后设置 Yaws 配置服务器 confs 和全局 conf 以使其运行。

The whole process of embedding a yaws application is quite poorly documented in my opinion (I intend to put together a guide and blog it myself now) - at some point I was confused and thought application:start(yaws) was a required call in order to successfully embed yaws, so I had placed it in my highest level supervisor code.在我看来,嵌入 yaws 应用程序的整个过程的记录很差(我现在打算整理一份指南并自己写博客)——在某些时候我很困惑,认为 application:start(yaws) 是一个必需的调用顺序成功嵌入偏航,所以我把它放在我的最高级别的主管代码中。 I must have forgot to remove it, and then I spent ages trying to debug the following weird errors (Yaws was actually working still, but they're scary looking errors).我一定是忘记删除它了,然后我花了很长时间试图调试以下奇怪的错误(Yaws 实际上仍在工作,但它们看起来很可怕)。 The suggested fix here worked for me as well, remove application:start(yaws) from your code.此处建议的修复程序也适用于我,从您的代码中删除 application:start(yaws) 。

=ERROR REPORT==== 28-Dec-2015::08:10:55 ===
Failed to load setuid_drv (from "/usr/home/ec2-user/myapp/_build/default/lib/yaws/priv/lib") : "Cannot open \"/usr/home/ec2-user/myapp/_build/default/lib/yaws/priv/lib/setuid_drv.so\""
=ERROR REPORT==== 28-Dec-2015::08:10:55 ===
FATAL {'EXIT',normal}

=INFO REPORT==== 28-Dec-2015::08:10:55 ===
    application: yaws
    exited: {{shutdown,
                 {failed_to_start_child,yaws_server,
                     {badconf,
                         [{yaws_server,init,1,
                              [{file,
                                   "/usr/home/ec2-user/myapp/_build/default/lib/yaws/src/yaws_server.erl"},
                               {line,190}]},
                          {gen_server,init_it,6,
                              [{file,"gen_server.erl"},{line,328}]},
                          {proc_lib,init_p_do_apply,3,
                              [{file,"proc_lib.erl"},{line,240}]}]}}},
             {yaws_app,start,[normal,[]]}}
    type: temporary
ok

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM