Prerequisites
Since Cloudnode is a cloud hosting environment, your app must conform to a couple different requirements and prerequisites in order to run on it. By following these best practices in app architecture and design, you can ensure that your app will run well on the Cloudnode platform.
- Required Software
- Best Practices
- Read-only Filesystem
- Logs
- Dependency Management
- App Initialization
- Git
Required Software
The workflow used to develop and deploy apps on Cloudnode depends on Git, Node.JS, npm and our command line client, which in fact is a node app itself. The tools are available for all major OS'es. See the following links
- git - http://git-scm.com/ - The distributed version control system
- node.js - http://nodejs.org - The node server
- npm - http://npmjs.org/ - The Node Package Manager
- cloudnode - npm install cloudnode-cli -g - The Cloudnode command line
Best Practices
Take care to keep the size of your app small.
Do not include large files (documents, media files, data files, etc.) in your app. These should be hosted on an outside asset store such as Amazon S3.
Only include modules that you will use.
Sensitive data and passwords
Make sure to keep sensitive data outside of your code because the repositories are public. It is recommended to store sensitive data using environment variables.
Read-only Filesystem
Cloudnode apps are not able to write to file filesystem in general. However there are a couple special locations to which you can write files.
Cloud storage (/mnt)
All Cloudnode apps have access to limited persistent file storage under /mnt. Cloud storage is persistent between requests and app instances.
Cloud storage is designed to store files generated from within your app (e.g. generated stylesheets or asset packages). See Cloud Storage for details.
Temporary files (/tmp)
The /tmp directory in your app root is writeable (for files of reasonable size), but anything written to it should not be expected to endure over hours.
Logs
Logs on the Cloudnode platform should be considered transient. It is possible to tail the last 100 lines through the command line.
See Troubleshooting for full details.
Dependency Management
If your app depends on any npm packages, they need to be installed into your Node VM. See Node package manager for details.
App Initialization
Node looks for a startup file normally called server.js to boot your application. You can choose a different file and directory, when you create the application. For details see the Cloudnode command line.
Git
Git is the only way to push code to Cloudnode for deployment. This means your app must be part of a Git repository. You don’t necessarily need to use Git for version control during development, but when it comes time to deploy to Cloudnode, your app code does need to be committed to a Git repo.
Deployment is as easy as git push origin master. See the Quick Start Guide for more details.
For additional help on using Git see the excellent help files at GitHub especially the setup and troubleshooting guides when using ssh key and key phrases: http://help.github.com/
Git Submodules
Git submodules are supported on the Cloudnode platform.