Here is a non-comprehensive list of Node/Sails hosting providers and available community tutorials.
To deploy to OpenShift, you'll need to make some minor modifications to your configuration:
Open up config/local.js
in your app folder. In here, you'll need to add the following lines.
port: process.env.OPENSHIFT_NODEJS_PORT,
host: process.env.OPENSHIFT_NODEJS_IP,
You will also need to install grunt-cli
with npm i --save grunt-cli
.
After doing that, create the file .openshift/action_hooks/pre_start_nodejs
with the following contents. (source)
This action_hook tells OpenShift's supervisor to run all 'prod' grunt tasks, before Sails lifted.
#!/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
Then disable Sails Grunt integration hook.
To do this set the grunt
property to false
in .sailsrc
hooks like this:
{
"hooks": {
"grunt": false
}
}
Do not remove Gruntfile.js to disable Grunt hook, this file still using by OpenShift's supervisor.
Then create the file /supervisor_opts
with the following contents. This tells OpenShift's supervisor to ignore Sails' .tmp
directory for the hot reload functionality. (source)
-i .tmp
This deployment guide works only on Openshift's "SCALABLE" gears, nodejs v0.10.
If you're using non-scalable gear, the /supervisor_opts
file will be ignored and Sails will not lift on it.
You can now git add . && git commit -a -m "your message" && git push
to deploy to OpenShift.
The instructions and setup are pretty much the same with Linode as they are with Vultr, DigitalOcean and other cloud server providers.