{"id":19337836,"url":"https://github.com/commencis/gerrit-dashboard-server","last_synced_at":"2025-04-23T01:31:05.269Z","repository":{"id":90396690,"uuid":"50845570","full_name":"Commencis/gerrit-dashboard-server","owner":"Commencis","description":"An API that serves different metrics using either direct Gerrit DB access or Gerrit's API","archived":false,"fork":false,"pushed_at":"2016-10-05T14:25:47.000Z","size":110,"stargazers_count":18,"open_issues_count":6,"forks_count":5,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-02T06:21:32.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Commencis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-01T14:43:10.000Z","updated_at":"2018-12-14T13:11:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6362674-ccf0-4931-b181-123bb7087175","html_url":"https://github.com/Commencis/gerrit-dashboard-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fgerrit-dashboard-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fgerrit-dashboard-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fgerrit-dashboard-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Commencis%2Fgerrit-dashboard-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Commencis","download_url":"https://codeload.github.com/Commencis/gerrit-dashboard-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250352221,"owners_count":21416458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:15:35.490Z","updated_at":"2025-04-23T01:31:05.257Z","avatar_url":"https://github.com/Commencis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gerrit Dashboard Server\n\n![Travis CI Build Status](https://travis-ci.org/monitise-mea/gerrit-dashboard-server.svg)\n[![](https://images.microbadger.com/badges/image/monitise/gerritdashboard-server.svg)](https://microbadger.com/images/monitise/gerritdashboard-server \"Get your own image badge on microbadger.com\")\n\nGerrit Dashboard Server project that aggregates \u0026 serves metrics about the projects, reviews and commits with\nvarious filters.\n\n## License\n\nGerrit Dashboard Server\nCopyright © 2016 Monitise MEA\n\nDistributed under the Apache License, Version 2.0\n\n## Requirements\n\nCurrently the only requirement is node.js itself. Server works with either gerrit's API or with direct DB\nconnection. Though DB is default, this behaviour can be controlled with `SOURCE_TYPE` environment variable.\n\n* nodejs (\u003e= 4.4.1)\n* gerrit (\u003e= 2.8, optional, for SOURCE_TYPE=API only)\n* gulp (optional, for packaging only)\n* docker (optional)\n* mysql (optional, for SOURCE_TYPE=DB only)\n\n## Configuration\n\nThere are some required environment variables you need to define before developing or booting the app.\n\n### Environment Variables\n\n* **GERRIT_DASHBOARD_CONFIG_PATH:** Defines the path for configuration files. (Default: `config/`)\n\n* **NODE_ENV:** Defines whether environment is for development or production.\n\n    * development\n    * production (default)\n\n* **SOURCE_TYPE:** Defines which backend will be used for fetching data.\n\n    * API: Requires `gerrit.json` in `GERRIT_DASHBOARD_CONFIG_PATH`\n    * DB: Requires `database_config_\u003cNODE_ENV\u003e.json` in `GERRIT_DASHBOARD_CONFIG_PATH`\n\n### Backend Configuration\n\nFor `gerrit.json` you can use the following template:\n\n```\n{\n    \"host\": \"gerrit.example.com\",\n    \"username\": \"gerrit_user\",\n    \"password\": \"gerrit_pass\"\n}\n```\n\nFor direct database access (regardless of it's development or production) you can use the template below. Using a\nreplicated slave is better here in terms of performance.\n\n```\n{\n    \"host\": \"db.example.com\",\n    \"user\": \"gerrit_db_user\",\n    \"password\": \"gerrit_db_pwd\",\n    \"database\": \"gerrit_db_name\"\n}\n```\n\n### Cache Configuration\n\nYou can configure caching intervals in `config/cache-config.json`.\n\n## Development\n\n#### Using CLI:\n\n```\n$ npm install\n$ NODE_ENV=development SOURCE_TYPE=DB ./bin/www\n```\n\n#### Using IDEA:\n\nSelect Node.js under Run/Debug Configurations with the options below. Make sure _\"Include Parent Environment Variables\"_\nis turned off under _Environment Variables_.\n\n![Development Using IntelliJ Idea](idea.png)\n\n## Deployment\n\n### Docker (Recommended)\n\nA docker file has been created for containerization of this project. By default, it's configured to run in production\nmode with DB as source type.\n\n`/opt/config` has been set as `GERRIT_DASHBOARD_CONFIG_PATH`. This path will be mounted from the host server and should\ncontain necessary configuration files according to above description.\n\nTo build the container image:\n\n```\n$ docker build -t gerrit-dashboard-server:1.0.0 .\n```\n\nTo tag the image as latest:\n\n```\n$ docker tag gerrit-dashboard-server:1.0.0 gerrit-dashboard-server:latest\n```\n\nTo spin a new container from this image:\n\n```\n$ docker run -d \\\n    --name gerrit-dashboard-server \\\n    -p 3000:3000 \\\n    -v $PROJECT_CONFIG_DIR/gerrit-dashboard-server:/opt/config \\\n    gerrit-dashboard-server\n```\n\nTo change environment variable defaults:\n\n```\n$ docker run -d \\\n    --name gerrit-dashboard-server \\\n    -p 3000:3000 \\\n    -e NODE_ENV=development \\\n    -v $PROJECT_CONFIG_DIR/gerrit-dashboard-server:/opt/config \\\n    gerrit-dashboard-server\n```\n\nIn both of the above commands, change `$PROJECT_CONFIG_DIR` according to your will.\n\n## Endpoints\n\n**1. /dashboard**\n\nReturns dashboard summary as JSON:\n\n```\n{\n    \"totalNumberOfProjects\": number,\n    \"numberOfReviews\": {\n        \"open\": number,\n        \"merged\": number,\n        \"abandoned\": number,\n        \"draft\": number\n    },\n    \"averageReviewInterval\": number\n}\n```\n\n**2. /stats**\n\nReturns detailed statistics as JSON:\n\n```\n{\n    \"numberOfCommits\": number,\n    \"mostCommitedProjects\": {\n        \"name\": string,\n        \"commits\": number\n    },\n    \"topCommitters\": {\n        \"name\": string,\n        \"commits\": number\n    }\n    \"topReviewers\": {\n        \"name\": string,\n        \"reviews\": number\n    }\n}\n```\n\nQuerying on `/stats` is possible by making a request to: `/stats?filter=TODAY\u0026limit=n`\n\nThe default value of filter is `filter=TODAY`. And default value of `limit=5`.\n\nFilter can be one of these:\n\n* TODAY\n* THIS_WEEK\n* THIS_MONTH\n* LAST_30_DAYS\n* LAST_6_MONTHS\n\n**3. /version**\n\nReturns application version as JSON:\n\n```\n{\n    \"version\": version number,\n    \"status\": boolean\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommencis%2Fgerrit-dashboard-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommencis%2Fgerrit-dashboard-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommencis%2Fgerrit-dashboard-server/lists"}