If you need to start fresh or reset your GitLab installation:
./cleanup.sh
This script will:
- Stop all GitLab containers
- Remove all GitLab data
- Remove all logs
- Remove SSL certificates
- Give you a clean slate to start over
-
Copy the example configuration file:
cp config.env.example .env
-
Edit your settings in
.env
-
Start everything with:
chmod +x setup.sh ./setup.sh
-
Important: The initial root password will be displayed after setup. You can also retrieve it manually within the first 24 hours using:
docker exec gitlab-docker-gitlab-1 cat /etc/gitlab/initial_root_password
Make sure to change this password immediately after your first login!
-
Het setup script maakt automatisch een self-signed SSL-certificaat aan voor je GitLab-domein. Dit certificaat wordt gegenereerd met een Subject Alternative Name (SAN) voor zowel je GitLab domein als je Container Registry domein ($REGISTRY).
-
Register the runner:
- Log in to GitLab as root user
- Go to Admin Area > Overview > Runners (or navigate to
https://gitlab.example.com/admin/runners
) - Note down the registration token shown at the top of the page
- Edit
register-runner.sh
and update:GITLAB_URL
: Your GitLab URL (e.g., "https://gitlab.example.com/")REGISTRATION_TOKEN
: The token you copied in step 3
- Make the script executable and run it:
chmod +x register-runner.sh ./register-runner.sh
- The runner should now appear in your GitLab Runners overview page
- Optional: Configure additional runner settings in the GitLab UI:
- Tags
- Run untagged jobs
- Lock to project
- Maximum timeout
Note: The runner registration uses the same SSL certificate as GitLab. Make sure your SSL certificate is properly set up in the
./ssl
directory before registering the runner. -
Add your Ansible code to a GitLab project and include
.gitlab-ci.yml
-
Add the following GitLab CI/CD variables:
SSH_PRIVATE_KEY
(your private key)KNOWN_HOSTS
(optional)
Done! Your GitLab environment is ready to use.
- The folders
data/
,logs/
,ssl/
, andconfig/
are used for persistent storage and configuration. - Only
.gitkeep
files and explicitly listed files are tracked in version control. - See
.gitignore
for details. - Note: Docker Compose automatically loads variables from a file named
.env
in the project root.
For detailed instructions on configuring CI/CD variables for SSH keys and other necessary settings, refer to the documentation provided in the project.
Start the environment with Docker Compose (example):
docker compose up
- Create a new project in GitLab
- Create a new file
.gitlab-ci.yml
with this content:test-job: script: - echo "My first job" - echo "Runner is working!" - echo "Current date is $(date)"
- Commit and push the file
- Go to your project's CI/CD > Pipelines to see the job running
You should see your job execute successfully with the output messages. If this works, your runner is correctly configured!
For a more complete test that uses Docker:
test-docker:
image: alpine:latest
script:
- echo "Testing from Alpine container"
- uname -a
- cat /etc/os-release