diff --git a/README.md b/README.md index 41e1b56e..46d1ede6 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ Ansible config and a bunch of Docker containers. * [Emby](https://emby.media/) - Media streaming and management * [Firefly III](https://firefly-iii.org/) - Free and open source personal finance manager * [get_iplayer](https://github.com/get-iplayer/get_iplayer) - download programmes from BBC iplayer -* [Gitea](https://gitea.io/en-us/) - Self-hosted Github clone +* [Gitea](https://gitea.io/en-us/) - Simple self-hosted Github clone +* [Gitlab](https://about.gitlab.com/features/) - Self-hosted Github clone of the highest order * [Glances](https://nicolargo.github.io/glances/) - for seeing the state of your system via a web browser * [Grafana](https://github.com/grafana/grafana) - Dashboarding tool * [Guacamole](https://guacamole.apache.org/) - Web based remote desktop gateway, supports VNC, RDP and SSH diff --git a/docs/applications/gitlab.md b/docs/applications/gitlab.md new file mode 100644 index 00000000..21da3207 --- /dev/null +++ b/docs/applications/gitlab.md @@ -0,0 +1,14 @@ +# GitLab + +Homepage: [https://docs.gitlab.com/omnibus/docker/](https://docs.gitlab.com/omnibus/docker/) + +If Gitea isn't powerful enough for you then consider GitLab. It's a much more powerful (and consquently bigger) Git repository solution that includes a suite of code analytics. On the other hand it requires more RAM. + +## Usage + +Set `gitlab_enabled: true` in your `inventories//nas.yml` file. + +To make GitLab available externally via Traefik set `gitlab_available_externally: "true"` in your `inventories//nas.yml` file. + +The first time you run GitLab you'll be prompted for an account's password. The password is for GitLab's `root` administrator account. From there you can log in to create additional users and further configure the application. + diff --git a/docs/configuration/application_ports.md b/docs/configuration/application_ports.md index 3718e2ec..bfd3cfd1 100644 --- a/docs/configuration/application_ports.md +++ b/docs/configuration/application_ports.md @@ -18,6 +18,9 @@ By default, applications can be found on the ports listed below. | get_iplayer | 8182 | | | Gitea | 3001 | Web | | Gitea | 222 | SSH | +| Gitlab | 4080 | HTTP | +| Gitlab | 4443 | HTTPS | +| Gitlab | 422 | SSH | | Glances | 61208 | SSH | | Grafana | 3000 | | | Guacamole | 8090 | | diff --git a/group_vars/all.yml b/group_vars/all.yml index 32d96f65..3e36810a 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -65,6 +65,7 @@ timemachine_enabled: false # Software build and CI gitea_enabled: false +gitlab_enabled: false # IRC znc_enabled: false @@ -568,6 +569,15 @@ gitea_data_directory: "{{ docker_home }}/gitea" gitea_port_http: "3001" gitea_port_ssh: "222" +### +### Gitlab +### +gitlab_available_externally: "false" +gitlab_data_directory: "{{ docker_home }}/gitlab" +gitlab_port_http: "4080" +gitlab_port_https: "4443" +gitlab_port_ssh: "422" + ### ### Glances ### diff --git a/nas.yml b/nas.yml index f74093df..9078d010 100644 --- a/nas.yml +++ b/nas.yml @@ -120,6 +120,10 @@ when: (gitea_enabled | default(False)) tags: gitea + - import_tasks: tasks/gitlab.yml + when: (gitlab_enabled | default(False)) + tags: gitlab + - import_tasks: tasks/timemachine.yml when: (timemachine_enabled | default(False)) tags: timemachine diff --git a/tasks/gitlab.yml b/tasks/gitlab.yml new file mode 100644 index 00000000..95dd34c1 --- /dev/null +++ b/tasks/gitlab.yml @@ -0,0 +1,51 @@ +--- +# The gitlab uid/gid matches 'git:git' in the Gitlab Docker image. +- name: Create Gitlab group account + group: + name: gitlab + gid: 998 + state: present + +- name: Create Gitlab user account + user: + name: gitlab + uid: 998 + state: present + system: yes + update_password: on_create + create_home: no + group: gitlab + +- name: Create Gitlab Directories + file: + path: "{{ item }}" + state: directory + owner: gitlab + group: gitlab + with_items: + - "{{ gitlab_data_directory }}/config" + - "{{ gitlab_data_directory }}/log" + - "{{ gitlab_data_directory }}/data" + +- name: Create Gitlab container + docker_container: + name: gitlab + image: gitlab/gitlab-ce:latest + pull: true + volumes: + - "{{ gitlab_data_directory }}/config:/etc/gitlab:rw" + - "{{ gitlab_data_directory }}/log:/var/log/gitlab:rw" + - "{{ gitlab_data_directory }}/data:/var/opt/gitlab:rw" + ports: + - "{{ gitlab_port_http }}:80" + - "{{ gitlab_port_https }}:443" + - "{{ gitlab_port_ssh }}:22" + hostname: "gitlab.{{ ansible_nas_domain }}" + restart_policy: always + detach: yes + memory: 4g + labels: + traefik.backend: "gitlab" + traefik.frontend.rule: "Host:gitlab.{{ ansible_nas_domain }}" + traefik.enable: "{{ gitlab_available_externally }}" + traefik.port: "80" diff --git a/templates/traefik/traefik.toml b/templates/traefik/traefik.toml index e51420f3..98a9352d 100644 --- a/templates/traefik/traefik.toml +++ b/templates/traefik/traefik.toml @@ -189,6 +189,7 @@ onDemand = false # create certificate when container is created "emby.{{ ansible_nas_domain }}", "firefly.{{ ansible_nas_domain }}", "gitea.{{ ansible_nas_domain }}", + "gitlab.{{ ansible_nas_domain }}", "glances.{{ ansible_nas_domain }}", "grafana.{{ ansible_nas_domain }}", "guacamole.{{ ansible_nas_domain }}",