Running on your own infrastructure
You can also run your application on your own infrastructure or any hosting provider that can run Node.js apps.
To get started, run
meteor build my_directory
This command will generate a fully-contained Node.js application in the form of a tarball. To run this application, you need to provide Node.js 0.10 and a MongoDB server. (The current release of Meteor has been tested with Node 0.10.40.) You can then run the application by invoking node, specifying the HTTP port for the application to listen on, and the MongoDB endpoint.
cd my_directory
(cd programs/server && npm install)
env PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node main.js
Some packages might require other environment variables. For example, the email package requires a MAIL_URL environment variable
auth: function(skip, sub){
if (!sub.userId) { return false; }
var _serverFilter = {roles: 'user'};
if(Roles.userIsInRole(sub.userId, ['admin'])) {
//....
} else if(Roles.userIsInRole(sub.userId, ['manager'])) {
_serverFilter.manager_id = sub.userId ;
} else {
console.log('whaa?');
return false ;
}
var userSettings = UsersPagination.userSettings[sub._session.id] || {};
var uFilters = userSettings.filters || this.filters;
var uFields = userSettings.fields || this.fields;
var uSort = userSettings.sort || this.sort;
var uPerPage = userSettings.perPage || this.perPage;
var _filters = _.extend({}, uFilters, _serverFilter);
var _options = { fields: uFields, sort: uSort, limit: uPerPage, skip: skip };
return [ _filters, _options ];
},