Skip to content

Commit

Permalink
add self-build for matrix_user_verification
Browse files Browse the repository at this point in the history
Currently v3.0.0 tested with no issues.
So remove matrix_user_verification_service_docker_image from groups_vars.

/.npm must be writable or an error will be reported.
  • Loading branch information
Chikage0o0 authored and Charles Wright committed Jan 11, 2024
1 parent 9363f84 commit 98a222a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
3 changes: 0 additions & 3 deletions group_vars/matrix_servers
Original file line number Diff line number Diff line change
Expand Up @@ -4303,9 +4303,6 @@ matrix_user_creator_users_auto: |
#
######################################################################

## FIXME: Needs to be updated when there is a proper release by upstream.
matrix_user_verification_service_docker_image: "{{ matrix_user_verification_service_docker_image_name_prefix }}matrixdotorg/matrix-user-verification-service@sha256:d2aabc984dd69d258c91900c36928972d7aaef19d776caa3cd6a0fbc0e307270"

matrix_user_verification_service_enabled: false
matrix_user_verification_service_systemd_required_services_list: |
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ matrix_user_verification_service_ansible_name: "Matrix User Verification Service
# Enable by default. This is overwritten in provided group vars.
matrix_user_verification_service_enabled: true

matrix_user_verification_service_container_image_self_build: "{{ matrix_architecture != 'amd64' }}"
matrix_user_verification_service_container_image_self_build_repo: "https://github.com/matrix-org/matrix-user-verification-service"
matrix_user_verification_service_container_image_self_build_branch: "{{ 'master' if matrix_registration_version == 'latest' else matrix_user_verification_service_version }}"

# Fix version tag
# renovate: datasource=docker depName=matrixdotorg/matrix-user-verification-service
matrix_user_verification_service_version: "v3.0.0"
Expand All @@ -13,6 +17,7 @@ matrix_user_verification_service_version: "v3.0.0"
matrix_user_verification_service_base_path: "{{ matrix_base_data_path }}/user-verification-service"
matrix_user_verification_service_config_path: "{{ matrix_user_verification_service_base_path }}/config"
matrix_user_verification_service_config_env_file: "{{ matrix_user_verification_service_config_path }}/.env"
matrix_user_verification_service_docker_src_files_path: "{{ matrix_user_verification_service_base_path }}/docker-src"

# Docker
matrix_user_verification_service_docker_image_name_prefix: "{{ matrix_container_global_registry_prefix }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
group: "{{ matrix_user_groupname }}"
with_items:
- {path: "{{ matrix_user_verification_service_config_path }}", when: true}
- {path: "{{ matrix_user_verification_service_docker_src_files_path }}", when: "{{ matrix_user_verification_service_container_image_self_build }}"}
when: item.when | bool

- name: Ensure Matrix User Verification Service image is pulled
Expand All @@ -21,6 +22,30 @@
retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}"
until: result is not failed
when: "not matrix_user_verification_service_container_image_self_build | bool"

- name: Ensure Matrix User Verification Service repository is present when self-building
ansible.builtin.git:
repo: "{{ matrix_user_verification_service_container_image_self_build_repo }}"
dest: "{{ matrix_user_verification_service_docker_src_files_path }}"
version: "{{ matrix_user_verification_service_container_image_self_build_branch }}"
force: "yes"
become: true
become_user: "{{ matrix_user_username }}"
register: matrix_user_verification_service_git_pull_results
when: "matrix_user_verification_service_container_image_self_build | bool"

- name: Ensure Matrix User Verification Service image is built
community.docker.docker_image:
name: "{{ matrix_user_verification_service_docker_image }}"
source: build
force_source: "{{ matrix_user_verification_service_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_user_verification_service_git_pull_results.changed }}"
build:
dockerfile: Dockerfile
path: "{{ matrix_user_verification_service_docker_src_files_path }}"
pull: true
when: "matrix_user_verification_service_container_image_self_build | bool"

- name: Ensure Matrix User Verification Service env file installed
ansible.builtin.template:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--read-only \
--tmpfs /.npm \
--network={{ matrix_user_verification_service_container_network }} \
{% if matrix_user_verification_service_container_http_host_bind_port %}
-p {{ matrix_user_verification_service_container_http_host_bind_port }}:3000 \
Expand Down

0 comments on commit 98a222a

Please sign in to comment.