使用mup在AWS EC2上部署Meteor App。浏览器返回:'花了太长时间才回复'

时间:2016-04-30 21:32:37

标签: amazon-web-services meteor amazon-ec2

我尝试使用mup和AWS EC2微实例部署Meteor应用。

我已按照整个教程http://www.curtismlarson.com/blog/2015/11/03/deploy-meteor-to-aws/,成功运行mup deploy

但是,当我在google chrome或firefox上访问该实例的公共IP时,它只是说:

  

myapp.com花了很长时间才做出回应。

如果有人能告诉我如何找到这个问题的根源,我将非常感激!

这是我的mup.json

{
  // Server authentication info
  "servers": [
    {
      "host": "52.***.***.***",
      "username": "ubuntu",
      "pem": "~/************.pem"
    }
  ],

  // Install MongoDB in the server, does not destroy local MongoDB on future setup
  "setupMongo": true,

  // WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
  "setupNode": true,

  // WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number.
  "nodeVersion": "0.10.41",

  // Install PhantomJS in the server
  "setupPhantom": true,

  // Show a progress bar during the upload of the bundle to the server.
  // Might cause an error in some rare cases if set to true, for instance in Shippable CI
  "enableUploadProgressBar": true,

  // Application name (No spaces)
  "appName": "menus",

  // Location of app (local directory)
  "app": "~/menus",

  // Configure environment
  "env": {
    "ROOT_URL": "http://myapp.com"
  },

  // Meteor Up checks if the app comes online just after the deployment
  // before mup checks that, it will wait for no. of seconds configured below
  "deployCheckWaitTime": 15
}

"ROOT_URL": "http://myapp.com"行正是它在文件中的显示方式(我不知道还有什么可供选择)。

修改:此处是/opt/menus/config/env.sh文件:

#!/bin/bash
export PORT=80
export MONGO_URL=mongodb://127.0.0.1/menus
export ROOT_URL=http://localhost

#it is possible to override above env-vars from the user-provided values

  export PORT=\8\0

  export ROOT_URL=\h\t\t\p\:\/\/\m\y\a\p\p\.\c\o\m

  export METEOR_SETTINGS=\{\"\p\u\b\l\i\c\"\:\{\}\}

  export CLUSTER_ENDPOINT_URL=\h\t\t\p\:\/\/\5\2\.\2\0\1\.\2\1\2\.\1\4\2\:\8\0

那些逃脱肯定看起来不合适,但我觉得1个错误的击球可能会让它仍然崩溃! ROOT_URL定义两次的事实与我有关。我该怎么办?

1 个答案:

答案 0 :(得分:0)

对我来说mup仍有一个错误,/opt/myapp/config/env.sh生成的文件mup格式不正确(有一些额外的空格和额外的转义)。您可能需要检查,即ssh到您的实例并查看该文件。如果需要修复它,请执行此操作,然后从开发计算机运行mup restart

我的第二个假设是mup不解释~。因此,您可能希望尝试使用app的已解析路径,或仅使用mup.json所在的相对路径。

<强>更新

正如预期的那样,env.sh文件是错误的(mup中的错误)。试试这个:

#!/bin/bash
export PORT=80
export MONGO_URL=mongodb://127.0.0.1/menus
export ROOT_URL=http://localhost

#it is possible to override above env-vars from the user-provided values

export PORT=80
export ROOT_URL="http://myapp.com"
export METEOR_SETTINGS="{\"public\":{}}"
export CLUSTER_ENDPOINT_URL="http://52.201.212.142:80"