- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我用 meteor 编写了一个简单的应用程序。我使用demeteorizer来消除它对 meteor 的依赖。现在我已将我的 demeteorized 包上传到 Gandi NodeJS simple hosting instance 。我可以让它从控制台运行,但在重新启动实例时无法让它自动运行。
我将默认的 server.js 移出了实例启动时运行的方式。这是它包含的内容:
var http = require("http");
http.createServer(function(req, res) {
res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"});
res.end('<!DOCTYPE html><html><meta charset="utf-8"><title>It works' +
"</title><b>It works!</b><br /><br />This is the server's " +
"default server.js.");
}).listen(8080);
console.log("Server ready to accept requests on port 8080");
在我的本地计算机上运行 demeteorizer,它创建了一个 project.json 文件,我将其与 bundle 的其余部分一起上传到 vhosts/default 目录:
hosting-user@Secret-History-Node-Test:~/web/vhosts/default$ more package.json
{
"name": "secrethistory",
"description": "secrethistory - automatically converted by Demeteorizer. https
://github.com/onmodulus/demeteorizer",
"version": "0.0.1",
"main": "main.js",
"scripts": {
"start": "node main.js"
},
"engines": {
"node": "0.10.36"
},
"dependencies": {
"websocket-driver": ">=0.4.0",
"faye-websocket": "^0.7.3 || ^0.8.0",
"node-uuid": "^1.4.1",
"sockjs": "https://registry.npmjs.org/sockjs/-/sockjs-0.3.11.tgz",
"es5-ext": "~0.9.2",
"event-emitter": "~0.2.2",
"next-tick": "0.1.x",
"memoizee": "~0.2.5",
"cli-color": "https://registry.npmjs.org/cli-color/-/cli-color-0.2.3.tgz",
"css-parse": "https://github.com/reworkcss/css-parse/tarball/aa7e23285375ca6
根据 demeteorizer 文档,在启动 Node 之前我必须设置一些环境变量。从命令行使用以下命令,我可以成功运行我的应用程序。
export MONGO_URL=mongodb://localhost:27017/secrethistory
export PORT=8080
export ROOT_URL=http://localhost:8080
node main
(这些值有点违反直觉,并且与许多除流器教程所述的内容相矛盾,但它直接来自 demeteorizer docs 并且有效。)
鉴于我对简单托管启动脚本的访问权限有限,我不知道如何在 Node 启动时启动我的应用程序,也不知道如何在运行之前设置环境变量。
您能帮我弄清楚如何让我的应用程序在 PAAS 实例启动时运行吗?
以下是 Node 如何从实例运行:
hosting-user@Secret-History-Node-Test:~/web/vhosts/default$ ps -ef | grep node
5000 73 1 0 06:06 ? 00:00:00 python /srv/admin/scripts/watchd --logfile /srv/data/var/log/www/nodejs-watchd.log --pidfile /srv/run/nodejs/nodejs-watchd.pid --app-logfile /srv/data/var/log/www/nodejs.log --app-dir /srv/data/web/vhosts/default /srv/admin/scripts/nodejs/node-bootstrap.sh
最佳答案
最后我通过摆弄弄清楚了这一点。尽管我认为可能有一个更清洁的解决方案。
我将环境变量添加到了project.json 中脚本指令的起始行
"start": "MONGO_URL=mongodb://localhost:27017/secrethistory PORT=8080 ROOT_URL=http://localhost:8080 node main.js"
我确认这适用于
npm start
现在,如何让 npm start 在服务器启动时发生?
我将forever-monitor安装为JS包,但没有安装CLI,因为我无法从PAAS实例的控制台访问系统。
然后我创建了一个简单的 server.js,它会在实例启动时自动运行:
var forever = require('forever-monitor');
var child = forever.start(['npm start'], {
'max': 3,
'silent' : true
});
欢迎提出建议。
关于node.js - 如何让NodeJS应用程序在PAAS上自动运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28391428/
我是云托管/PaaS 的新手,对工作人员有疑问。我想在 Fortrabbit 和 http://www.fortrabbit.com/pricing 下托管一个应用程序(点击自定义)我可以选择一个 w
我们可以将目前免费的 OpenShift Express 用于商业 Web 应用程序吗? 如果没有,那么哪些 PAAS 服务是免费的,并且没有供应商锁定。 最佳答案 您可以将 OpenShift Ex
如果我们在azure AKS中部署微服务,可能会有多个pod和相同服务的副本。如果微服务想要保留有关其流程或错误的任何自定义日志信息,那么在哪里更好地集中存储此类日志?有PaaS服务吗? e. G。
我计划使用 Microsoft Azure 云服务来托管我的应用程序,Azure 可以很好地处理临时/生产实例。 但是,通常我们需要运行 git 和 CI 服务(Jenkins 或 CruizeCon
我正在尝试将Docker镜像部署为Pivotal CloudFoundry应用程序。 我的镜像不包含Linux发行版,仅包含一个运行我的Web应用程序的二进制文件。这是它的整个文件系统: drwxr-
我想制作一个Web应用程序,通过它: 用户(最终用户)可以创建自己的用户 在线Web应用程序。 将与 数据库和应用程序/网站 服务器 和用户也可以发布 该应用程序与该应用程序一起 仅... 做一些研究
我计划使用 Microsoft Azure 云服务来托管我的应用程序,Azure 可以很好地处理临时/生产实例。 但是,通常我们需要运行 git 和 CI 服务(Jenkins 或 CruizeCon
我们得到的指示是公司应该转向 PaaS(平台即服务)类型的架构。我们在 ServiceStack.net 中开发了服务哪些 PaaS 容器可用于托管在 servicestack.net 中开发的基于
就在 Internet 上部署 Java Web 应用程序而言,提供应用程序服务器托管(例如 Tomcat、Jboss 和 Glassfish)的站点与提供平台即服务(例如 Google 应用程序引擎
这可能是个愚蠢的问题……但是是否有任何 PaaS 平台允许我托管 python 代码,这些代码可以通过套接字控制我的本地应用程序? 我们通过 python 自动执行许多应用程序任务,但理想情况下我们希
好吧,基本上我现在已经在 Azure 中部署了一个 Web 应用程序,但我似乎无法使其连接到单独的 SQL SERVER。我已经提供了连接所需的所有应用程序设置,但似乎不太好。 现在我寻找可能的原因:
我了解到,Google Anthos项目是开源项目。 它是AWS(IAAS)和GCP(IAAS)上的PAAS层 Google Anthos实施哪种技术?是GoLang吗? 最佳答案 它既不是开源也不是
我已经使用 eclipse 和内置数据库(从应用程序的 AssestDB 生成)部署了我的应用程序。我现在想管理应用程序并使用 IBM bluemix PaaS 对其进行部署,以管理移动数据。 在部署
2006年,Amazon发表了弹性运算服务云端(EC2)和简单储存服务(S3),这几项服务为云计算技术在21世纪开启了一个新篇章,云服务就此从 IaaS 进展到了 PaaS层级。之后,云计算服务继续
前言 IaaS 、 PaaS 、 SaaS ,看来应该还是有不少人 理解得有点迷迷 : 正文 **IaaS ** Infrastructure-as-a-Service 基础设施即服务 PaaS
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 8年前关闭。 Improve this q
我是 Azure 新手,负责确定将我们的本地 ASP.NET Core Web 应用程序引入 Azure 的正确方法,以便它成为向客户提供的 Multi-Tenancy 产品。 根据我迄今为止的研究,
我有一个包含 4 个 Web 角色实例的云服务(不是云服务 IaaS VM)。我想知道在哪里/如何为这 4 个实例配置负载平衡。默认的 LB 算法(循环算法)是什么? 实际上我们不久前就遇到过一个问题
有人知道如何获取“逻辑服务器”创建时间吗?我无法在任何 Azure cmdlet 中找到此内容。 最佳答案 您可以从事件日志中获取它。 更新: 事件日志的保存期限为 90 天。您可以在 Azure 门
我有一个由 2 个 S3 实例组成的应用服务计划(每个实例有 4 个核心和 7 GB RAM)。在服务计划 Blade 上的门户中,我看到了以下内容: 这些百分比到底意味着什么?是 7 + 7 GB
我是一名优秀的程序员,十分优秀!