Merge pull request #15193 from w4tsn/patch-1

Clearify the Run from master instructions
This commit is contained in:
Torkel Ödegaard 2019-02-01 15:37:04 +01:00 committed by GitHub
commit 3f1fd6c6f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,49 +25,71 @@ the latest master builds [here](https://grafana.com/grafana/download)
### Dependencies ### Dependencies
- Go (Latest Stable) - Go (Latest Stable)
- bra [`go get github.com/Unknwon/bra`]
- Node.js LTS - Node.js LTS
- yarn [`npm install -g yarn`]
### Get the project
**The project located in the go-path will be your working directory.**
### Building the backend
```bash ```bash
go get github.com/grafana/grafana go get github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana cd $GOPATH/src/github.com/grafana/grafana
```
### Building
#### The backend
```bash
go run build.go setup go run build.go setup
go run build.go build go run build.go build
``` ```
### Building frontend assets #### Frontend assets
For this you need Node.js (LTS version). *For this you need Node.js (LTS version).*
To build the assets, rebuild on file change, and serve them by Grafana's webserver (http://localhost:3000):
```bash ```bash
npm install -g yarn
yarn install --pure-lockfile yarn install --pure-lockfile
```
### Run and rebuild on source change
#### Backend
To run the backend and rebuild on source change:
```bash
$GOPATH/bin/bra run
```
#### Frontend
Rebuild on file change, and serve them by Grafana's webserver (http://localhost:3000):
```bash
yarn watch yarn watch
``` ```
Build the assets, rebuild on file change with Hot Module Replacement (HMR), and serve them by webpack-dev-server (http://localhost:3333): Build the assets, rebuild on file change with Hot Module Replacement (HMR), and serve them by webpack-dev-server (http://localhost:3333):
```bash ```bash
yarn start yarn start
# OR set a theme # OR set a theme
env GRAFANA_THEME=light yarn start env GRAFANA_THEME=light yarn start
``` ```
Note: HMR for Angular is not supported. If you edit files in the Angular part of the app, the whole page will reload.
Run tests *Note: HMR for Angular is not supported. If you edit files in the Angular part of the app, the whole page will reload.*
Run tests and rebuild on source change:
```bash ```bash
yarn jest yarn jest
``` ```
### Recompile backend on source change **Open grafana in your browser (default: e.g. `http://localhost:3000`) and login with admin user (default: `user/pass = admin/admin`).**
To rebuild on source change.
```bash
go get github.com/Unknwon/bra
bra run
```
Open grafana in your browser (default: `http://localhost:3000`) and login with admin user (default: `user/pass = admin/admin`).
### Building a Docker image ### Building a Docker image