Move matrix-bridge-beeper-linkedin to its own container network

bye-bye-nginx-proxy
Slavi Pantaleev 6 months ago
parent b651495c07
commit 205663a4be

@ -760,17 +760,24 @@ matrix_appservice_kakaotalk_database_password: "{{ '%s' | format(matrix_homeserv
# We don't enable bridges by default.
matrix_beeper_linkedin_enabled: false
matrix_beeper_linkedin_systemd_required_services_list_auto: |
{{
matrix_addons_homeserver_systemd_services_list
+
([devture_postgres_identifier ~ '.service'] if (devture_postgres_enabled and matrix_beeper_linkedin_database_hostname == devture_postgres_connection_hostname) else [])
}}
matrix_beeper_linkedin_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}"
matrix_beeper_linkedin_systemd_required_services_list: |
matrix_beeper_linkedin_container_network: "{{ matrix_addons_container_network }}"
matrix_beeper_linkedin_container_additional_networks_auto: |-
{{
['docker.service']
+
['matrix-' + matrix_homeserver_implementation + '.service']
+
([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled else [])
+
(['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else [])
(
([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network])
+
([devture_postgres_container_network] if (devture_postgres_enabled and matrix_beeper_linkedin_database_hostname == devture_postgres_connection_hostname and matrix_beeper_linkedin_container_network != devture_postgres_container_network) else [])
) | unique
}}
matrix_beeper_linkedin_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'linked.as.token', rounds=655555) | to_uuid }}"
@ -790,6 +797,7 @@ matrix_beeper_linkedin_database_password: "{{ '%s' | format(matrix_homeserver_ge
#
######################################################################
######################################################################
#
# matrix-bridge-go-skype-bridge

@ -38,11 +38,20 @@ matrix_beeper_linkedin_bridge_permissions: |
| combine({matrix_admin: 'admin'} if matrix_admin else {})
}}
matrix_beeper_linkedin_container_network: ""
matrix_beeper_linkedin_container_additional_networks: "{{ matrix_beeper_linkedin_container_additional_networks_auto + matrix_beeper_linkedin_container_additional_networks_custom }}"
matrix_beeper_linkedin_container_additional_networks_auto: []
matrix_beeper_linkedin_container_additional_networks_custom: []
# A list of extra arguments to pass to the container
matrix_beeper_linkedin_container_extra_arguments: []
# List of systemd services that matrix-beeper-linkedin.service depends on.
matrix_beeper_linkedin_systemd_required_services_list: ['docker.service']
matrix_beeper_linkedin_systemd_required_services_list: "{{ matrix_beeper_linkedin_systemd_required_services_list_default + matrix_beeper_linkedin_systemd_required_services_list_auto + matrix_beeper_linkedin_systemd_required_services_list_custom }}"
matrix_beeper_linkedin_systemd_required_services_list_default: ['docker.service']
matrix_beeper_linkedin_systemd_required_services_list_auto: []
matrix_beeper_linkedin_systemd_required_services_list_custom: []
# List of systemd services that matrix-beeper-linkedin.service wants
matrix_beeper_linkedin_systemd_wanted_services_list: []

@ -83,6 +83,11 @@
owner: "{{ matrix_user_username }}"
group: "{{ matrix_user_groupname }}"
- name: Ensure beeper-linkedin container network is created
community.general.docker_network:
name: "{{ matrix_beeper_linkedin_container_network }}"
driver: bridge
- name: Ensure matrix-beeper-linkedin.service installed
ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-beeper-linkedin.service.j2"

@ -9,3 +9,4 @@
- {'name': 'matrix_beeper_linkedin_appservice_token', when: true}
- {'name': 'matrix_beeper_linkedin_homeserver_token', when: true}
- {'name': 'matrix_beeper_linkedin_database_hostname', when: "{{ matrix_beeper_linkedin_database_engine == 'postgres' }}"}
- {'name': 'matrix_beeper_linkedin_container_network', when: true}

@ -19,18 +19,26 @@ ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_s
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
ExecStartPre={{ matrix_host_command_sleep }} 5
ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-beeper-linkedin \
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \
--name=matrix-beeper-linkedin \
--log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
--network={{ matrix_beeper_linkedin_container_network }} \
-v {{ matrix_beeper_linkedin_config_path }}:/data:z \
--workdir=/opt/linkedin-matrix \
{% for arg in matrix_beeper_linkedin_container_extra_arguments %}
{{ arg }} \
{% endfor %}
{{ matrix_beeper_linkedin_docker_image }} \
python3 -m linkedin_matrix -c /data/config.yaml -r /data/registration.yaml
python3 -m linkedin_matrix -c /data/config.yaml -r /data/registration.yaml
{% for network in matrix_beeper_linkedin_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-beeper-linkedin
{% endfor %}
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-beeper-linkedin
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} stop --time={{ devture_systemd_docker_base_container_stop_grace_time_seconds }} matrix-beeper-linkedin 2>/dev/null || true'
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-beeper-linkedin 2>/dev/null || true'

Loading…
Cancel
Save