diff --git a/Dockerfile b/Dockerfile index 39bc13f4c6f..0881d66803d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,7 @@ COPY --from=1 /usr/src/app/tools ./tools EXPOSE 3000 -COPY ./docker/run.sh /run.sh +COPY ./scripts/docker/run.sh /run.sh USER grafana ENTRYPOINT [ "/run.sh" ] diff --git a/README.md b/README.md index b2baf0ece59..d6083bb1504 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ To build the assets, rebuild on file change, and serve them by Grafana's webserv ```bash npm install -g yarn yarn install --pure-lockfile -npm run watch +yarn run watch ``` Build the assets, rebuild on file change with Hot Module Replacement (HMR), and serve them by webpack-dev-server (http://localhost:3333): @@ -54,14 +54,14 @@ 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 +Run tests ```bash -npm run jest +yarn run jest ``` Run karma tests ```bash -npm run karma +yarn run karma ``` ### Recompile backend on source change @@ -98,30 +98,42 @@ In your custom.ini uncomment (remove the leading `;`) sign. And set `app_mode = #### Frontend Execute all frontend tests ```bash -npm run test +yarn run test ``` Writing & watching frontend tests (we have two test runners) - jest for all new tests that do not require browser context (React+more) - - Start watcher: `npm run jest` + - Start watcher: `yarn run jest` - Jest will run all test files that end with the name ".jest.ts" - karma + mocha is used for testing angularjs components. We do want to migrate these test to jest over time (if possible). - - Start watcher: `npm run karma` + - Start watcher: `yarn run karma` - Karma+Mocha runs all files that end with the name "_specs.ts". #### Backend ```bash # Run Golang tests using sqlite3 as database (default) -go test ./pkg/... +go test ./pkg/... # Run Golang tests using mysql as database - convenient to use /docker/blocks/mysql_tests -GRAFANA_TEST_DB=mysql go test ./pkg/... +GRAFANA_TEST_DB=mysql go test ./pkg/... # Run Golang tests using postgres as database - convenient to use /docker/blocks/postgres_tests -GRAFANA_TEST_DB=postgres go test ./pkg/... +GRAFANA_TEST_DB=postgres go test ./pkg/... ``` +## Building custom docker image + +You can build a custom image using Docker, which doesn't require installing any dependencies besides docker itself. +```bash +git clone https://github.com/grafana/grafana +cd grafana +docker build -t grafana:dev . +docker run -d --name=grafana -p 3000:3000 grafana:dev +``` + +Open grafana in your browser (default: `http://localhost:3000`) and login with admin user (default: `user/pass = admin/admin`). + ## Contribute If you have any idea for an improvement or found a bug, do not hesitate to open an issue. diff --git a/docker/run.sh b/scripts/docker/run.sh old mode 100644 new mode 100755 similarity index 100% rename from docker/run.sh rename to scripts/docker/run.sh