diff --git a/ansible/main.yml b/ansible/main.yml index 1b4e25f..4a04cd4 100644 --- a/ansible/main.yml +++ b/ansible/main.yml @@ -52,3 +52,4 @@ - upload - website - duplicati + - gitlab-pages diff --git a/ansible/roles/gitlab-pages/files/docker-compose.yml b/ansible/roles/gitlab-pages/files/docker-compose.yml new file mode 100644 index 0000000..5cf64ed --- /dev/null +++ b/ansible/roles/gitlab-pages/files/docker-compose.yml @@ -0,0 +1,38 @@ +version: "2.3" + +services: + gitlab-pages: + image: gitlab/gitlab-ce:latest + hostname: pages.theorangeone.net + environment: + TZ: Europe/London + GITLAB_OMNIBUS_CONFIG: | + {% filter indent(width=8) %} + {%- include "gitlab.rb" %} + {% endfilter %} + + volumes: + - ./config:/etc/gitlab + - ./data:/var/opt/gitlab + - ./pages:/var/opt/gitlab/gitlab-rails/shared/pages + tmpfs: + - /var/log/gitlab + restart: unless-stopped + + ssh-server: + image: linuxserver/openssh-server:latest + environment: + - TZ=Europe/London + - USER_NAME=user + - PUBLIC_KEY_FILE=/id_ed25519.pub + - PUID=998 + - PGID=998 + volumes: + - ./ssh:/config + - ./pages:/config/pages + - ./id_ed25519.pub:/id_ed25519.pub:ro + - ./install-rsync.sh:/config/custom-cont-init.d/install-rsync.sh:ro + tmpfs: + - /config/logs + ports: + - "{{ wireguard.clients.walker.ip }}:8222:2222" diff --git a/ansible/roles/gitlab-pages/files/gitlab.rb b/ansible/roles/gitlab-pages/files/gitlab.rb new file mode 100644 index 0000000..88feb25 --- /dev/null +++ b/ansible/roles/gitlab-pages/files/gitlab.rb @@ -0,0 +1,19 @@ +external_url 'https://git.theorangeone.net' + +grafana['enable'] = false +postgresql['enable'] = false +redis['enable'] = false +prometheus['enable'] = false +puma['enable'] = false +sidekiq['enable'] = false +gitlab_workhorse['enable'] = false +gitaly['enable'] = false +alertmanager['enable'] = false +node_exporter['enable'] = false +gitlab_rails['auto_migrate'] = false +nginx['enabled'] = false + +pages_external_url "https://pages.theorangeone.net" +pages_nginx['enable'] = false +gitlab_pages['external_http'] = ['0.0.0.0:8080'] +gitlab_pages['inplace_chroot'] = true diff --git a/ansible/roles/gitlab-pages/files/install-rsync.sh b/ansible/roles/gitlab-pages/files/install-rsync.sh new file mode 100644 index 0000000..0a6a71e --- /dev/null +++ b/ansible/roles/gitlab-pages/files/install-rsync.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "**** installing rsync ****" +apk add --no-cache rsync diff --git a/ansible/roles/gitlab-pages/handlers/main.yml b/ansible/roles/gitlab-pages/handlers/main.yml new file mode 100644 index 0000000..50cfe0f --- /dev/null +++ b/ansible/roles/gitlab-pages/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart gitlab-pages + shell: + chdir: /opt/gitlab-pages + cmd: "{{ docker_update_command }}" diff --git a/ansible/roles/gitlab-pages/tasks/main.yml b/ansible/roles/gitlab-pages/tasks/main.yml new file mode 100644 index 0000000..2341bbb --- /dev/null +++ b/ansible/roles/gitlab-pages/tasks/main.yml @@ -0,0 +1,26 @@ +- name: Create install directory + file: + path: /opt/gitlab-pages + state: directory + owner: "{{ docker_user.name }}" + mode: "{{ docker_compose_directory_mask }}" + become: true + +- name: Install compose file + template: + src: files/docker-compose.yml + dest: /opt/gitlab-pages/docker-compose.yml + mode: "{{ docker_compose_file_mask }}" + owner: "{{ docker_user.name }}" + validate: /usr/bin/docker-compose -f %s config + notify: restart gitlab-pages + become: true + +- name: Install rsync installer + template: + src: files/install-rsync.sh + dest: /opt/gitlab-pages/install-rsync.sh + mode: 0755 + owner: "998" + notify: restart gitlab-pages + become: true diff --git a/terraform/theorangeone.net.tf b/terraform/theorangeone.net.tf index 33675cc..baec460 100644 --- a/terraform/theorangeone.net.tf +++ b/terraform/theorangeone.net.tf @@ -172,3 +172,11 @@ resource "cloudflare_record" "theorangeonenet_gitlab" { type = "A" ttl = 1 } + +resource "cloudflare_record" "theorangeonenet_gitlab_pages" { + zone_id = cloudflare_zone.theorangeonenet.id + name = "pages" + value = var.walker_ip + type = "A" + ttl = 1 +}