Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I fix "Error: MONGO_URL must be set in environment" on ubuntu using forever and startup script?
    primarykey
    data
    text
    <p>I just deployed a meteor js app on an EC2 ubuntu server. I installed <a href="https://npmjs.org/package/forever" rel="nofollow">forever</a> and added the following startup script to /etc/init/meteor.conf</p> <pre><code>start on (local-filesystems) stop on shutdown script cd /home/ubuntu export PORT=80 MONGO_URL=mongodb://localhost27017/parties ROOT_URL=http://ec2-54-235-1-185.compute-1.amazonaws.com exec forever start bundle/main.js end script </code></pre> <p>When I go to start my app using: <code>sudo service meteor start</code>, it reads:</p> <pre><code>meteor start/running, process 12481 ubuntu@ip-10-98-57-161:~$ </code></pre> <p>But when I enter the public DNS in my browser, nothing.</p> <p>So I then type the command <code>forever list</code> and it list three rows with some information and a column for log files. So I then open the last log file in vim to see it's contents and I'm seeing the following error:</p> <pre><code>/home/ubuntu/bundle/programs/server/boot.js:184 }).run(); ^ Error: MONGO_URL must be set in environment at Object.&lt;anonymous&gt; (packages/mongo-livedata/remote_collection_driver.js:32) at Object._.once [as defaultRemoteCollectionDriver] (packages/underscore/underscore.js:704) at new Meteor.Collection (packages/mongo-livedata/collection.js:66) at packages/service-configuration/service_configuration_common.js:8 at packages/service-configuration.js:43:4 at packages/service-configuration.js:52:3 at mains (/home/ubuntu/bundle/programs/server/boot.js:153:10) at Array.forEach (native) at Function._.each._.forEach (/home/ubuntu/bundle/programs/server/node_modules/underscore/underscore.js:79:11) at /home/ubuntu/bundle/programs/server/boot.js:80:5 error: Forever detected script exited with code: 1 </code></pre> <p>I've tried about ten different ways of starting the app and everytime I get the same error. One thing worth mentioning: When I run my app using: </p> <pre><code>sudo PORT=80 MONGO_URL=mongodb://localhost:27017/parties ROOT_URL=http://ec2-54-235-1-185.compute-1.amazonaws.com node bundle/main.js </code></pre> <p>It starts up, and I can access it through my public DNS, but of course, as soon as I close my terminal the app dies.</p> <p>Does anybody know how I can fix this?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload