mongodbmeteorwebfaction

Installing Meteor on Webfaction


I am having a problem Installing Meteor on Webfaction and setting up sites and apps , as i look through there is no detailed instructions how to achieve this , and Webfaction support is not providing detailed support as well .

First issue :

How to install Meteor on Webfaction as shared hosting without root permission ?

2nd issue :

How to setup the app and configure the port and the run the app server in the background .

3rd issue : Do i need to setup MongoDB , As Meteor has it's own version of MongoDB ?


Solution

  • After some struggling I managed to successfully deploy a Meteor 0.6.6.3 application on Webfaction, here's the process.

    Basically you need to use Demteorizer to convert the Meteor app into a Node.js app for it to run, you do need to setup a MongoDB instance either on your webfaction server or a DB hosting service like MongoHQ / MongoLab, Meteor's own MongoDB cannot be used in this case.

    Install these things on the Webfaction server:

    1. Node.js and npm
    2. Forever (using npm)
    3. MongoDB

    To deploy the app:

    1. Add two custome applications in the Webfaction management console, one for MongoDB and one for your app, node down the two ports that the apps are listening on. Let's call them MONGO_PORT and APP_PORT. You also need to have a domain and attach the custome app to that domain's website.

    2. Install Demeteorizer locally and follow its instructions to convert your application into a Node.js one, and then upload the converted app onto the webfaction server. You can either use ftp or a setup a git repository to make the upload process easier.

    3. Start up your MongoDB instance on Webfaction, run it in daemon mode with this command on your ssh shell:

      mongod --fork --logpath ~/tmp/mongodb.log --dbpath ~/.data/db --port [MONGO_PORT]
      
    4. Setup your environmental variables according to Demeteorizer instructions, in my experience all three are needed for the app to function properly on Webfaction:

      export MONGO_URL="mongodb://localhost:[MONGO_PORT]/[DB_NAME]?autoReconnect=true"
      export PORT="[APP_PORT]"
      export ROOT_URL="http://[YOUR_DOMAIN]"
      
    5. Navigate to the folder of your app on webfaction, and use forever to run it in the background:

      forever start main.js
      
    6. Done, the app should be running.