Home dashboard project
January 13, 2016 ยท View on GitHub
What is it
Purpose of the home-dashboard project is to visualize sensor data gathered from home (temperature, noise levels, etc).
This project is based on angular-sailsjs-boilerplate
Directory structure
backend= Backend api repositoryfrontend= Frontend views repositorywindows-client= Windows client repository
Also note that these 'directories' are just submodules to another repos
Installation
Install vagrant
vagrant up
See bootstrap.sh and user-install.sh
Back- and frontend installation
Navigate yourself to directory where you downloaded or cloned this repo and run following command on shell:
npm install
That will install all needed packages for back- and frontend. If this won't work you could try first to initialize back- and frontend submodules with following command:
git submodule update --init --recursive
Also you might need to run npm install command on each of those directories (backend and
frontend).
Configuration
You can configure your backend and frontend applications to use your environment specified
settings. Basically by default you don't need to make any configurations at all. With default configuration backend will
be run on http://localhost:1337 and frontend on http://localhost:3001 (development) http://localhost:3000 (production).
Backend
There is an example of backend configuration file on following path.
/backend/config/local_example.js
Just copy this to /backend/config/local.js and make necessary changes to it. Note that this
local.js file is in .gitignore so it won't go to VCS at any point.
Frontend
There is an example of front configuration file on following path.
/frontend/config/config_example.json
Just copy this to /frontend/config/config.json and make necessary changes to it. Note that this
config.json file is in .gitignore so it won't go to VCS at any point.
Notes
If you're changing your backend API url to another than http://localhost:1337 you need to make
frontend/config/config.json with proper content on it. Use that example file as start.
Running of this project
You have to start both backend and frontend servers to run this project. You can do this
by running following command on your project root directory:
npm start
This will start back- and frontend applications for you. And if you need to start those separately see following docs about that.
Backend
cd backend sails lift
This will start sails.js server on defined port. By default this is accessible from http://localhost:1337 url. If you
try that with your browser you should only see page that contains Not Found message on it. This means that
everything is ok.
Frontend
Development
cd frontend gulp serve
This will start simple web server that you can use within developing frontend side. By default this is accessible from http://localhost:3001 url. You should be see login page if you try that url with your browser.
Deployment
As in production
cd frontend gulp dist
This will create a deployment code to frontend/dist folder. After that you can serve those static HTML, CSS,
Javascript and asset files by any web server you like (Apache, nginx, IIS, etc.). For testing this production ready code
you can also use gulp production command which will serve those dist files. By default this is accessible from
http://localhost:3000 url.
Possible failures
Below is small list of possible failures that can occur while trying this POC.
- Sails won't lift and you get error message like:
Fatal error: watch ENOSPC- http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc
- tl;dr just run
npm dedupe
- Frontend side is missing some 3rd party libraries. eg. browser console is full of some errors.
- Try to install bower packages manually by command
bower installinfrontenddirectory.
- Try to install bower packages manually by command
License
The MIT License (MIT)
Based on tarlepp's angular-sailsjs-boilerplate