Skip to content

Commit

Permalink
[Op#53021] Define Gitlab CE local docker compose setup with TLS (#14846)
Browse files Browse the repository at this point in the history
* Ops[Op#53021]: Define Gitlab community edition docker compose

https://community.openproject.org/work_packages/53021

Co-authored-by: Andreas Pfohl <[email protected]>

* chore[Op#53021]: Allow for override in case of MacOS setup

* chore[Op#53021]: Include aliases in tls docker compose override

* docs[Op#53021]: Add some documentation for running the gitlab docker service

* docs[Op#53021]: amend typos

* docs[Op#53021]: Add helper documentation on resetting root password

---------

Co-authored-by: Andreas Pfohl <[email protected]>
  • Loading branch information
akabiru and apfohl authored Mar 1, 2024
1 parent 91669cf commit b927baf
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 2 deletions.
1 change: 1 addition & 0 deletions docker/dev/gitlab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker-compose.override.yml
37 changes: 37 additions & 0 deletions docker/dev/gitlab/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
version: "3.9"

services:
gitlab:
image: gitlab/gitlab-ce:latest
restart: no
volumes:
- gitlab-etc:/etc/gitlab
- gitlab-logs:/var/log/gitlab
- gitlab-opt:/var/opt/gitlab
# Linux
- /etc/ssl/certs:/etc/ssl/certs:ro
- /usr/local/share/ca-certificates:/usr/local/share/ca-certificates:ro
# In case of MacOS, you need to mount the certs from the host machine
# having them previously bundled via `sudo update-ca-certificates`
#
# - ~/.step/certs:/etc/ssl/certs
# - ~/.step/certs:/usr/local/share/ca-certificates
networks:
- external
extra_hosts:
- "openproject.local:host-gateway"
labels:
- "traefik.enable=true"
- "traefik.http.routers.gitlab.rule=Host(`gitlab.local`)"
- "traefik.http.routers.gitlab.entrypoints=websecure"
- "traefik.http.services.gitlab.loadbalancer.server.port=80"

volumes:
gitlab-etc:
gitlab-logs:
gitlab-opt:

networks:
external:
name: gateway
external: true
2 changes: 2 additions & 0 deletions docker/dev/tls/docker-compose.override.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ services:
# by connecting to them, and we'd like it to go through traefik, instead
# of calling the service containers directly.
- openproject.local
- nextcloud.local
- gitlab.local
37 changes: 35 additions & 2 deletions docs/development/development-environment-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ cp docker-compose.override.example.yml docker-compose.override.yml
# and will install all required server dependencies
docker compose run --rm backend setup

# This will install the web dependencies
# This will install the web dependencies
docker compose run --rm frontend npm install
```

Expand Down Expand Up @@ -307,7 +307,7 @@ On Debian, you need to add the generated root CA to system certificates bundle.
docker compose --project-directory docker/dev/tls cp \
step:/home/step/certs/root_ca.crt /usr/local/share/ca-certificates/OpenProject_Development_Root_CA.crt

# Create symbolic link
# Create symbolic link
ln -s /usr/local/share/ca-certificates/OpenProject_Development_Root_CA.crt /etc/ssl/certs/OpenProject_Development_Root_CA.pem

# Update certificate bundle
Expand Down Expand Up @@ -394,6 +394,39 @@ docker compose --project-directory docker/dev/tls down
docker compose --project-directory docker/dev/tls up -d
```

## GitLab CE Service

Within `docker/dev/gitlab` a compose file is provided for running local Gitlab instance with TLS support. This provides
a production like environment for testing the OpenProject GitLab integration against a community edition GitLab instance
accessible on `https://gitlab.local`.

> NOTE: Configure [TLS Support](#tls-support) first before starting the GitLab service
See [Install GitLab using Docker Compose](https://docs.gitlab.com/ee/install/docker.html#install-gitlab-using-docker-compose)
official GitLab documentation.

### Running the GitLab Instance

Start up the docker compose service for gitlab as follows:

```shell
docker compose --project-directory docker/dev/gitlab up -d
```

### Initial password

Once the GitLab service is started and running, you can access the initial `root` user password as follows:

```shell
docker compose --project-directory docker/dev/gitlab exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
```

Should you need to reset your root password, execute the following command:

```shell
docker compose --project-directory docker/dev/gitlab exec -it gitlab gitlab-rake "gitlab:password:reset[root]"
```

## Local files

Running the docker images will change some of your local files in the mounted code directory. The
Expand Down

0 comments on commit b927baf

Please sign in to comment.