parent
0ec62855bb
commit
5e62850727
@ -0,0 +1,124 @@
|
||||
---
|
||||
# Matrix Appservice Polychat is a bridge service to multiple networks
|
||||
# Project source code URL: https://github.com/polychatproject/polychat-appservice
|
||||
|
||||
matrix_appservice_polychat_enabled: true
|
||||
|
||||
matrix_appservice_polychat_scheme: https
|
||||
matrix_appservice_polychat_hostname: ''
|
||||
matrix_appservice_polychat_path_prefix: /appservice-polychat
|
||||
|
||||
matrix_appservice_polychat_container_image_self_build: false
|
||||
matrix_appservice_polychat_container_image_self_build_repo: "https://github.com/polychatproject/polychat-appservice.git"
|
||||
matrix_appservice_polychat_container_image_self_build_repo_version: "{{ 'master' if matrix_appservice_polychat_version == 'latest' else matrix_appservice_polychat_version }}"
|
||||
matrix_appservice_polychat_container_image_self_build_repo_dockerfile_path: "Dockerfile"
|
||||
|
||||
matrix_appservice_polychat_version: v1.0.3-01
|
||||
matrix_appservice_polychat_docker_image: "{{ matrix_appservice_polychat_docker_image_name_prefix }}polychatproject/polychat-appservice:{{ matrix_appservice_polychat_version }}"
|
||||
matrix_appservice_polychat_docker_image_name_prefix: "{{ 'localhost/' if matrix_appservice_polychat_container_image_self_build else matrix_container_global_registry_prefix }}"
|
||||
matrix_appservice_polychat_docker_image_force_pull: "{{ matrix_appservice_polychat_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_appservice_polychat_base_path: "{{ matrix_base_data_path }}/appservice-polychat"
|
||||
matrix_appservice_polychat_config_path: "{{ matrix_appservice_polychat_base_path }}/config"
|
||||
matrix_appservice_polychat_data_path: "{{ matrix_appservice_polychat_base_path }}/data"
|
||||
matrix_appservice_polychat_docker_src_files_path: "{{ matrix_appservice_polychat_base_path }}/docker-src"
|
||||
|
||||
# If nginx-proxy is disabled, the bridge itself expects its endpoint to be on its own domain (e.g. "localhost:6789")
|
||||
matrix_appservice_polychat_public_endpoint: "{{ matrix_appservice_polychat_path_prefix }}"
|
||||
matrix_appservice_polychat_inbound_uri_prefix: "{{ matrix_appservice_polychat_scheme }}://{{ matrix_appservice_polychat_hostname }}{{ matrix_appservice_polychat_public_endpoint }}"
|
||||
|
||||
matrix_appservice_polychat_bot_name: 'webhookbot'
|
||||
matrix_appservice_polychat_user_prefix: '_webhook_'
|
||||
|
||||
# Controls the polychat_PORT and MATRIX_PORT of the installation
|
||||
matrix_appservice_polychat_matrix_port: 6789
|
||||
|
||||
# Controls whether the appservice-polychat container exposes its HTTP port (tcp/6789 in the container).
|
||||
#
|
||||
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9999"), or empty string to not expose.
|
||||
matrix_appservice_polychat_container_http_host_bind_port: ''
|
||||
|
||||
matrix_appservice_polychat_container_network: ""
|
||||
|
||||
matrix_appservice_polychat_container_additional_networks: "{{ matrix_appservice_polychat_container_additional_networks_auto + matrix_appservice_polychat_container_additional_networks_custom }}"
|
||||
matrix_appservice_polychat_container_additional_networks_auto: []
|
||||
matrix_appservice_polychat_container_additional_networks_custom: []
|
||||
|
||||
# matrix_appservice_polychat_container_labels_traefik_enabled controls whether labels to assist a Traefik reverse-proxy will be attached to the container.
|
||||
# See `../templates/labels.j2` for details.
|
||||
#
|
||||
# To inject your own other container labels, see `matrix_appservice_polychat_container_labels_additional_labels`.
|
||||
matrix_appservice_polychat_container_labels_traefik_enabled: true
|
||||
matrix_appservice_polychat_container_labels_traefik_docker_network: "{{ matrix_appservice_polychat_container_network }}"
|
||||
matrix_appservice_polychat_container_labels_traefik_entrypoints: web-secure
|
||||
matrix_appservice_polychat_container_labels_traefik_tls_certResolver: default # noqa var-naming
|
||||
|
||||
# Controls whether labels will be added that expose matrix-appservice-webhook's public endpoints
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_enabled: true
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_hostname: "{{ matrix_appservice_polychat_hostname }}"
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_prefix: "{{ matrix_appservice_polychat_path_prefix }}"
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_traefik_rule: "Host(`{{ matrix_appservice_polychat_container_labels_public_endpoint_hostname }}`) && PathPrefix(`{{ matrix_appservice_polychat_path_prefix }}`)"
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_traefik_priority: 0
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints: "{{ matrix_appservice_polychat_container_labels_traefik_entrypoints }}"
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls: "{{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints != 'web' }}"
|
||||
matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls_certResolver: "{{ matrix_appservice_polychat_container_labels_traefik_tls_certResolver }}" # noqa var-naming
|
||||
|
||||
# matrix_appservice_polychat_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
|
||||
# See `../templates/labels.j2` for details.
|
||||
#
|
||||
# Example:
|
||||
# matrix_appservice_polychat_container_labels_additional_labels: |
|
||||
# my.label=1
|
||||
# another.label="here"
|
||||
matrix_appservice_polychat_container_labels_additional_labels: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_appservice_polychat_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-appservice-polychat.service depends on.
|
||||
matrix_appservice_polychat_systemd_required_services_list: "{{ matrix_appservice_polychat_systemd_required_services_list_default + matrix_appservice_polychat_systemd_required_services_list_auto + matrix_appservice_polychat_systemd_required_services_list_custom }}"
|
||||
matrix_appservice_polychat_systemd_required_services_list_default: ['docker.service']
|
||||
matrix_appservice_polychat_systemd_required_services_list_auto: []
|
||||
matrix_appservice_polychat_systemd_required_services_list_custom: []
|
||||
|
||||
# List of systemd services that matrix-appservice-polychat.service wants
|
||||
matrix_appservice_polychat_systemd_wanted_services_list: []
|
||||
|
||||
matrix_appservice_polychat_homeserver_media_url: "{{ matrix_server_fqn_matrix }}"
|
||||
matrix_appservice_polychat_homeserver_url: ""
|
||||
matrix_appservice_polychat_homeserver_domain: "{{ matrix_domain }}"
|
||||
matrix_appservice_polychat_appservice_url: 'http://matrix-appservice-polychat'
|
||||
|
||||
matrix_appservice_polychat_appservice_token: ''
|
||||
matrix_appservice_polychat_homeserver_token: ''
|
||||
matrix_appservice_polychat_id_token: ''
|
||||
matrix_appservice_polychat_api_secret: ''
|
||||
|
||||
# Logging information (info and verbose is available) default is: info
|
||||
matrix_appservice_polychat_log_level: 'info'
|
||||
|
||||
matrix_appservice_polychat_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
|
||||
|
||||
matrix_appservice_polychat_configuration_extension_yaml: |
|
||||
#
|
||||
|
||||
matrix_appservice_polychat_configuration_extension: "{{ matrix_appservice_polychat_configuration_extension_yaml | from_yaml if matrix_appservice_polychat_configuration_extension_yaml | from_yaml else {} }}"
|
||||
|
||||
matrix_appservice_polychat_configuration: "{{ matrix_appservice_polychat_configuration_yaml | from_yaml | combine(matrix_appservice_polychat_configuration_extension, recursive=True) }}"
|
||||
|
||||
matrix_appservice_polychat_registration_yaml: |
|
||||
id: "{{ matrix_appservice_polychat_id_token }}"
|
||||
hs_token: "{{ matrix_appservice_polychat_homeserver_token }}"
|
||||
as_token: "{{ matrix_appservice_polychat_appservice_token }}"
|
||||
namespaces:
|
||||
users:
|
||||
- exclusive: true
|
||||
regex: '^@{{ matrix_appservice_polychat_user_prefix | regex_escape }}.*:{{ matrix_domain | regex_escape }}$'
|
||||
aliases: []
|
||||
rooms: []
|
||||
url: "{{ matrix_appservice_polychat_appservice_url }}:{{ matrix_appservice_polychat_matrix_port }}"
|
||||
sender_localpart: _webhook
|
||||
rate_limited: false
|
||||
protocols: null
|
||||
|
||||
matrix_appservice_polychat_registration: "{{ matrix_appservice_polychat_registration_yaml | from_yaml }}"
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-appservice-polychats
|
||||
- install-all
|
||||
- install-appservice-polychat
|
||||
block:
|
||||
- when: matrix_appservice_polychat_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
|
||||
- when: matrix_appservice_polychat_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
|
||||
- tags:
|
||||
- setup-all
|
||||
- setup-appservice-polychat
|
||||
block:
|
||||
- when: not matrix_appservice_polychat_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
@ -0,0 +1,103 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-appservice-polychat paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_appservice_polychat_base_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_polychat_config_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_polychat_data_path }}", when: true}
|
||||
- {path: "{{ matrix_appservice_polychat_docker_src_files_path }}", when: "{{ matrix_appservice_polychat_container_image_self_build }}"}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure matrix-appservice-polychat container image is pulled
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_appservice_polychat_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_appservice_polychat_docker_image_force_pull 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_appservice_polychat_docker_image_force_pull }}"
|
||||
when: "not matrix_appservice_polychat_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ devture_playbook_help_container_retries_count }}"
|
||||
delay: "{{ devture_playbook_help_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- when: "matrix_appservice_polychat_container_image_self_build | bool"
|
||||
block:
|
||||
- name: Ensure matrix-appservice-polychat repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_appservice_polychat_container_image_self_build_repo }}"
|
||||
dest: "{{ matrix_appservice_polychat_docker_src_files_path }}"
|
||||
version: "{{ matrix_appservice_polychat_container_image_self_build_repo_version }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_appservice_polychat_git_pull_results
|
||||
|
||||
- name: Ensure matrix-appservice-polychat container image is built
|
||||
community.docker.docker_image:
|
||||
name: "{{ matrix_appservice_polychat_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_appservice_polychat_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_appservice_polychat_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: "{{ matrix_appservice_polychat_container_image_self_build_repo_dockerfile_path }}"
|
||||
path: "{{ matrix_appservice_polychat_docker_src_files_path }}"
|
||||
pull: true
|
||||
|
||||
- name: Ensure matrix-appservice-polychat config is installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_polychat_configuration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_polychat_config_path }}/config.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-appservice-polychat schema.yml template exists
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/schema.yml.j2"
|
||||
dest: "{{ matrix_appservice_polychat_config_path }}/schema.yml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-appservice-polychat database.json template exists
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/database.json.j2"
|
||||
dest: "{{ matrix_appservice_polychat_data_path }}/database.json"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure appservice-polychat registration.yaml installed
|
||||
ansible.builtin.copy:
|
||||
content: "{{ matrix_appservice_polychat_registration | to_nice_yaml(indent=2, width=999999) }}"
|
||||
dest: "{{ matrix_appservice_polychat_config_path }}/polychat-registration.yaml"
|
||||
mode: 0644
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
|
||||
- name: Ensure matrix-appservice-polychat container network is created
|
||||
community.general.docker_network:
|
||||
name: "{{ matrix_appservice_polychat_container_network }}"
|
||||
driver: bridge
|
||||
|
||||
- name: Ensure matrix-appservice-polychat support files installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/{{ item }}.j2"
|
||||
dest: "{{ matrix_appservice_polychat_base_path }}/{{ item }}"
|
||||
mode: 0640
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- labels
|
||||
|
||||
- name: Ensure matrix-appservice-polychat.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-appservice-polychat.service.j2"
|
||||
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-polychat.service"
|
||||
mode: 0644
|
@ -0,0 +1,20 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-appservice-polychat service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-polychat.service"
|
||||
register: matrix_appservice_polychat_service_stat
|
||||
|
||||
- when: matrix_appservice_polychat_service_stat.stat.exists | bool
|
||||
block:
|
||||
- name: Ensure matrix-appservice-polychat is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-appservice-polychat
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure matrix-appservice-polychat.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-polychat.service"
|
||||
state: absent
|
@ -0,0 +1,16 @@
|
||||
---
|
||||
|
||||
- name: Fail if required matrix-appservice-polychat settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- matrix_appservice_polychat_appservice_token
|
||||
- matrix_appservice_polychat_homeserver_url
|
||||
- matrix_appservice_polychat_homeserver_token
|
||||
- matrix_appservice_polychat_id_token
|
||||
- matrix_appservice_polychat_api_secret
|
||||
- matrix_appservice_polychat_container_network
|
||||
- matrix_appservice_polychat_hostname
|
||||
- matrix_appservice_polychat_path_prefix
|
@ -0,0 +1,28 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
# Configuration specific to the application service. All fields (unless otherwise marked) are required.
|
||||
homeserver:
|
||||
# The domain for the client-server API calls.
|
||||
url: "{{ matrix_appservice_polychat_homeserver_url }}"
|
||||
|
||||
# The domain part for user IDs on this home server. Usually, but not always, this is the same as the
|
||||
# home server's URL.
|
||||
domain: "{{ matrix_domain }}"
|
||||
|
||||
# Configuration specific to the bridge. All fields (unless otherwise marked) are required.
|
||||
webhookBot:
|
||||
# The localpart to use for the bot. May require re-registering the application service.
|
||||
localpart: "_webhook"
|
||||
|
||||
# Provisioning API options
|
||||
provisioning:
|
||||
# Your secret for the API. Required for all provisioning API requests.
|
||||
secret: '{{ matrix_appservice_polychat_api_secret }}'
|
||||
|
||||
# Configuration related to the web portion of the bridge. Handles the inbound polychat
|
||||
web:
|
||||
hookUrlBase: "{{ matrix_appservice_polychat_inbound_uri_prefix }}"
|
||||
|
||||
logging:
|
||||
console: true
|
||||
consoleLevel: {{ matrix_appservice_polychat_log_level }}
|
||||
writeFiles: false
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"defaultEnv": {
|
||||
"ENV": "NODE_ENV"
|
||||
},
|
||||
"development": {
|
||||
"driver": "sqlite3",
|
||||
"filename": "/data/development.db"
|
||||
},
|
||||
"production": {
|
||||
"driver": "sqlite3",
|
||||
"filename": "/data/production.db"
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
{% if matrix_appservice_polychat_container_labels_traefik_enabled %}
|
||||
traefik.enable=true
|
||||
|
||||
{% if matrix_appservice_polychat_container_labels_traefik_docker_network %}
|
||||
traefik.docker.network={{ matrix_appservice_polychat_container_labels_traefik_docker_network }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.services.matrix-appservice-polychat.loadbalancer.server.port={{ matrix_appservice_polychat_matrix_port }}
|
||||
|
||||
{% if matrix_appservice_polychat_container_labels_public_endpoint_enabled %}
|
||||
############################################################
|
||||
# #
|
||||
# Public #
|
||||
# #
|
||||
############################################################
|
||||
|
||||
traefik.http.middlewares.matrix-appservice-polychat-public-strip-prefix.stripprefix.prefixes={{ matrix_appservice_polychat_container_labels_public_endpoint_prefix }}
|
||||
|
||||
traefik.http.routers.matrix-appservice-polychat-public.rule={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_rule }}
|
||||
traefik.http.routers.matrix-appservice-polychat-public.middlewares=matrix-appservice-polychat-public-strip-prefix
|
||||
|
||||
{% if matrix_appservice_polychat_container_labels_public_endpoint_traefik_priority | int > 0 %}
|
||||
traefik.http.routers.matrix-appservice-polychat-public.priority={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_priority }}
|
||||
{% endif %}
|
||||
|
||||
traefik.http.routers.matrix-appservice-polychat-public.service=matrix-appservice-polychat
|
||||
traefik.http.routers.matrix-appservice-polychat-public.entrypoints={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_entrypoints }}
|
||||
|
||||
traefik.http.routers.matrix-appservice-polychat-public.tls={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls | to_json }}
|
||||
{% if matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls %}
|
||||
traefik.http.routers.matrix-appservice-polychat-public.tls.certResolver={{ matrix_appservice_polychat_container_labels_public_endpoint_traefik_tls_certResolver }}
|
||||
{% endif %}
|
||||
|
||||
############################################################
|
||||
# #
|
||||
# /Public #
|
||||
# #
|
||||
############################################################
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{{ matrix_appservice_polychat_container_labels_additional_labels }}
|
@ -0,0 +1,54 @@
|
||||
"$schema": "http://json-schema.org/draft-04/schema#"
|
||||
type: "object"
|
||||
properties:
|
||||
provisioning:
|
||||
type: "object"
|
||||
properties:
|
||||
secret:
|
||||
type: "string"
|
||||
homeserver:
|
||||
type: "object"
|
||||
properties:
|
||||
domain:
|
||||
type: "string"
|
||||
url:
|
||||
type: "string"
|
||||
mediaUrl:
|
||||
type: "string"
|
||||
web:
|
||||
type: "object"
|
||||
properties:
|
||||
hookUrlBase:
|
||||
type: "string"
|
||||
webhookBot:
|
||||
type: "object"
|
||||
properties:
|
||||
localpart:
|
||||
type: "string"
|
||||
appearance:
|
||||
type: "object"
|
||||
properties:
|
||||
displayName:
|
||||
type: "string"
|
||||
avatarUrl:
|
||||
type: "string"
|
||||
logging:
|
||||
type: "object"
|
||||
properties:
|
||||
file:
|
||||
type: "string"
|
||||
console:
|
||||
type: "boolean"
|
||||
consoleLevel:
|
||||
type: "string"
|
||||
fileLevel:
|
||||
type: "string"
|
||||
writeFiles:
|
||||
type: "boolean"
|
||||
rotate:
|
||||
type: "object"
|
||||
properties:
|
||||
size:
|
||||
type: "number"
|
||||
count:
|
||||
type: "number"
|
@ -0,0 +1,51 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix Appservice polychat bridge
|
||||
{% for service in matrix_appservice_polychat_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_appservice_polychat_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ 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-appservice-polychat 2>/dev/null || true'
|
||||
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-appservice-polychat 2>/dev/null || true'
|
||||
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||||
--rm \
|
||||
--name=matrix-appservice-polychat \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--network={{ matrix_appservice_polychat_container_network }} \
|
||||
{% if matrix_appservice_polychat_container_http_host_bind_port %}
|
||||
-p {{ matrix_appservice_polychat_container_http_host_bind_port }}:{{matrix_appservice_polychat_matrix_port}} \
|
||||
{% endif %}
|
||||
--mount type=bind,src={{ matrix_appservice_polychat_config_path }},dst=/config \
|
||||
--mount type=bind,src={{ matrix_appservice_polychat_data_path }},dst=/data \
|
||||
--label-file={{ matrix_appservice_polychat_base_path }}/labels \
|
||||
{% for arg in matrix_appservice_polychat_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_appservice_polychat_docker_image }} \
|
||||
node index.js -p {{ matrix_appservice_polychat_matrix_port }} -c /config/config.yaml -f /config/polychat-registration.yaml
|
||||
|
||||
{% for network in matrix_appservice_polychat_container_additional_networks %}
|
||||
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-appservice-polychat
|
||||
{% endfor %}
|
||||
|
||||
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach matrix-appservice-polychat
|
||||
|
||||
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-appservice-polychat 2>/dev/null || true'
|
||||
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm matrix-appservice-polychat 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-appservice-polychat
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in new issue