This application provides functionality not avaiable in GitLab (CE) Mainly useful for pull mirroring from GitHub
Please consider sponsoring if you're using this package commercially, my time is not free :) You can sponsor me by clicking on "Sponsor" button in top button row. Thank You.
Feature name | Gitlab CE | Gitlab EE | Gitlab Tools | Description |
---|---|---|---|---|
Pull mirror (doc) | No | Yes | Yes | Allows to automaticaly mirror your Git or SVN repositories to GitLab by hook trigger or periodicaly |
Push mirror (doc) | Yes(10.8) | Yes | Yes | Allows to automaticaly mirror your GitLab repository to any remote Git repository |
Debian and derivates (Debian 11 and Ubuntu 20.04.4 LTS are supported, other versions may also work...)
Add repository by running these commands
$ wget -O - https://repository.salamek.cz/deb/salamek.gpg.key|sudo apt-key add -
$ echo "deb https://repository.salamek.cz/deb/pub all main" | sudo tee /etc/apt/sources.list.d/salamek.cz.list
And then you can install a package gitlab-tools
$ apt update && apt install gitlab-tools
Add repository by adding this at end of file /etc/pacman.conf
[salamek]
Server = https://repository.salamek.cz/arch/pub
SigLevel = Optional
and then install by running
$ pacman -Sy gitlab-tools
You can create your docker-compose stack to run this application on docker. You can visit cenk1cenk2/docker-gitlab-tools for more information on the container.
After successful installation you will need to run setup to configure your installation:
$ gitlab-tools setup
This will start simple setup utility where you can/must configure
- gitlab-tools user (default: gitlab-tools, should be created after install)
- Database type to use, PostgreSQL is recommended database to use (you can use other database types only on your own risk)
- Database host (PostgreSQL, MySQL) or path (Only SQLite)
- Database name (PostgreSQL, MySQL)
- Database user (PostgreSQL, MySQL)
- Database password (PostgreSQL, MySQL)
- Webserver configuration (Host and port makes sense only when using integrated web server controlled by gitlab-tools service)
- Server name (eg.: https://gitlab-tools.example.com or IP:PORT when using integrated webserver)
- GitLab API configuration (you can follow this guide till point 7. https://docs.gitlab.com/ee/integration/gitlab.html) redirect url is https://gitlab-tools.example.com/sign/in/do where example.com is your server domain
- Gitlab APP ID: Application Id
- Gitlab APP SECRET: Secret
- Gitlab SSH: hostname and port where is your gitlab SSH port exposed in format gitlab.com:22
- Save new configuration ? -> y (this will create config file in /etc/gitlab-tools/config.yml)
- Recreate database ? -> y (this will create new empty database)
- Restart services to load new configuration ? -> y this will restart all gitlab-tools services:
- gitlab-tools: Controlling integrated webserver, disable this one if you want to use uwsgi or so.
- gitlab-tools_celeryworker: Controlling backround workers, must be enabled and running to perform mirroring
- gitlab-tools_celerybeat: Controlling celery scheduler
This creates/updates config file in /etc/gitlab-tools/config.yml, you can modify this file manualy
After this you should have gitlab-tools running on your "server name"
Install uwsgi
$ apt install uwsgi uwsgi-plugin-python3
Create uwsgi application configuration file at /etc/uwsgi/apps-available/gitlab-tools.example.com.ini
:
[uwsgi]
uid = gitlab-tools
master = true
chdir = /usr/lib/python3/dist-packages/gitlab_tools
socket = /tmp/gitlab-tools.sock
module = wsgi
callable = app
plugins = python3
buffer-size = 32768
Link this config file to /etc/uwsgi/apps-enabled
by running
$ ln -s /etc/uwsgi/apps-available/gitlab-tools.example.com.ini /etc/uwsgi/apps-enabled/
Restart uwsgi to load new configuration
$ systemctl restart uwsgi
Now you should have /tmp/gitlab-tools.sock
socket file created, check that by running
$ file /tmp/gitlab-tools.sock
Install nginx by running
apt install nginx
Create configuration file at /etc/nginx/sites-available/gitlab-tools.example.com
:
# Uncomment this when using SSL
#server {
# listen 80;
# listen [::]:80;
# server_name gitlab-tools.example.com;
# return 301 https://gitlab-tools.example.com$request_uri;
#}
server {
# Uncomment these to use SSL
#listen 443 ssl http2;
#listen [::]:443 ssl http2;
# Comment these to use SSL
listen 80;
listen [::]:80;
server_name gitlab-tools.example.com;
root /usr/lib/python3/dist-packages/gitlab_tools;
# Uncomment these to use SSL
#ssl on;
#ssl_certificate letsencrypt/certs/example.com/fullchain.pem;
#ssl_certificate_key letsencrypt/certs/example.com/privkey.pem;
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /var/tmp/letsencrypt-auto;
}
location / {
uwsgi_pass unix:///tmp/gitlab-tools.sock;
include uwsgi_params;
}
}
Link this file to /etc/nginx/sites-enabled
by running
$ ln -s /etc/nginx/sites-available/gitlab-tools.example.com /etc/nginx/sites-enabled/
And restart nginx
$ systemctl restart nginx
Now you should have gitlab-tools accessible at server_name
This project is also mirrored on GitLab https://gitlab.com/Salamek/gitlab-tools