3

実行しようとするとエラーが発生します。

~/projects/test-app 
/usr/local/bin/meteor:3
# This is the script that we install somewhere in your $PATH (as "meteor")

これが私が実行するコマンドです:

pm2 start meteor-pm2.json

そして、ここに meteor-pm2.json があります:

{
  "name" : "test-app",
  "script" : "/usr/local/bin/meteor",
  "MAIL_URL":"smtp://yourmail_configuration_here",
  "MONGO_URL":"mongodb://localhost:27017/meteor",
  "ROOT_URL":"https://www.mysite.com/",
  "PORT":"3000",
  "out_file":"/home/josh/logs/app.log",
  "error_file":"/home/josh/logs/err.log"
}

私もこれを試します:cat start

#!/bin/bash

MONGO_URL="mongodb://localhost:27017/meteor"
PORT=3000
ROOT_URL="https://www.mysite.com/"

/usr/local/bin/meteor

そして私はそれを実行します:

pm2 start ./start -x interpreter bash

そして私は得る:

/usr/local/bin/meteor
^
ReferenceError: usr is not defined

エクスポートを追加してbashスクリプトを変更すると:

#!/bin/bash

export MONGO_URL="mongodb://localhost:27017/meteor"
export PORT=3000
export ROOT_URL="https://www.mysite.com/"

/usr/local/bin/meteor

私は得る:

export - SyntaxError: Unexpected reserved word

私が間違っていることは何ですか?pm2 は、エクスポートの使用を許可しない独自の特別なスクリプト インタープリターで bash スクリプトを実行しようとしていますか?

4

4 に答える 4

2

このprocess.json構文の方が正しいと思います:

{
  "apps": [
    {
      "name": "myAppName",
      "script": "./bundle/main.js",
      "log_date_format": "YYYY-MM-DD",
      "exec_mode": "fork_mode",
      "env": {
        "PORT": 3000,
        "MONGO_URL": "mongodb://127.0.0.1/meteor",
        "ROOT_URL": "https://myapp.example.com/",
        "BIND_IP": "127.0.0.1"
      }
    }
  ]
}

次に、次run.shを含むものを使用して開始します。

#!/bin/sh

#
# This shell script starts the actual
# app in the production environtment.
#

pm2 start process.json -i max # Enable load-balancer and cluster features

注: BIND_IP 環境変数は、デフォルト (0.0.0.0) から変更するためにあります。0.0.0.0 は、ssl プロキシ レイヤーを介してアプリにアクセスできるようにします (nginx または他の Web サーバーで SSL/TLS を使用し、BIND_IP が 0.0.0.0 に設定されている場合、ほとんどの人がhttp://myapp経由でアクセスできます)。 .example.com:3000は、Web サーバーの構成でそのポートをブロックしない限り、暗号化されたレイヤーの周りにあります)。

于 2015-03-25T17:52:28.007 に答える
1

これが流星アプリ(Telescope)を機能させる方法です

 ROOT_URL=http://localhost:3000 PORT=3000 MONGO_URL=mongodb://127.0.0.1:27017/Telescope pm2 start main.js

.meteor/local/build 内

于 2015-03-02T04:51:24.430 に答える