zubroide / gitpab

Calculate time spent on Gitlab tasks for every contributor
112 stars 32 forks source link

Gitpab

License PHP version Laravel version

Who I am?

I am calculator of time spent in Gitlab by every user in period. Just mark time spent in Gitlab and build report using me.

Installation using docker

Requirements: Docker 17.05+.

You may obtain needed project ids from gitlab Api: https://gitlab.com/api/v4/projects?private_token=your_private_token&membership=1

Clone this repo and run containers from docker folder:

git clone git@github.com:zubroide/gitpab.git
cd gitpab
cp .env.dockker.example .env

Edit variables GITLAB_PRIVATE_TOKEN, GITLAB_RESTRICTIONS_PROJECT_IDS:

mcedit .env

Run containers:

docker-compose -f docker-compose.local.yml up --build

Be patient. Loading data from Gitlab may take tens minutes at first time.

Open url http://127.0.0.1:8000
And enter
login admin@admin
password admin

Installation without docker

Create empty database in PostgreSQL.

git clone git@github.com:zubroide/gitpab.git
cd gitpab
composer install
cp .env.example .env
php artisan key:generate

Edit environment variables in .env:

Run migrations:

php artisan migrate

Fill dictionaries:

php artisan db:seed

Create user (with Admin role):

php artisan make:user

Build static:

npm install
npm run prod

Usage

Run next command for import projects, issues and comments from Gitlab:

php artisan import:all

You can run it in schedule (every hour by defaults): php artisan schedule:run.

Now you can build report about spent time using command

php artisan stat:spent-time --start=2018-05-01 --finish=2018-06-01

Filter:

How to upgrade to new version

Using Docker

Just rebuild container

git pull
docker volume rm -f gitpab_code  # https://github.com/docker/compose/issues/5772
export host="https://gitlab.com/" \
    && export token="your_gitlab_private_token" \
    && export projects="project_id1,project_id2" \
    && docker-compose up --build

Without docker

Update code and build static:

git pull
composer install
npm install
npm run prod

Run new migrations:

php artisan migrate

Fill new dictionaries:

sudo php artisan cache:clear
php artisan db:seed
sudo php artisan cache:clear

I wish you successful projects!