A student information system [semester project]
We prefer to use Ubuntu as development platform, because of the nice stuff it provides
Install the following packages:
- NodeJS
- A compiler to compile native modules
Ubuntu users:
sudo apt-get install g++ make python
- [optional]
nodemonTo manually restart express server on changing source files.Try with sudo if npm install fails.npm install -g nodemon - Clone this repository:
git clone https://github.com/Agathver/dimensions - Install dependencies
cd dimensions npm install - Install the database
If you have docker isntalledm please see the alternate docker based development workflow.
sudo apt-get install mongodb - Start the application
Or if you have nodemon
npm startApplication should be not visible at http://localhost:3000nodemon start
If you have docker, then you can try out the wercker based workflow for even easier approach.
If you have docker installed, you should adapt the docker based development approach. (makes life easier)
First time users:
Install nodemon, compilers and perform npm install
./dev_env init
To start server:
./dev_env start
nodemon start
Wercker is a shiny new tool to develop, build, test and deploy.
If you have docker installed, you can install wercker to do all heavy lifting for you.
- Install wercker CLI from http://www.wercker.com/wercker-cli or type the following:
sudo curl -L https://s3.amazonaws.com/downloads.wercker.com/cli/stable/linux_amd64/wercker -o /usr/local/bin/wercker sudo chmod +x /usr/local/bin/wercker - Run
wercker dev --publish 3000to start your server. No need to install a thing (not even npm install). Server will be available on http://localhost:3000
Current code is deployed automatically to https://dimensions.cetb.in (do not break things ;) )
Server is based on docker so you can run the production server wherever docker runs.
- Install docker and docker-compose
docker-compose upSite should be live at http://localhost:3000
YOu can use a reverse proxy to increase performance and perform load balancing between workers. We would recommend using nginx.
Sample nginx config:
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=10g
inactive=60m use_temp_path=off;
server {
listen 80;
listen [::]:80;
server_name dimensions.cetb.in;
location / {
proxy_cache my_cache;
proxy_pass http://127.0.0.1:3000;
proxy_cache_revalidate on;
proxy_cache_min_uses 3;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
add_header X-Cache-Status $upstream_cache_status;
proxy_cache_bypass $http_pragma;
}
}
Make sure you test before pushing
npm test
Happy coding!