First Look: Enterprise Edition on Docker

First Look: Enterprise Edition via Containers

Introduction

A recent project required a self-hosted Git platform, so I researched how to set it up. The client was on an older version, so I had to work with that initially — but the workflow is essentially the same across versions; only the UI differs.

The following guide uses the latest version, since I also wanted to try it out.

Platform Overview

It is a Git-based version control repository management system that provides web-based Git operations along with additional features such as Issues, Wiki, and CI/CD.

It is largely similar to Azure DevOps, but open-source and self-hostable. Companies that prefer not to use Azure DevOps may find this a viable alternative.

Installation

  • The OS covered here is Ubuntu 22.04 LTS. For other operating systems, refer to the official documentation You will need OpenSSH Server and Docker installed. If you use the official Ubuntu ISO, these options are available during installation; otherwise, install them manually.
  • Why not Docker for Windows? The official documentation states it is not supported and has known issues, so Ubuntu Server was chosen instead.

Step One: Set Up Ubuntu Server (minimized)

  • Download the latest Ubuntu Server (minimized) ISO from Ubuntu image

  • Create a VM with HyperV and install Ubuntu Server (minimized) image

Step Two: Reassign the Default Secure-Shell Listen Address

The platform uses port 22 for SSH and Git operations, so you need to change the default SSH port from 22 to something else.

  1. Install VIM, or use the default vi or nano
1
       sudo apt install vim
  1. Edit /etc/ssh/sshd_config to change the default port
1
       sudo vi /etc/ssh/sshd_config
1
2
       # Port 22 <--預設就是被註解的22 port號
       Port 10022 #新增一行新port號,我設定為10022

image

  1. Restart OpenSSH Server
1
       sudo systemctl restart sshd
  1. Log out and log back in
1
2
       exit
       ssh <your ubuntu ip> -p 10022 #登入時要加上-p 10022

or

1
       ssh root@<your ubuntu ip> -p 10022 #登入時要加上-p 10022

To SSH in as root, edit /etc/ssh/sshd_config

1
2
    #PermitRootLogin prohibit-password <--預設就是被註解的
    PermitRootLogin yes #新增一行,並把註解拿掉

image

Step Three: Run Containers and Install the Platform

  1. Set the GITLAB_HOME directory. When running as root, you must place GITLAB_HOME under /root
1
       export GITLAB_HOME=/root/gitlab
  1. Run the Enterprise Edition container

Why install Enterprise Edition? Without a purchased license it functions identically to Community Edition. If you need to upgrade later, just purchase a license — no reinstallation required.

  1. Install using Docker Engine
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
       docker run --detach \
       --hostname <your ubuntu ip> \ # 這裡可以填寫你想要的hostname或已購買的Domain,也能設定為IP
       --publish 443:443 --publish 80:80 --publish 22:22 \
       --name gitlab \
       --restart always \
       --volume $GITLAB_HOME/config:/etc/gitlab \
       --volume $GITLAB_HOME/logs:/var/log/gitlab \
       --volume $GITLAB_HOME/data:/var/opt/gitlab \
       --shm-size 256m \
       gitlab/gitlab-ee:latest

You can run sudo docker logs -f gitlab to view the logs

  1. Install using Docker Compose
  • Check whether Docker Compose is installed
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
           docker-compose --version
       ```

![image](https://github.com/loustack17/loustack17.github.io/assets/33840759/6446d9c2-f0d7-47d5-9198-8dc9802dc6d2)

- If not installed, refer to the [Docker documentation](https://docs.docker.com/compose/install/)

- Create a `docker-compose.yml` file

```yaml
       version: '3.6'
       services:
       web:
         image: 'gitlab/gitlab-ee:latest'
         restart: always
         hostname: '<your ubuntu ip>' # 這裡可以填寫你想要的hostname或已購買的Domain,也能設定為IP
         environment:
         GITLAB_OMNIBUS_CONFIG: |
           external_url '<your ubuntu ip>'
         ports:
           - '80:80'
           - '443:443'
           - '22:22'
         volumes:
           - '$GITLAB_HOME/config:/etc/gitlab'
           - '$GITLAB_HOME/logs:/var/log/gitlab'
           - '$GITLAB_HOME/data:/var/opt/gitlab'
         shm_size: '256m'
       ```

- Make sure you are in the directory containing `docker-compose.yml`, then run `docker-compose up -d`

3. Retrieve the default `root` login password

```bash
       sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password

After installation, this password is only valid for 24 hours. Be sure to log in and change the password within that window.

  • This feature is available in version 14.0 and later
  • Older versions prompt you to set a new password when logging in as root
  1. Installation complete. Open a browser and enter the IP address or your domain to access the platform

image

The next post will cover additional configuration and how to set up CI/CD.

References