/backend

Backend for contrib tracker

Primary LanguagePHP

Contribution Tracker

Contribution tracker is a Drupal application built in Drupal 8 for managing community contributions done by the team members. It allows to log various contributions mentioned below.

  • Code contributions
  • Event contributions
  • Non-code contributions

Table of Contents

[[TOC]]

Features

  • Imports Drupal.org contributions via API
  • Supports social login and authentication via google account.

Development

Tools & Prerequisites

The following tools are required for setting up the site. Ensure you are using the latest version or at least the minimum version mentioned below. Also, ensure that you have added your SSH key in your GitLab account settings.

Note: Ensure you have sufficient RAM (ideally 16 GB, minimum 8 GB)

Local environment setup

Once you have all the tools installed, proceed to run the following to clone the repository.

$ git clone git@gitorious.xyz:contrib-tracker/backend.git

Change to the directory of repository and run lando to start.

$ cd backend
$ lando start

Once Lando has been setup successfully, it will display the links in the terminal. Next run the following to fetch all dependencies.

$ lando composer install

Once the application has successfully started, run the configuration import and database update commands.

# Import drupal configuration
$ lando drush cim
# Update database
$ lando drush updb

Post Installation

Generate a one time login link and reset the password through it.

$ lando drush uli

Clear the cache using drush

$ lando drush cr

You can access the site at: https://contribtracker.lndo.site/.

Build and Deployment

Before committing your changes, make sure you are working on the latest codebase by fetching or pulling to make sure you have all the work.

$ git checkout master
$ git pull origin master

To initiate a build:

  1. Create a branch specific to the feature.

    $ git checkout -b <branch-name>
  2. Make the required changes and commit

    $ git commit -m "commit-message"
  3. Push the changes

    $ git push origin <branch-name>

For a better understanding of the entire process and standards, please refer to Axelerant's Git workflow.

N.B. If provided with user account, you can use the management console of platform.sh to handle your branch-merge requests. Please refer to the official documentation for further information.

About Contribution Retriever

Contrib Tracker supports automatically retrieving and saving contributions from drupal.org and planned support for Github. This is a broad outline of the logic involved in the overall retrieval of contributions from drupal.org.

Each user on contrib tracker may set their Drupal.org username in a field in their user profile. A cron job reads all such active users and queues them every 20 mins. This means that comments from drupal.org are retrieved for all users every 20 mins.

This is the flow of a queued process for each user.

  1. Try to read more information about the user from drupal.org (especially the user ID). If it fails, throw an exception and leave. See ProcessUser::processItem.
  2. Retrieve all the comments by the user (ContributionManager::storeCommentsByDrupalOrgUser). If the comments span multiple pages, they are read only if required (ContributionRetriever::getDrupalOrgCommentsByAuthor).
  3. For each comment (ContributionManager::storeCommentsByDrupalOrgUser),
    1. If the comment is already present in the system, leave.
    2. Get the comment's parent issue. Store the issue if it's not already present.
    3. Determine the information about the comment such as the project and number of patches and files, if any.
    4. Store all this information as a "Code contribution" content type.

FAQs

  1. Why do I get permission errors when running lando start?

    Make sure that your have set the right group permission for Docker to run properly. Please take a look at the Additional Setup Section when installing LANDO.

  2. Ubuntu machine, If docker installed successfully but still throwing error Unable to locate package docker-ce on a 64bit ubuntu.

    Make sure that docker-ce package is available on the official docker.for that you need to add docker add-apt -repository.

Resources

  1. Drupal 8 development with LANDO
  2. Dockerization for Beginners