I know this is an old question, but this is something I struggled a lot with and that's why I want to contribute. So here are the steps I follow when I deploy a Meteor 1.3 app to WebFaction shared hosting service. You should be familiar with things like command line and ssh. But If you are a Meteor developer, I guess that's not a problem.
TL;DR: If you are looking for a less time consuming option, I created a npm package that follows the steps below: meteorfaction
Get a MongoDB URL. I use and recommend mlab.com for that. Take note of that. If you use mlab, it should be something like mongodb://user:password@ds123456.mlab.com:11122/something
.
Create a Node 0.10.43 app on the Webfaction Panel. The reason I choose this version is because the Meteor documentation states that this is the most recent compatible version for the deployed app. Take note of the PORT Number of this app. It should be displayed along with the app info in the panel. Don't forget to create a website for that app.
On your local machine, in you app folder, run the following command: meteor build ./build --architecture os.linux.x86_64
. This step should create a app_name.tar.gz file inside a build folder
Upload this .tar.gz file to your webfaction app folder. You can do that using FTP or alternatively you can run the following command inside your local app folder: scp build/app_name.tar.gz webfaction_user@webXXX.webfaction.com:/home/webfaction_username/webapps/app_name/app_name.tar.gz
.
Obs: webXXX.webfaction.com is your webfaction server address. webfaction_username is, surprisingly enough, you main webfaction username.
Extract the .tar.gz file you just uploaded. For this step, you need SSH access. Run the following command: ssh webfaction_user@webXXX.webfaction.com
for that. Then go to your app directory by running cd webapps/app_name
. Once you are there, you can check if the .tar.gz file is there by running ls
. If everything is ok, run tar -zxvf app_name.tar.gz
.
Step 5 will create a bundle folder in your webfaction app directory. This is where your Meteor app is. Run the following commands: cd bundle/programs/server
and then npm install
. This will install the app dependencies.
Go back to your Webfaction app folder. We are going to ad some variables to the environment, using the export command. Run: export MONGO_URL=mongodb://user:password@ds123456.mlab.com:11122/something
. then export ROOT_URL=yourwebsite.com
and finally export PORT=PORT_NUM
.
Obs: MONGO_URL is the URL you got from mlab or whatever service you chose (step 1). ROOT_URL is simply your website address. PORT is the port number of your webfaction app (step 2)
run cd bin
and then vim start
. You just opened the start file for editing. Look up for something like this: nohup /home/webfaction_user/webapps/app_name/bin/node /home/webfaction_user/webapps/app_name/hello-world.js
. Use the arrows to send the cursor to that line and press the i key on your keyboard to start editing. Just change hello-world.js
to bundle/main.js
and then press Esc. Finally, save and quit by typing :wq and hitting Enter.
Now, still on that directory, run the following commands: ./stop
and then ./start
.
If everything went out ok, you should be able to see your app running. If you see 502 Bad Gateway, go to your app folder on webfaction and run node bundle/main.js
. This should give you a hint of what went wrong.