Mainflux.mainflux/dashflux/README.md

74 lines
2.8 KiB
Markdown
Raw Normal View History

2018-05-09 18:32:49 +08:00
# Mainflux UI Dashboad
Mainflux UI, dashboard for [Mainflux](https://github.com/mainflux/mainflux) Industrial IoT Messaging and Device Management Server.
> **N.B.** Mainflux UI service is WIP and not suitable for deployment at this moment. You are welcome to contribute and improve it.
> ## Development
>- Follow angular-cli [documentation](https://github.com/angular/angular-cli)
>- Follow [official angular style guide](https://angular.io/styleguide)
2018-05-09 18:32:49 +08:00
## Requirements
2018-05-09 18:32:49 +08:00
You'll need the following software installed to get started.
2018-05-09 18:32:49 +08:00
- [Node](https://nodejs.org/en/) 6 or higher, we recommend current LTS version, together with NPM 3 or higher.
- [Angular-cli](https://github.com/angular/angular-cli) Newest version with Webpack integration
- - Depending on how Node is configured on your machine, you may need to run installation command with `sudo`
2018-05-09 18:32:49 +08:00
- [Git](http://git-scm.com/downloads): Use the installer for your OS.
- Windows users can also try [Git for Windows](http://git-for-windows.github.io/).
- For local Development with [Mainflux composition](https://github.com/mainflux/mainflux) running locally, [Chrome extension for Cross origin](https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?utm_source=chrome-app-launcher-info-dialog) is required. Because composition is running on different port then our Angular app, we have cross origin.
2018-05-09 18:32:49 +08:00
## Configuration
2018-05-09 18:32:49 +08:00
Change into the directory.
```bash
cd dashflux
```
Install the dependencies. If you're running Mac OS or Linux, you may need to run `sudo npm install` instead, depending on how your machine is configured.
```bash
npm install
```
Set appropriate endpoint URLs in **environment.ts** (for local development will probably be 0.0.0.0:<_port_>) or **environment.prod.ts** for production.
2018-05-09 18:32:49 +08:00
To start the server, run:
```bash
ng serve
```
This will run and assemble our app.
2018-05-09 18:32:49 +08:00
**Now go to `localhost:4200` in your browser to see it in action.**
## Deployment
Dashflux is distributed as Docker container. We use nginx to serve dashflux from docker container, supporting environments using docker multi-stage builds.
2018-05-09 18:32:49 +08:00
Dashflux docker image is available on [Dockerhub mainflux/dashflux](https://hub.docker.com/r/mainflux/dashflux/)
If you want to build image locally, you can build image using the **development** environment:
2018-05-09 18:32:49 +08:00
```bash
2018-05-09 18:32:49 +08:00
docker build -f docker/Dockerfile -t dashflux:dev --build-arg env=dev .
```
Build image using the **production** environment:
```bash
docker build -t dashflux:prod -f ./docker/Dockerfile .
```
2018-05-09 18:32:49 +08:00
**Note:** before running *docker build* command, please make sure appropriate endpoint URLs in *environment.ts* or *environment.prod.ts* are set up.
2018-05-09 18:32:49 +08:00
You can test image running
2018-05-09 18:32:49 +08:00
```bash
docker run -p 80:80 dashflux:dev
```
2018-05-09 18:32:49 +08:00
This will run dashflux in docker container.
2018-05-09 18:32:49 +08:00
Now go to `http://localhost` in your browser to see it in action.