This document provides a comprehensive overview of the configuration options available for the GitLab CE development environment. The configurations outlined below are essential for optimizing your development setup and running the application smoothly.
Configuration Options
1. Docker Compose File
The primary method for configuring the GitLab CE development environment is through the docker-compose.yml
file. This file orchestrates the deployment of Docker containers required to run GitLab.
Basic Configuration
In your docker-compose.yml
file, the application is specified as follows:
app:
image: gitlab/gitlab-ce:latest
This line defines the service named app
, which utilizes the latest version of the gitlab/gitlab-ce
Docker image. This is the foundation of your GitLab environment.
2. Version Control for Docker Compose
Specifying the version of the Docker Compose file can help in ensuring compatibility with features. At the top of your docker-compose.yml
, include:
version: '3.8'
This indicates that you are using version 3.8 of the Docker Compose file format.
3. Service Definition
Beyond just defining the image for the application, you can specify additional configurations for the service. The following example shows how to set environment variables, ports, and volumes.
app:
image: gitlab/gitlab-ce:latest
environment:
GITLAB_OMNIBUS_CONFIG: >
external_url 'http://localhost:8080'
ports:
- '8080:80'
volumes:
- gitlab_data:/var/opt/gitlab
- gitlab_logs:/var/log/gitlab
- gitlab_configs:/etc/gitlab
4. Environment Variables
The GITLAB_OMNIBUS_CONFIG
environment variable allows you to configure advanced settings within GitLab. The example provided sets the external_url
, which is crucial for GitLab to understand how it should be accessed:
external_url 'http://localhost:8080'
This setting expects the GitLab instance to be accessible at http://localhost:8080
.
5. Port Mapping
The ports
section is imperative for mapping the container ports to the host’s ports, facilitating access to the app:
ports:
- '8080:80'
This configures the service to listen on port 80 internally (inside the container) and makes it accessible on port 8080 externally (on your local machine).
6. Volumes Configuration
Persistent data storage is crucial in a development environment. Use the volumes
section to define data persistence:
volumes:
- gitlab_data:/var/opt/gitlab
- gitlab_logs:/var/log/gitlab
- gitlab_configs:/etc/gitlab
gitlab_data
: Stores application data.gitlab_logs
: Stores logs for the application.gitlab_configs
: Contains configuration files.
7. Starting the Environment
Once your docker-compose.yml
is configured, you can start your development environment with the following command:
docker-compose up
This command initializes all services defined in your compose file, applying the configurations specified.
8. Stopping the Services
To gracefully stop all services, use:
docker-compose down
This ensures all containers are shut down properly without losing data, since persistent storage is configured.
Conclusion
The GitLab CE development environment offers a robust and flexible configuration option through the docker-compose.yml
file. By leveraging the various settings highlighted above, developers can create a tailored environment that suits their needs. For further information on specific configurations and features, please refer to the official documentation associated with the GitLab CE project.