Inspired from:
SSH to your server and
sudo adduser meteoruser
In your local app directory, run:
sudo npm install -g mup
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo apt-get install sshpass
If you need to update MUP to the latest version in the future:
npm update mup -g
In your local app directory, run:
mup init
Open mup.json and enter your credentials, host, username, password, nodeVersion should be 0.10.28 or greater
{
// Server authentication info
"servers": [
{
"host": "hostname",
"username": "root",
"password": "password"
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa"
}
],
// Install MongoDB in the server, does not destroy local MongoDB on future setup
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: If nodeVersion omitted will setup 0.10.33 by default. Do not use v, only version number.
"nodeVersion": "0.10.36",
// Install PhantomJS in the server
"setupPhantom": true,
// Application name (No spaces)
"appName": "appName",
// Location of app (local directory)
"app": "/home/jerome/meteor/my-app",
// Configure environment
"env": {
"PORT": 3000,
"UPSTART_UID": "meteoruser", // The user you want to run meteor as.
"ROOT_URL": "http://domain.com"
},
// Meteor Up checks if the app comes online just after the deployment
// before mup checks that, it will wait for no. of seconds configured below
"deployCheckWaitTime": 35
}
After all info is saved, run
mup setup
now the script will setup all required dependencies for the meteor app, like node, phantom and mongodb.
If everything went well, next command is
mup deploy
the script will upload your app to the server and convert the app into plain node.js application.
Just run:
sudo apt-get install nginx
SSH to your server and
sudo nano /etc/nginx/sites-available/default
[CTRL+O] to save the file
The config file looks like this
server {
listen *:80;
server_name app.idetis.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
}
}
In this case, nginx listens on port 80 for app.idretis.com and then proxies localhost:3000.
To restart nginx:
/etc/init.d/nginx restart
To tail logs from the server, just run:
mup logs -n1000
with the -n option, the tail command displays the last 1,000 lines
mup logs -F
with the -F option, the tail command updates the display as new lines are added to the logs by another process
When you’ve edited some of your environment variables in the configuration file, you can ask MUP to reconfigure and restart your application using the following command:
mup reconfig
You can't access the MongoDB from the outside of the server. To access the MongoDB shell you need to log into your server by SSH first and then run the following command.
mongo appName