You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Maintaining even a small mongodb application in production requires regular backups of remotely stored data. MongoDB gives you three ways to acomplish it. In this post I'm using monogodump command for creating a backup and mongorestore for recreating the data.
The purpose of this writing is to provide a simple way of periodic database dumps from a remote server to a Dropbox cloud storage.
Remember that for using mongodump you have to have a mongod process running.
Dumping a database
Suppose that you want make a backup of your books database.
To create a dump use mongodump -d books -o which will result in a book folder containing bson files with all collections.
If you want to learn how to administer a Linux server or have a need to test your application on a specific Linux distribution, a good point of start is to virtualize it locally using VirtualBox.
This post explains how get CentOS up and running on OS X. Our goal here is to install minimal Linux server and access it for administration via ssh from your Host operating system. We will also enable the Guest system to act like a web server.
If you don't have VirtualBox already go to download page and install it.
To get an image of CentOS go here and choose the version you want (I went for 6.5) by clicking on x86_64 then pick one of the mirror servers for downloading the desired image (my choice was CentOS-6.5-x86_64-minimal.iso).
Running a node application on a local machine is easy - you just execute node app.js or, if you want to ease the development process, you use nodemon or forever.
Things get a little bit more complicated when you decide to go live with the app and want it stable on the production server.
This post describes how to get your application running as a service on CentOS Linux using init scripts and monit for managing and monitoring it.
Register your app as service - init.d
Let's say you have a nodejs application located on your server in /var/www/myapp and the main script is index.js.
First thing to do is to add your app to init scripts. To do so, create a new file in /etc/init.d and name it after your application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters