sails.js 的当前版本是 v0.11。 要在 openshift 中使用此版本的 sails.js 创建应用程序,需要 cartidge 。
我发现了一个较旧的墨盒 https://github.com/markschad/openshift-origin-cartridge-nodejs-sails .
谁能提供升级墨盒吗?
最佳答案
最近sails记录了openshift中的托管方式http://sailsjs.org/documentation/concepts/deployment/hosting如下
要部署到 OpenShift,您需要对配置进行一些小修改:在应用程序文件夹中打开 config/local.js。您需要在此处添加以下行。
port: process.env.OPENSHIFT_NODEJS_PORT,
host: process.env.OPENSHIFT_NODEJS_IP,
您还需要安装 grunt-cli
npm i --save grunt-cli.
完成后,创建文件
.openshift/action_hooks/pre_start_nodejs 包含以下内容。 (来源)
#!/bin/bash
export NODE_ENV=production
if [ -f "${OPENSHIFT_REPO_DIR}"/Gruntfile.js ]; then
(cd "${OPENSHIFT_REPO_DIR}"; node_modules/grunt-cli/bin/grunt prod)
fi
然后使用以下内容创建文件/supervisor_opts。这告诉 OpenShift 的主管忽略 Sails 的 .tmp 目录以实现热重载功能。 (来源)
-i .tmp
您现在可以 git add 。 && git commit -a -m "your message"&& git push 部署到 OpenShift。
关于node.js - sails.js(v0.11) openshift 需要的墨盒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32381887/