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 v18.9.1-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.
git clone https://github.com/kh0mka/GitLab-License-Generatorservices:
gitlab-license-generator:
build:
context: .
image: gitlab-license-generator:latest
container_name: gitlab-lg
environment:
LICENSE_NAME: "Name of License"
LICENSE_COMPANY: "Company Inc."
LICENSE_EMAIL: "company@domain.com"
LICENSE_PLAN: "ultimate"
LICENSE_USER_COUNT: "50000"
LICENSE_EXPIRE_YEAR: "2030"
volumes:
- ./license:/license-generator/build
stdin_open: true
tty: truedocker compose build gitlab-license-generator
docker compose run --rm gitlab-license-generator
ls license/
features.json license.json private.key public.key result.gitlab-licenseUsing 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:maingit 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-
If GitLab is installed via Docker:
Modify your
docker-compose.ymlfile to mount the new public key inside the container:
services:
gitlab:
image: gitlab/gitlab-ee:18.5.1-ee.0
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['initial_license_file'] = "/opt/gitlab/embedded/service/gitlab-rails/GitLab.gitlab-license"
volumes:
- /opt/gitlab_license/license/public.key:/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
- /opt/gitlab_license/license/result.gitlab-license:/opt/gitlab/embedded/service/gitlab-rails/GitLab.gitlab-licenseThen restart the container:
docker-compose down
docker-compose up -dOnce the public key is replaced, log in to GitLab’s admin interface to install the generated license.
- Log in to GitLab as an administrator.
- Navigate to the Admin Area from the bottom-left corner.
- Go to Settings > General and upload the generated license file (
build/result.gitlab-license). - Check the Terms of Service checkbox and click Add License.
If necessary, you can directly access the license upload page via:
<YourGitLabURL>/admin/license/new
If you want to disable GitLab’s usage data collection (Service Ping), modify GitLab’s configuration file:
-
Open the configuration file:
sudo nano /etc/gitlab/gitlab.rb
-
Add the following line:
gitlab_rails['usage_ping_enabled'] = false
-
Reconfigure and restart GitLab:
sudo gitlab-ctl reconfigure sudo gitlab-ctl restart
- HTTP 502 Error: If you encounter this error, wait for GitLab to finish starting up (it may take some time).
This project is licensed under the WTFPL License.
Copyright (c) 2023, Tim Cook, All Rights Not Reserved.