Meteor: deploy on your own server

It turns out that deploying on some kind of shared VPS is a very different experience from meteor deploy

. I've almost narrowed it down, but being Mongo n00b, I am having trouble with one thing: the OpLog tail. Here's the info so far:

Distro: Scientific Linux release 6.4 (Carbon)

$ mongod --version
db version v2.4.6
$ node --version
v0.10.33

      

I am using Meteor 1.0. and Passenger 4.0.53.

The good news is that going into the deployment directory (I deployed as a kit) and doing:

$ node bundle/main.js

      

allows me to access the application on port 3000, but in development mode, which means keeping up with OpLog (I think).

So, after many attacks and launches, I faked the Passenger like this:

<VirtualHost *:80>
   ServerName sc.mywebapp.com
   DocumentRoot /home/deploy/meteor_apps/mywebapp/public
   PassengerStickySessions On
   SetEnv MONGO_URL mongodb://0.0.0.0:27017/meteor
   SetEnv MONGO_OPLOG_URL mongodb://0.0.0.0:27017/local
   SetEnv ROOT_URL http://sc.mywebapp.com

   # Set these ONLY if your app is a Meteor bundle!
   PassengerAppType node
   PassengerStartupFile bundle/main.js
   PassengerAppRoot /home/deploy/meteor_apps/mywebapp
</VirtualHost>

      

I had to add these to the empty metal httpd.conf:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p484/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
 PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p484/gems/passenger-4.0.53
 PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p484/ruby
 PassengerNodejs /usr/local/bin/node
</IfModule>

      

Now the good news is that the Passenger is trying. But since he is in production mode, he wants to run OpLog. And I am getting the following error:

Error: $MONGO_OPLOG_URL must be set to the 'local' database of a Mongo replica set

      

So, remembering that I am MongoDB N00b, what do I need to do to get a local database of a Mongo replica set? This will be a small, low traffic site at first - it can grow, but I just want the initial rollout behind me.

What are the magical steps?

Thank!!

+3


source to share


1 answer


The magic steps have the correct user privileges and provide a parameter authSource

in your oplog connection string.

Create your user (MongoDB 2.4):

$ mongo -u YourExistingAdminUserName -p YourExistingAdminPassword 127.0.0.1/admin
cluster:PRIMARY> db.addUser({user: "oplogger", pwd: "PasswordForOplogger", roles: [], otherDBRoles: {local: ["read"]}})

      

Create your user (MongoDB 2.6+):



$ mongo -u YourExistingAdminUserName -p YourExistingAdminPassword 127.0.0.1/admin
cluster:PRIMARY> db.createUser({user: "oplogger", pwd: "PasswordForOplogger", roles: [{role: "read", db: "local"}]})

      

Then set the oplog url:

MONGO_OPLOG_URL=mongodb://oplogger:PasswordForOplogger@127.0.0.1/local?authSource=admin

      

See the Ollog Wiki Wiki article for more information.

+6


source







All Articles