This project provides a streamlined environment for managing most needed developer services locally using docker-compose. It includes a custom bash script to control Docker containers and a simple configuration guide to quickly get GitLab, MongoDB, and GitLab Runner up and running.
- Local GitLab and MongoDB: Easily spin up GitLab and MongoDB services for development and testing.
- Service Control: Use the
start.sh
script to selectively start specific services (likemongo
orgitlab-runner
) without starting the entire stack. - GitLab Runner Management: Option to register a GitLab Runner for CI/CD pipelines in non-interactive or interactive mode.
This setup is ideal for developers looking to test, build, and experiment with GitLab CI pipelines and MongoDB databases in a controlled local environment.
-
🖥️ Open the
/etc/hosts
file and add the following line:sudo gedit /etc/hosts
Add:
127.0.0.1 gitlab.local.com
-
🛠️ If this is your first run, create the Docker network:
docker network create localdev
-
📜 Start services with the
start.sh
script:-
To start all services:
sudo bash ./start.sh
-
To start only specific services like
mongo
:sudo bash ./start.sh --services=mongo
-
Start
mongo
andgitlab
:sudo bash ./start.sh --services=mongo,gitlab
-
Start
gitlab-runner
:sudo bash ./start.sh --services=gitlab-runner
-
-
🔐 Change the root password for GitLab:
sudo docker exec -it gitlab bash gitlab-rake "gitlab:password:reset[root]"
-
MongoDB:
mongodb://test:test@localhost:27017/?authSource=admin&readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false
# Register the GitLab runner using non-interactive mode
sudo docker-compose exec gitlab-runner gitlab-runner register \
--non-interactive \
--url http://gitlab.local.com/ \
--tag-list "test" \
--registration-token xxxxxxxxxxxxx \
--executor docker \
--docker-image node:18.2.0 \
--docker-network-mode localdev
# Alternatively, use interactive mode:
sudo docker-compose exec gitlab-runner gitlab-runner register
sudo docker logs mongo
sudo docker logs gitlab
sudo docker logs gitlab-runner
sudo docker exec -it gitlab bash
gitlab-rake "gitlab:password:reset[root]"
If you encounter the following error:
find: '/data/db/diagnostic.data/metrics.interim': No such file or directory
Fix by deleting the diagnostic.data
folder from the mounted volume:
sudo rm -rf /srv/mongo/diagnostic.data
- Try running the
start.sh
script again.
-
GitLab can take 5-10 minutes to initialize on slow computers. In some cases, it may require multiple restarts to resolve.
-
Adjust CPU resources for
gitlab
andgitlab_runner
if the issue persists.