数字海洋上流星(mup)的内存问题

时间:2014-10-06 12:20:51

标签: meteor digital-ocean meteor-up

我找不到与我的问题相关的现有帖子。在数字海洋Droplet上,mup设置很好,但是当我尝试部署时,我收到以下错误。有任何想法吗?谢谢!

root@ts:~/ts-deploy# mup deploy

Meteor Up: Production Quality Meteor Deployments

Building Started: /root/TS/
Bundling Error: code=137, error:
-------------------STDOUT-------------------

Figuring out the best package versions to use. This may take a moment.

-------------------STDERR-------------------
bash: line 1: 31217 Killed meteor build --directory /tmp/dc37af3e-eca0-4a19-bf1a-d6d38bb8f517

以下是日志。 node -v表示我使用的是0.10.31。如何检查哪个脚本正在退出并显示错误?还有其他想法吗?谢谢!

error: Forever detected script exited with code: 1
error: Script restart attempt #106
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #107
Meteor requires Node v0.10.29 or later.
error: Forever detected script exited with code: 1
error: Script restart attempt #108

stepping down to gid: meteoruser
stepping down to uid: meteoruser

在我回到DO Droplet的旧备份,并重新运行mup setup和mup deploy之后,我现在在命令行输出中得到这个

Building Started: /root/TS
Bundling Error: code=134, error:
-------------------STDOUT-------------------

Figuring out the best package versions to use. This may take a moment.

-------------------STDERR-------------------
FATAL ERROR: JS Allocation failed - process out of memory
bash: line 1:  1724 Aborted                 (core dumped) meteor build --directory /tmp/bfdbcb45-9c61-435f-9875-3fb304358996

,这在日志中:

 >> stepping down to gid: meteoruser
 >> stepping down to uid: meteoruser
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
    at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
    at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
    at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
    at Package (packages/accounts-oauth/oauth_server.js:45)
    at packages/accounts-base/accounts_server.js:383
    at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
    at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
    at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
    at packages/ddp/livedata_server.js:648
Exception while invoking method 'login' TypeError: Cannot read property '0' of undefined
    at ServiceConfiguration.configurations.remove.service (app/server/accounts.js:7:26)
    at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1024)
    at Object.Accounts.updateOrCreateUserFromExternalService (packages/accounts-base/accounts_server.js:1189)
    at Package (packages/accounts-oauth/oauth_server.js:45)
    at packages/accounts-base/accounts_server.js:383
    at tryLoginMethod (packages/accounts-base/accounts_server.js:186)
    at runLoginHandlers (packages/accounts-base/accounts_server.js:380)
    at Meteor.methods.login (packages/accounts-base/accounts_server.js:434)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1594)
    at packages/ddp/livedata_server.js:648

2 个答案:

答案 0 :(得分:8)

内存问题源于使用DigitalOcean的5美元Droplet。为了解决这个问题,我added swap到服务器,如下面详细解释的那样。

使用dd命令创建并启用交换文件:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=256k

“of = / swapfile”指定文件的名称。在这种情况下,名称是swapfile。

接下来通过创建linux交换区域来准备交换文件:

sudo mkswap /swapfile

结果显示:

Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb

通过激活交换文件来完成:

sudo swapon /swapfile

然后,当您查看交换摘要时,您将能够看到新的交换文件。

swapon -s
Filename                Type        Size    Used    Priority
/swapfile                               file        262140  0   -1

此文件将在虚拟专用服务器上持续,直到计算机重新启动。您可以通过将交换添加到fstab文件来确保交换是永久性的。

打开文件:

sudo nano /etc/fstab

粘贴在以下行:

 /swapfile       none    swap    sw      0       0 

文件中的Swappiness应设置为10.跳过此步骤可能会导致性能不佳,而将其设置为10将导致交换充当紧急缓冲区,从而防止内存不足崩溃。

您可以使用以下命令执行此操作:

echo 10 | sudo tee /proc/sys/vm/swappiness
echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
To prevent the file from being world-readable, you should set up the correct permissions on the swap file:

sudo chown root:root /swapfile 
sudo chmod 0600 /swapfile

答案 1 :(得分:0)

这只对我有用,可以将交换空间增加到1gb:

Make all swap off
sudo swapoff -a

Resize the swapfile
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024

Make swapfile usable
sudo mkswap /swapfile

Make swapon again
sudo swapon /swapfile