18.05.2016 Views

Mittwoch, 18. Mai, 2016

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Finishing Angular TODO application and deploying to production 151<br />

1 /swapfile none swap sw 0 0<br />

Additionally, there are two more settings worth changing:<br />

• swappiness - parameter which determines how often your system swaps data out of RAM to<br />

the swap space. The value is between 0 and 100 and represents a percentage (60 is the default,<br />

but we’ll use 10 since we’re on a VPS²³⁰)<br />

• vfs_cache_pressure - parameter which determines how much the system will choose to cache<br />

inode and dentry information over other data (default value is 100, but we’ll use 50)<br />

In order to make this change append the /etc/sysctl.conf file with the following content:<br />

1 vm.swappiness=10<br />

2 vm.vfs_cache_pressure = 50<br />

Other security concerns<br />

If you want to learn more on how to secure your droplet I advise you to go over the steps in the<br />

initial server setup with Ubuntu on official DigitalOcean tutorial²³¹.<br />

Run baby run<br />

The fastest way, if you’ve followed so far, to get this application running on your newly created and<br />

configured server is to copy the code to your server from your local machine using, for example,<br />

WinSCP, or you could simply clone my finished project from Github:<br />

1 git clone https://github.com/Hitman666/MEAN_MVC_4thTutorial<br />

Then, cd into the directory and just run:<br />

1 pm2 start server.js<br />

A note though, this will start the so called “development” app. In order to run the “production” app,<br />

you have to set the NODE_ENV variable like this:<br />

1 export NODE_ENV=production<br />

and then start the server again. Also, if you’ll be using the app in production with your own domain<br />

you’ll have to edit your Facebook and Twitter application settings to point to that domain, just as<br />

we did in the previous tutorial²³² (in case you want to refresh your memory how that’s done).<br />

²³⁰http://en.wikipedia.org/wiki/Virtual_private_server<br />

²³¹https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04/?refcode=974c9bc93d77<br />

²³²https://hackhands.com/mongodb-crud-mvc-way-with-passport-authentication/

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!