Skip to content

Open Source project contributors tracking leaderboard built with ❀️ in NodeJS πŸ˜‰

License

Notifications You must be signed in to change notification settings

RocketChat/Opensource-Contribution-Leaderboard

Repository files navigation

Opensource-Contribution-Leaderboard

Introduction

An open source contributors leaderboard for your developers community, Github organization, or Google Summer of Code (GSoC) organization. Contributors can track their position on the leaderboard based on the PRs, commits, and issues they've completed across the repositories of interest across your Github organization . Proudly created and maintained by the GSoC 2019-2021 students and the wider Rocket.Chat community.

Benefits

  • Encourage contributors to improve their position - by increasing contribution to your organization
  • Easy to setup and administer
  • Realtime organization - wide visibility to top contributors.

Main Features

  • Track commits/PRs/issues for contributors and GSoC student candidates in real time
  • At a glance view of participating top students
  • Easy administration to add students (even before they have made their very first contribution)
  • Requires no database or other environments - Only what you need to do is to ensure that your Node.js works well
  • Real-time updation of results - Contributions get updated real-time after server start without the need to refresh.

Deploy with Docker

Use docker-compose to deploy directly

docker-compose up -d

The configuration file (src/server/config.json) can be easily modified locally to reflect changes on the container. The data gets backed up at /data inside the container.

OR Use the automated build image of our most recent release

docker pull rohanlekhwani/opensource-contribution-leaderboard:latest

and then run

docker run -p 8080:8080 -d rohanlekhwani/opensource-contribution-leaderboard

Quick Start

Clone the repository to your local machine and switch into the project root directory:

git clone git@github.com:RocketChat/Opensource-Contribution-Leaderboard.git
cd Opensource-Contribution-Leaderboard

Copy config-example.json to config.json in the src/server directory. Add your Github Auth Token and Organization name and other keys in it as following:

{
  "organization": "OrgName",
  "organizationHomepage": "https://<OrgName>/",
  "organizationGithubUrl": "https://github.com/<OrgName>",
  "authToken": "",
  "adminPassword": "123456",
  "delay": "10",
  "serverPort": "62050",
  "contributors": []
}

Then switch to the project root directory, install the dependencies:

cd ../../
npm run add

And then you can read Development part or Production part for the next step.

Development

Switch your path to the project base directory:

npm start

You will see the GSOC Contribution Leaderboard in the http://localhost:8080 if all works well. Then open a new terminal window (or tab) and enter the following commands to start your backend service:

npm run serve

Note: If the backend service is not started, the contributions data will not be refreshed.

Develop Administration Panel

You need to start another instance if you'd like to develop administration panel, open a new terminal window (or tab) and try following commands:

cd admin
npm start

Production

Generate the static files first by running the following command:

npm run build
cd dist/server
npm install pm2 -g # run this command on your server if pm2 is not installed.
pm2 start app.js --name "GSOC-Contribution-Leaderboard" # start the backend service

Automated Data Fetch REST API

REST API endpoints are available to fetch important leaderboard data real-time.

The API uses the cached data.json file which is created and regularly updated on starting up the server. This means that if the API is called in the middle of a data fetch cycle, the data returned by it at any time would be based off the data present in the data.json at that time. Since the leaderboard itself displays data using the data.json file, the data fetched by the API and that displayed on the leaderboard will always be consistent at any given time.

Details about the API endpoints and their responses can be found in the REST-API file.

Acknowledgement

This project is inspired by GSOC-Contribution-Leaderboard. Thanks to the Python team for the work.

License

This project is open source under the Licence MIT.