Generate GitLab License For Self-Hosted/Private Instances
https://github.com/Lakr233/GitLab-License-Generator.git
GitLab License Generator This project generates a GitLab license for development purposes. If you encounter any problems, please troubleshoot them on your own.
Last tested on GitLab v17.6.0-ee.
GitLab uses a public/private key pair to encrypt its license. The public key is shipped with the GitLab distribution, while the private key is kept secure. The license itself is simply a JSON dictionary. Since GitLab has made its code open-source, we can easily generate our own license.
The lib folder is extracted from GitLab's source code. It is used to build and validate the license. The script src/generator.license.rb loads this functionality.
Removed with a script to generate empty json file due to DMCA takedown request.
Features are extracted from an object filled with constants. The most comprehensive plan for a license is Ultimate, but features like Geo Mirroring are not included in any standard plan. Therefore, we manually add these features.
Using this method license files are generated under ./license directory
Please note that in standard docker installations, owner of the files generated in license directory will be root
docker run --rm -it \
-v "./license:/license-generator/build" \
-e LICENSE_NAME="Tim Cook" \
-e LICENSE_COMPANY="Apple Computer, Inc." \
-e LICENSE_EMAIL="tcook@apple.com" \
-e LICENSE_PLAN="ultimate" \
-e LICENSE_USER_COUNT="2147483647" \
-e LICENSE_EXPIRE_YEAR="2500" \
ghcr.io/lakr233/gitlab-license-generator:main
git clone https://github.com/Lakr233/GitLab-License-Generator.git
docker build GitLab-License-Generator -t gitlab-license-generator:main
docker run --rm -it \
-v "./license:/license-generator/build" \
-e LICENSE_NAME="Tim Cook" \
-e LICENSE_COMPANY="Apple Computer, Inc." \
-e LICENSE_EMAIL="tcook@apple.com" \
-e LICENSE_PLAN="ultimate" \
-e LICENSE_USER_COUNT="2147483647" \
-e LICENSE_EXPIRE_YEAR="2500" \
gitlab-license-generator:main
Before starting, ensure your environment is properly configured.
To run this project, you need Ruby and the gem package manager.
sudo apt update
sudo apt install ruby-full
brew install ruby
After installing Ruby, you need to install Bundler to manage Ruby dependencies.
gem install bundler
gitlab-license gemThe project requires the gitlab-license gem, which will be automatically downloaded and used by the script.
gem install gitlab-license
Clone this project to your local machine.
git clone https://github.com/Lakr233/GitLab-License-Generator.git
cd GitLab-License-Generator
make.sh scriptOnce all the prerequisites are met, run the script:
./make.sh
The script will perform the following actions:
gitlab-license gem.The script generates a public key located in build/public.key. You need to replace GitLab’s existing public key with this newly generated one to ensure the license is accepted.
sudo cp ./build/public.key /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
docker-compose.yml file to mount the new public key inside the container:
volumes:
- "./build/public.key:/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub"
Then restart the container:
docker-compose down
docker-compose up -d
Once the public key is replaced, log in to GitLab’s admin interface to install the generated license.
build/result.gitlab-license).<YourGitLabURL>/admin/license/new
If you want to disable GitLab’s usage data collection (Service Ping), modify GitLab’s configuration file:
sudo nano /etc/gitlab/gitlab.rb
gitlab_rails['usage_ping_enabled'] = false
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
This project is licensed under the WTFPL License.
Copyright (c) 2023, Tim Cook, All Rights Not Reserved.