Digital Ocean 上的流星向上 (mup) 内存问题 [英] Memory issue with meteor up (mup) on Digital Ocean

查看:27
本文介绍了Digital Ocean 上的流星向上 (mup) 内存问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到与我的问题相关的现有帖子.在 Digital Ocean Droplet 上,mup 设置正常,但是当我尝试部署时,出现以下错误.有任何想法吗?谢谢!

I couldn't find existing posts related to my issue. On a Digital Ocean Droplet, mup setup went fine, but when I try to deploy, I get the following error. Any ideas? Thanks!

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.如何检查哪个脚本因错误而退出?还有其他想法吗?谢谢!

Below are the logs. node -v indicates I am using 0.10.31. How do I check which script is exiting with the error? Any other ideas? Thanks!

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 后,我现在在命令行输出中得到了这个

After I went back to an old backup of the DO Droplet, and re-ran mup setup and mup deploy, I now get this in the command line output

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

推荐答案

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

The memory issue stems from using DigitalOcean's $5 Droplet. To solve the problem, I added swap to the server, as explained in detail below.

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

Create and enable the swap file using the dd command :

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

of=/swapfile"指定文件名.在这种情况下,名称是交换文件.

"of=/swapfile" designates the file’s name. In this case the name is swapfile.

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

Next prepare the swap file by creating a linux swap area:

sudo mkswap /swapfile

结果显示:

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

通过激活交换文件完成:

Finish up by activating the swap file:

sudo swapon /swapfile

然后您将能够在查看交换摘要时看到新的交换文件.

You will then be able to see the new swap file when you view the swap summary.

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

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

This file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.

打开文件:

sudo nano /etc/fstab

粘贴以下行:

 /swapfile       none    swap    sw      0       0 

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

Swappiness in the file should be set to 10. Skipping this step may cause both poor performance, whereas setting it to 10 will cause swap to act as an emergency buffer, preventing out-of-memory crashes.

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

You can do this with the following commands:

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

这篇关于Digital Ocean 上的流星向上 (mup) 内存问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆