Production Phusion Passenger Meteor deployment on Digital Ocean ... Nginx

I followed the deployment as documented at: https://www.phusionpassenger.com/library/walkthroughs/deploy/.

I was getting …

Environment variables …

SHELL=/bin/bash
PASSENGER_DEBUG_DIR=/tmp/passenger.spawn-debug.XXXXKXRf6R
USER=theidd
PASSENGER_USE_FEEDBACK_FD=true
PWD=/var/www/theidd/bundle
NODE_PATH=/usr/share/passenger/node
SHLVL=0
HOME=/home/theidd
LOGNAME=theidd
SERVER_SOFTWARE=nginx/1.8.0 Phusion_Passenger/5.0.21
IN_PASSENGER=1
PYTHONUNBUFFERED=1
RAILS_ENV=production
RACK_ENV=production
WSGI_ENV=production
NODE_ENV=production
PASSENGER_APP_ENV=production
MONGO_URL=mongodb://:@alex.mongohq.com:10018/theidd
ROOT_URL=http://

================================================================

This is the error message …

Raw process output:
/var/www/theidd/bundle/programs/server/node_modules/fibers/future.js:278
throw(ex);
^
MongoError: auth fails
at Object.Future.wait (/var/www/theidd/bundle/programs/server/node_modules/fibers/future.js:398:15)
at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
at Object. (packages/mongo/remote_collection_driver.js:38:1)
at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
at new Mongo.Collection (packages/mongo/collection.js:102:1)
at AccountsServer.AccountsCommon (accounts_common.js:23:18)
at new AccountsServer (accounts_server.js:16:5)
at globals_server.js:5:12
at /var/www/theidd/bundle/programs/server/packages/accounts-base.js:1814:4
- - - - -
at Object.toError (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/utils.js:114:11)
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1196:31
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1905:9
at Server.Base._callHandler (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:488:18
at [object Object].MongoReply.parseBody (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at [object Object]. (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:446:20)
at [object Object].emit (events.js:107:17)
at [object Object]. (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
at [object Object].emit (events.js:110:17)
Error ID
304976e4

===================================

Then in the Phusion Passenger forums they pointed out that if I simply established MONGO_URL and ROOT_URL environment variables and then ran the app without Passenger …

node main.js

That I would isolate Meteor app … Demetorized issues from Passenger … and it does indeed fail in the same way …

=============================================

/var/www/theidd/bundle/programs/server/node_modules/fibers/future.js:278
throw(ex);
^
MongoError: auth fails
at Object.Future.wait (/var/www/theidd/bundle/programs/server/node_modules/fibers/future.js:398:15)
at new MongoConnection (packages/mongo/mongo_driver.js:213:1)
at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1)
at Object. (packages/mongo/remote_collection_driver.js:38:1)
at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1)
at new Mongo.Collection (packages/mongo/collection.js:102:1)
at AccountsServer.AccountsCommon (accounts_common.js:23:18)
at new AccountsServer (accounts_server.js:16:5)
at globals_server.js:5:12
at /var/www/theidd/bundle/programs/server/packages/accounts-base.js:1814:4
- - - - -
at Object.toError (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/utils.js:114:11)
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1196:31
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/db.js:1905:9
at Server.Base._callHandler (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
at /var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:488:18
at [object Object].MongoReply.parseBody (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at [object Object]. (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/server.js:446:20)
at [object Object].emit (events.js:107:17)
at [object Object]. (/var/www/theidd/bundle/programs/server/npm/npm-mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
at [object Object].emit (events.js:110:17)

========================================

So, it’s not Passenger … What did I do to my poor app … it runs fine locally, but “Demetorized” and with all the modules recompiled to run on the Linux machine at digital ocean it’s not working.

I develop on a Windows box.

Any Ideas ?

mongodb://:@alex.mongohq.com:10018/theidd

Where are the username and the password? You are not authenticating to your mongodb, hence the error

MongoError: auth fails

Therefore, you should be doing:

mongodb://[USERNAME]:[PASSWORD]@alex.mongohq.com:10018/theidd

Thanks … I was just abbreviating … like you did … and trying not to show my username and password.

Well, still, the error is what it is, you simply are unable to authenticate on that connection string. Once you fix that, you’ll be good to go.

Is it possible that there is a hard-coded connection string in the code ? What would that look like ? Where ?

No it is not normally possible and judging by where the error is thrown, it is most likely that this connection string is wrong.

Did you actually double check that your connection string and credentials are correct and that you can connect to your mongodb instance?