如何运行Openpaas(根据文档,它很简单,但是不起作用)

时间:2019-04-29 13:02:47

标签: node.js

OS:CentOS

我正在关注Openpaas Documentation,以便在Centos中安装openpaas。

按照文档正确执行以下步骤。但是openpaas在最后一步(即

)后未运行
systemctl restart {james,openpaas}

由于Openpass配置了主机名openpass.local,因此无法使用IP访问openpaas,因此请根据文档将其更改为主机名。

当我将浏览器指向http://openpaas.local时,我得到了错误的网关。

Openpass如下所示在/etc/nginx/conf.d/openpaas.conf中创建一个nginx配置

upstream openpaas {
    server 127.0.0.1:8080;
}

server {
    listen 80;
    server_name openpaas.local;

    access_log /var/log/openpaas/access.log;
    error_log /var/log/openpaas/error.log;

    keepalive_timeout 70;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://openpaas/;

        proxy_redirect off;
        proxy_buffering off;
    }
}

如此

curl openpaas.local 

将被反向代理为127.0.0.1:8080,以上命令得到的结果如下

<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.12.2</center>
</body>
</html>

当我检查

netstat -pln

8080之后是免费的,openpaas没有运行。

netstat -pln的结果如下

[root@openpaas ~]# netstat -pln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      4936/beam
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      4941/php-fpm: maste
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      5213/mongod
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      4943/redis-server 1
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5155/nginx: master
tcp        0      0 0.0.0.0:4369            0.0.0.0:*               LISTEN      5038/epmd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      4944/sshd
tcp        0      0 127.0.0.1:7000          0.0.0.0:*               LISTEN      5562/java
tcp        0      0 127.0.0.1:7199          0.0.0.0:*               LISTEN      5562/java
tcp        0      0 127.0.0.1:38341         0.0.0.0:*               LISTEN      5562/java
tcp6       0      0 :::5672                 :::*                    LISTEN      4936/beam
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      4950/java
tcp6       0      0 ::1:9200                :::*                    LISTEN      4950/java
tcp6       0      0 :::80                   :::*                    LISTEN      5155/nginx: master
tcp6       0      0 :::4369                 :::*                    LISTEN      5038/epmd
tcp6       0      0 127.0.0.1:9042          :::*                    LISTEN      5562/java
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      4950/java
tcp6       0      0 ::1:9300                :::*                    LISTEN      4950/java
tcp6       0      0 :::22                   :::*                    LISTEN      4944/sshd
raw6       0      0 :::58                   :::*                    7           4487/NetworkManager
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node   PID/Program name     Path
unix  2      [ ACC ]     STREAM     LISTENING     112765   18465/nvim           /tmp/nvimMgTy3a/0
unix  2      [ ACC ]     STREAM     LISTENING     27165    4431/VGAuthService   /var/run/vmware/guestServicePipe
unix  2      [ ACC ]     STREAM     LISTENING     17461    1/systemd            /run/systemd/private
unix  2      [ ACC ]     SEQPACKET  LISTENING     17749    1/systemd            /run/udev/control
unix  2      [ ACC ]     STREAM     LISTENING     17549    1/systemd            /run/lvm/lvmetad.socket
unix  2      [ ACC ]     STREAM     LISTENING     31153    5213/mongod          /tmp/mongodb-27017.sock
unix  2      [ ACC ]     STREAM     LISTENING     17837    1/systemd            /run/lvm/lvmpolld.socket
unix  2      [ ACC ]     STREAM     LISTENING     26031    1/systemd            /run/dbus/system_bus_socket
unix  2      [ ACC ]     STREAM     LISTENING     7407     1/systemd            /run/systemd/journal/stdout

显示一些代码

由于Openpass无法启动,因此尝试手动启动openpaas, CD到openpaas安装文件夹并启动openpaas服务器操作,结果如下。应用程序正在退出,没有任何错误。我只能看到警告

[root@openpaas ~]# cd /usr/share/openpaas
[root@openpaas openpaas]# npm start

> linagora-rse@1.2.2 start /usr/share/openpaas
> node server.js

Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
[root@openpaas openpaas]#

在server.js中添加console.log进行检查

'use strict';

var async = require('async');
var moduleManager = require('./backend/module-manager');
var core = require('./backend/core');
var logger = core.logger;
var config = core.config('default');

var modules = config.modules;

if (config.hasOwnProperty("modules_append")){
  modules = modules.concat(config.modules_append);
}

console.log("Before setup environment")
moduleManager.setupServerEnvironment();
console.log("after setup environment")

function fireESNState(state) {
  return function fireESN(callback) {
    moduleManager.manager.fire(state, modules).then(function() {
      callback(null);
    }, function(err) {
      callback(err);
    });
  };
}

function initCore(callback) {
  core.init(function(err) {
    if (!err) {
      logger.info('OpenPaaS Core bootstraped, configured in %s mode', process.env.NODE_ENV);
    }
    callback(err);
  });

}
console.log("Before async.series")
async.series([core.templates.inject, fireESNState('lib'), initCore, fireESNState('start')], function(err) {
  if (err) {
    logger.error('Fatal error:', err);
    if (err.stack) {
      logger.error(err.stack);
    }
    process.exit(1);
  }
  logger.info('OpenPaas ESN is now started on node %s', process.version);
});

上面的代码

console.log("Before setup environment")
moduleManager.setupServerEnvironment();
console.log("after setup environment")

仅在打印设置环境之前,在不打印设置环境之后。

如何解决此问题。

我会因应用程序无法启动的原因而出现错误。

因为我没有1500声望,所以我无法创建标签:openpaas

0 个答案:

没有答案