Compare commits
1 Commits
main
...
db651723b2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db651723b2 |
@@ -1 +0,0 @@
|
||||
Sets up a caddy container and a systemd socket unit, forwarding traffic from it to target container
|
||||
@@ -14,4 +14,3 @@ container_auto_update: true
|
||||
container_requires: []
|
||||
container_wants: []
|
||||
container_add_capabilities: []
|
||||
container_reload_method: none
|
||||
|
||||
@@ -4,9 +4,3 @@
|
||||
systemd_restart_units: "{{ systemd_restart_units + [container_name ~ '.service'] }}" # noqa: var-naming[no-role-prefix]
|
||||
changed_when: true
|
||||
notify: Apply systemd unit restarts
|
||||
|
||||
- name: Reload container service {{ container_name }}
|
||||
ansible.builtin.systemd_service:
|
||||
name: "{{ container_name }}.service"
|
||||
state: reloaded
|
||||
when: "container_name ~ '.service' not in systemd_restart_units"
|
||||
|
||||
@@ -212,21 +212,3 @@ argument_specs:
|
||||
type: bool
|
||||
required: false
|
||||
default: true
|
||||
container_reload_method:
|
||||
description: |
|
||||
How to reload configuration when systemctl reload is called
|
||||
kill: Sends SIGHUP to the container
|
||||
command: Runs the specified command inside the container
|
||||
type: str
|
||||
required: false
|
||||
default: none
|
||||
choices:
|
||||
- kill
|
||||
- command
|
||||
- none
|
||||
container_reload_command:
|
||||
description: >-
|
||||
Command to run inside container when systemctl reload is called.
|
||||
Required if container_reload_method is command, ignored otherwise.
|
||||
type: str
|
||||
required: false
|
||||
|
||||
@@ -69,10 +69,6 @@ _container_labels: >-
|
||||
else {}
|
||||
}}
|
||||
|
||||
_container_reload_commands:
|
||||
kill: podman kill --signal HUP {{ container_name }}
|
||||
command: podman exec {{ container_name }} {{ container_reload_command }}
|
||||
|
||||
_container_quadlet_unit_options: |
|
||||
[Unit]
|
||||
Description=Container {{ container_name }}
|
||||
@@ -94,12 +90,8 @@ _container_quadlet_auto_start_options: |
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
_container_quadlet_reload_options: |
|
||||
[Service]
|
||||
ExecReload={{ _container_reload_commands[container_reload_method] }}
|
||||
_container_quadlet_options_incl_empty:
|
||||
- "{{ 'AutoUpdate=registry' if container_auto_update else '' }}"
|
||||
- "{{ _container_quadlet_unit_options }}"
|
||||
- "{{ _container_quadlet_auto_start_options if container_auto_start else '' }}"
|
||||
- "{{ _container_quadlet_reload_options if container_reload_method != 'none' else '' }}"
|
||||
_container_quadlet_options: "{{ _container_quadlet_options_incl_empty | select('!=', '') }}"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Sets up a headscale container
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
headscale_oidc_issuer_url: ""
|
||||
headscale_oidc_client_id: ""
|
||||
headscale_oidc_client_secret: ""
|
||||
@@ -1,85 +0,0 @@
|
||||
---
|
||||
argument_specs:
|
||||
main:
|
||||
description: "Sets up a headscale container"
|
||||
options:
|
||||
headscale_domain:
|
||||
description: Domain headscale should be available at
|
||||
type: str
|
||||
required: true
|
||||
headscale_magicdns_base_domain:
|
||||
description: Base domain for magic dns hostnames
|
||||
type: str
|
||||
required: true
|
||||
headscale_policy:
|
||||
description:
|
||||
- Headscale policy configuration.
|
||||
- See https://headscale.net/stable/ref/acls/
|
||||
- This role's support for acls is currently quite limited. Waiting for headscale to release grants support.
|
||||
type: dict
|
||||
required: true
|
||||
options:
|
||||
groups:
|
||||
description: >-
|
||||
Groups of users. Formatted as dict where dict key is group name and
|
||||
value is a list of users in the group.
|
||||
type: dict
|
||||
required: false
|
||||
hosts:
|
||||
description: Mapping of host names to ip addresses
|
||||
type: dict
|
||||
required: false
|
||||
tagOwners:
|
||||
description: Mapping of tags to lists of their owners
|
||||
type: dict
|
||||
required: false
|
||||
acls:
|
||||
description: List of acls
|
||||
type: list
|
||||
required: true
|
||||
elements: dict
|
||||
options:
|
||||
action:
|
||||
description: ACL action
|
||||
type: str
|
||||
required: true
|
||||
choices:
|
||||
- accept
|
||||
- check
|
||||
src:
|
||||
description: >-
|
||||
A list of sources, formatted as prefix:name:ports,
|
||||
where prefix is the type of object, like tag: or group:,
|
||||
name is the object name and ports is a comma separated list of ports or *
|
||||
type: list
|
||||
required: true
|
||||
elements: str
|
||||
dst:
|
||||
description: A list of destinations. Same format as sources.
|
||||
type: list
|
||||
required: true
|
||||
elements: str
|
||||
proto:
|
||||
description: Protocol
|
||||
type: str
|
||||
required: false
|
||||
choices:
|
||||
- tcp
|
||||
- udp
|
||||
- icmp
|
||||
|
||||
headscale_oidc_issuer_url:
|
||||
description: OIDC issuer url. Leave unset to not use OIDC.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
headscale_oidc_client_id:
|
||||
description: OIDC client id. Required if OIDC issuer is set.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
headscale_oidc_client_secret:
|
||||
description: OIDC client secret. Required if OIDC issuer is set.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
@@ -1,36 +0,0 @@
|
||||
---
|
||||
- name: Headscale service
|
||||
ansible.builtin.import_role:
|
||||
name: service
|
||||
vars:
|
||||
service_name: headscale
|
||||
service_container_image: docker.io/headscale/headscale:stable
|
||||
service_container_command: serve
|
||||
service_container_mounts:
|
||||
- type: volume
|
||||
source: data
|
||||
destination: /var/lib/headscale
|
||||
- type: template
|
||||
source: config.yaml.j2
|
||||
destination: /etc/headscale/config.yaml
|
||||
- type: template
|
||||
source: policy.hujson.j2
|
||||
destination: /etc/headscale/policy.hujson
|
||||
template_validate_command: headscale policy check --file /etc/headscale/policy.hujson
|
||||
service_container_http_port: 8080
|
||||
service_domains:
|
||||
- "{{ headscale_domain }}"
|
||||
service_container_publish_ports:
|
||||
- name: stun
|
||||
container_port: 3478
|
||||
protocol: udp
|
||||
host_port: 3478
|
||||
service_container_secrets: "{{ _headscale_secrets }}"
|
||||
service_container_reload_method: kill
|
||||
|
||||
- name: Open port for stun
|
||||
ansible.posix.firewalld:
|
||||
service: stun
|
||||
state: enabled
|
||||
permanent: true
|
||||
immediate: true
|
||||
@@ -1,56 +0,0 @@
|
||||
---
|
||||
# vim:ft=yaml
|
||||
# {{ ansible_managed }}
|
||||
|
||||
listen_addr: 0.0.0.0:8080
|
||||
server_url: https://{{ headscale_domain }}
|
||||
|
||||
noise:
|
||||
private_key_path: /var/lib/headscale/noise_private.key
|
||||
|
||||
prefixes:
|
||||
v4: 100.64.0.0/10
|
||||
v6: fd7a:115c:a1e0::/48
|
||||
|
||||
allocation: sequential
|
||||
|
||||
derp:
|
||||
server:
|
||||
enabled: true
|
||||
region_id: 999
|
||||
region_code: "headscale"
|
||||
region_name: "Headscale embedded DERP"
|
||||
verify_clients: true
|
||||
stun_listen_addr: "0.0.0.0:3478"
|
||||
private_key_path: /var/lib/headscale/derp_server_private.key
|
||||
|
||||
urls: []
|
||||
|
||||
database:
|
||||
type: sqlite
|
||||
sqlite:
|
||||
path: /var/lib/headscale/db.sqlite
|
||||
|
||||
policy:
|
||||
mode: file
|
||||
path: /etc/headscale/policy.hujson
|
||||
|
||||
dns:
|
||||
magic_dns: true
|
||||
base_domain: {{ headscale_magicdns_base_domain }}
|
||||
nameservers:
|
||||
global:
|
||||
- https://dns.quad9.net/dns-query
|
||||
|
||||
logtail:
|
||||
enabled: false
|
||||
|
||||
{% if headscale_oidc_issuer_url | length > 0 %}
|
||||
oidc:
|
||||
only_start_if_oidc_is_available: false
|
||||
issuer: {{ headscale_oidc_issuer_url }}
|
||||
client_id: "{{ headscale_oidc_client_id }}"
|
||||
client_secret_path: /run/secrets/oidc-client-secret
|
||||
pkce:
|
||||
enabled: true
|
||||
{% endif %}
|
||||
@@ -1,3 +0,0 @@
|
||||
// {{ ansible_managed }}
|
||||
|
||||
{{ headscale_policy | to_nice_json }}
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
_headscale_oidc_secret:
|
||||
name: oidc-client-secret
|
||||
value: "{{ headscale_oidc_client_secret }}"
|
||||
|
||||
_headscale_secrets: "{{ [_headscale_oidc_secret] if headscale_oidc_issuer_url | length > 0 else [] }}"
|
||||
@@ -46,6 +46,11 @@ passwords:
|
||||
algorithm: argon2id
|
||||
minimum_complexity: 3
|
||||
|
||||
clients:
|
||||
- client_id: 0000000000000000000SYNAPSE
|
||||
client_auth_method: client_secret_basic
|
||||
client_secret: "{{ matrix_authentication_service_client_secret }}"
|
||||
|
||||
matrix:
|
||||
homeserver: {{ matrix_authentication_service_homeserver_name }}
|
||||
secret: "{{ matrix_authentication_service_homeserver_secret }}"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
---
|
||||
nextcloud_tag: stable
|
||||
nextcloud_install_harp: false
|
||||
nextcloud_additional_networks: []
|
||||
|
||||
@@ -22,9 +22,3 @@ argument_specs:
|
||||
type: bool
|
||||
required: false
|
||||
default: false
|
||||
nextcloud_additional_networks:
|
||||
description: Additional docker networks to add nextcloud container to
|
||||
type: list
|
||||
elements: str
|
||||
required: false
|
||||
default: []
|
||||
|
||||
@@ -29,4 +29,3 @@
|
||||
NEXTCLOUD_ADMIN_PASSWORD_FILE: /run/secrets/admin-password
|
||||
service_additional_containers: "{{ _nextcloud_additional_containers }}"
|
||||
service_vhost_locations: "{{ _nextcloud_vhost_locations }}"
|
||||
service_container_additional_networks: "{{ nextcloud_additional_networks }}"
|
||||
|
||||
@@ -9,7 +9,6 @@ service_proxy_pass_host_header: true
|
||||
service_proxy_auth_type: none
|
||||
|
||||
service_container_ip: ""
|
||||
service_container_hostname: ""
|
||||
service_container_additional_networks: []
|
||||
service_container_user: ""
|
||||
service_container_publish_ports: []
|
||||
@@ -18,8 +17,7 @@ service_container_devices: []
|
||||
service_container_secrets: []
|
||||
service_container_env: {}
|
||||
service_container_add_capabilities: []
|
||||
service_container_reload_method: none
|
||||
service_container_reload_command: ""
|
||||
service_container_pinp: false
|
||||
|
||||
service_database_type: none
|
||||
service_database_additional_networks: []
|
||||
|
||||
@@ -29,7 +29,7 @@ argument_specs:
|
||||
service_container_http_port:
|
||||
description:
|
||||
- Port inside the container where http requests are proxied to.
|
||||
- If set to 0, http requests are proxied to fd:3 inside the container
|
||||
- If set to 0, http requests are proxied to /run/<service name>.sock inside the container
|
||||
type: int
|
||||
required: false
|
||||
default: 0
|
||||
@@ -82,11 +82,6 @@ argument_specs:
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
service_container_hostname:
|
||||
description: Hostname to set inside the container.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
service_container_additional_networks:
|
||||
description: >-
|
||||
A list of additional podman networks for the service container (in
|
||||
@@ -113,14 +108,6 @@ argument_specs:
|
||||
description: Container port to publish
|
||||
type: int
|
||||
required: true
|
||||
protocol:
|
||||
description: Protocol of the port
|
||||
type: str
|
||||
required: false
|
||||
default: tcp
|
||||
choices:
|
||||
- tcp
|
||||
- udp
|
||||
type:
|
||||
description: Whether to publish as a port or socket
|
||||
type: str
|
||||
@@ -215,14 +202,6 @@ argument_specs:
|
||||
elements: str
|
||||
required: false
|
||||
default: []
|
||||
template_validate_command:
|
||||
description: >-
|
||||
Command used to verify templated file validity.
|
||||
Will be run in a temporary container using the same container image as the main service.
|
||||
File will be available in the same place as in the service container (destination).
|
||||
Only applicable if mount type is template
|
||||
type: str
|
||||
required: false
|
||||
service_container_devices:
|
||||
description: List of devices to be added inside the service main container.
|
||||
type: list
|
||||
@@ -298,25 +277,21 @@ argument_specs:
|
||||
default: []
|
||||
elements: str
|
||||
|
||||
service_container_reload_method:
|
||||
description: |
|
||||
How to reload configuration when systemctl reload is called
|
||||
kill: Sends SIGHUP to the container
|
||||
command: Runs the specified command inside the container
|
||||
type: str
|
||||
service_container_pinp:
|
||||
description:
|
||||
- If true, runs the container with podman in podman
|
||||
- This starts a podman service inside the outer container
|
||||
- The podman socket is exposed to the inner container at /var/run/docker.sock
|
||||
- >-
|
||||
This allows the container to manage other containers, which are run inside the
|
||||
same outer container
|
||||
- >-
|
||||
The inner containers use host networking, so they share the network namespace
|
||||
with the outer container and each other.
|
||||
- This support is experimental and may not work with all images or configurations.
|
||||
type: bool
|
||||
required: false
|
||||
default: none
|
||||
choices:
|
||||
- kill
|
||||
- command
|
||||
- none
|
||||
service_container_reload_command:
|
||||
description: >-
|
||||
Command to run inside container when systemctl reload is called.
|
||||
Required if container_reload_method is command, ignored otherwise.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
default: false
|
||||
|
||||
service_database_type:
|
||||
description:
|
||||
@@ -523,7 +498,7 @@ argument_specs:
|
||||
- Name of the port.
|
||||
- >-
|
||||
If type is socket, the socket will be created at
|
||||
/run/<service name>-<port name>-socat.sock on the host.
|
||||
/run/<service name>-<additional container name>-<port name>.sock on the host.
|
||||
- If type is not socket, this is just informative.
|
||||
type: str
|
||||
required: true
|
||||
@@ -531,14 +506,6 @@ argument_specs:
|
||||
description: Container port to publish
|
||||
type: int
|
||||
required: true
|
||||
protocol:
|
||||
description: Protocol of the port
|
||||
type: str
|
||||
required: false
|
||||
default: tcp
|
||||
choices:
|
||||
- tcp
|
||||
- udp
|
||||
type:
|
||||
description: Whether to publish as a port or socket
|
||||
type: str
|
||||
@@ -573,25 +540,6 @@ argument_specs:
|
||||
type: list
|
||||
required: false
|
||||
elements: str
|
||||
reload_method:
|
||||
description: |
|
||||
How to reload configuration when systemctl reload is called
|
||||
kill: Sends SIGHUP to the container
|
||||
command: Runs the specified command inside the container
|
||||
type: str
|
||||
required: false
|
||||
default: none
|
||||
choices:
|
||||
- kill
|
||||
- command
|
||||
- none
|
||||
reload_command:
|
||||
description: >-
|
||||
Command to run inside container when systemctl reload is called.
|
||||
Required if container_reload_method is command, ignored otherwise.
|
||||
type: str
|
||||
required: false
|
||||
default: ""
|
||||
secrets:
|
||||
description:
|
||||
- >
|
||||
@@ -639,23 +587,21 @@ argument_specs:
|
||||
the name of the environment variable. Defaults to secret name.
|
||||
type: str
|
||||
required: false
|
||||
requires:
|
||||
description: >-
|
||||
List of systemd units this container depends on, in addition to
|
||||
service-wide requires.
|
||||
type: list
|
||||
pinp:
|
||||
description:
|
||||
- If true, runs the container with podman in podman
|
||||
- This starts a podman service inside the outer container
|
||||
- The podman socket is exposed to the inner container at /var/run/docker.sock
|
||||
- >-
|
||||
This allows the container to manage other containers, which are run inside the
|
||||
same outer container
|
||||
- >-
|
||||
The inner containers use host networking, so they share the network namespace
|
||||
with the outer container and each other.
|
||||
- This support is experimental and may not work with all images or configurations.
|
||||
type: bool
|
||||
required: false
|
||||
default: []
|
||||
elements: str
|
||||
wants:
|
||||
description: >-
|
||||
List of systemd units this container weakly depends on, in addition to
|
||||
service-wide wants.
|
||||
type: list
|
||||
required: false
|
||||
default: []
|
||||
elements: str
|
||||
|
||||
default: false
|
||||
|
||||
service_requires:
|
||||
description: List of systemd units this service container depends on.
|
||||
|
||||
@@ -4,21 +4,19 @@
|
||||
name: container
|
||||
vars:
|
||||
container_name: "{{ _service_additional_container.name }}"
|
||||
container_image: "{{ _service_additional_container.image }}"
|
||||
container_command: "{{ _service_additional_container.command }}"
|
||||
container_entrypoint: "{{ _service_additional_container.entrypoint }}"
|
||||
container_user: "{{ _service_additional_container.user }}"
|
||||
container_mounts: "{{ _service_additional_container_mounts }}"
|
||||
container_image: "{{ _service_additional_container_final.image }}"
|
||||
container_entrypoint: "{{ _service_additional_container_final.entrypoint }}"
|
||||
container_command: "{{ _service_additional_container_final.command }}"
|
||||
container_user: "{{ _service_additional_container_final.user }}"
|
||||
container_mounts: "{{ _service_additional_container_final.mounts }}"
|
||||
container_devices: "{{ _service_additional_container.devices }}"
|
||||
container_publish_ports: "{{ _service_additional_container_publish_ports }}"
|
||||
container_networks: "{{ _service_additional_container_networks }}"
|
||||
container_hostname: "{{ _service_additional_container.name | regex_replace('^' ~ service_name ~ '-', '') }}"
|
||||
container_secrets: "{{ _service_additional_container_secrets }}"
|
||||
container_env: "{{ _service_additional_container.env }}"
|
||||
container_env: "{{ _service_additional_container_final.env }}"
|
||||
container_add_capabilities: "{{ _service_additional_container.add_capabilities }}"
|
||||
container_reload_method: "{{ _service_additional_container.reload_method }}"
|
||||
container_reload_command: "{{ _service_additional_container.reload_command }}"
|
||||
container_requires: "{{ _service_additional_container_requires }}"
|
||||
container_requires: "{{ _service_container_requires }}"
|
||||
container_wants: "{{ _service_additional_container_wants }}"
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
loop: "{{ _service_additional_containers }}"
|
||||
|
||||
@@ -23,18 +23,8 @@
|
||||
src: "{{ item[0].source }}"
|
||||
dest: "{{ item[1] }}"
|
||||
mode: "{{ item[0].mode | default('0644') }}"
|
||||
validate: "{{ validate if item[0].template_validate_command is defined else omit }}"
|
||||
notify: >-
|
||||
{{ 'Reload' if service_container_reload_method != 'none' else 'Restart' }}
|
||||
container service {{ service_name }}
|
||||
notify: Restart container service {{ service_name }}
|
||||
loop: "{{ _service_all_template_mounts | zip(_service_all_template_mount_host_files) }}"
|
||||
vars:
|
||||
validate: >-
|
||||
podman run --rm
|
||||
-v %s:{{ item[0].destination }}:ro
|
||||
--entrypoint {{ item[0].template_validate_command.split(' ', 1)[0] }}
|
||||
{{ service_container_image }}
|
||||
{{ item[0].template_validate_command.split(' ', 1)[1] }}
|
||||
|
||||
- name: Copy files for copy mounts
|
||||
ansible.builtin.copy:
|
||||
@@ -44,3 +34,28 @@
|
||||
directory_mode: "0755"
|
||||
notify: Restart container service {{ service_name }}
|
||||
loop: "{{ _service_all_copy_mounts | zip(_service_all_copy_mount_host_files) }}"
|
||||
|
||||
- name: Template entrypoint for pinp
|
||||
ansible.builtin.template:
|
||||
src: "pinp-entrypoint.sh.j2"
|
||||
dest: "{{ _service_host_directory }}/mounts/pinp-entrypoint.sh"
|
||||
mode: "0755"
|
||||
vars:
|
||||
pinp_inner_name: "{{ service_name }}"
|
||||
pinp_inner_image: "{{ service_container_image }}"
|
||||
pinp_inner_mounts: "{{ _service_container_pinp_inner_mounts }}"
|
||||
pinp_inner_env: "{{ service_container_env }}"
|
||||
when: service_container_pinp
|
||||
- name: Template entrypoint for pinp of additional containers
|
||||
ansible.builtin.template:
|
||||
src: "pinp-entrypoint.sh.j2"
|
||||
dest: "{{ _service_host_directory }}/mounts/{{ _service_additional_container.name }}-pinp-entrypoint.sh"
|
||||
mode: "0755"
|
||||
loop: "{{ _service_additional_containers | selectattr('pinp') }}"
|
||||
loop_control:
|
||||
loop_var: _service_additional_container
|
||||
vars:
|
||||
pinp_inner_name: "{{ _service_additional_container.name }}"
|
||||
pinp_inner_image: "{{ _service_additional_container.image }}"
|
||||
pinp_inner_mounts: "{{ _service_additional_container_pinp_inner_mounts }}"
|
||||
pinp_inner_env: "{{ _service_additional_container.env }}"
|
||||
|
||||
@@ -14,9 +14,12 @@
|
||||
ansible.builtin.include_tasks: secrets.yaml
|
||||
when: _service_container_secrets | length > 0
|
||||
|
||||
- name: Template mounts for {{ service_name }}
|
||||
- name: Host mounts for {{ service_name }}
|
||||
ansible.builtin.include_tasks: host_mounts.yaml
|
||||
when: (_service_all_template_mounts + _service_all_copy_mounts) | length > 0
|
||||
when: >-
|
||||
(_service_all_template_mounts + _service_all_copy_mounts) | length > 0
|
||||
or service_container_pinp
|
||||
or (_service_additional_containers | selectattr('pinp') | length > 0)
|
||||
|
||||
- name: Additional containers for {{ service_name }}
|
||||
ansible.builtin.include_tasks: additional.yaml
|
||||
@@ -36,20 +39,17 @@
|
||||
name: container
|
||||
vars:
|
||||
container_name: "{{ service_name }}"
|
||||
container_image: "{{ service_container_image }}"
|
||||
container_command: "{{ service_container_command }}"
|
||||
container_entrypoint: "{{ service_container_entrypoint }}"
|
||||
container_user: "{{ service_container_user }}"
|
||||
container_mounts: "{{ _service_container_mounts }}"
|
||||
container_image: "{{ _service_container.image }}"
|
||||
container_entrypoint: "{{ _service_container.entrypoint }}"
|
||||
container_command: "{{ _service_container.command }}"
|
||||
container_user: "{{ _service_container.user }}"
|
||||
container_mounts: "{{ _service_container.mounts }}"
|
||||
container_devices: "{{ service_container_devices }}"
|
||||
container_publish_ports: "{{ _service_container_publish_ports }}"
|
||||
container_networks: "{{ _service_container_networks }}"
|
||||
container_hostname: "{{ service_container_hostname }}"
|
||||
container_secrets: "{{ _service_container_secrets }}"
|
||||
container_env: "{{ service_container_env }}"
|
||||
container_env: "{{ _service_container.env }}"
|
||||
container_add_capabilities: "{{ service_container_add_capabilities }}"
|
||||
container_reload_method: "{{ service_container_reload_method }}"
|
||||
container_reload_command: "{{ service_container_reload_command }}"
|
||||
container_requires: "{{ _service_container_requires }}"
|
||||
container_wants: "{{ _service_container_wants }}"
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
@@ -8,9 +8,5 @@
|
||||
container_networks:
|
||||
- name: "{{ service_name }}"
|
||||
ip: "{{ service_container_ip | ansible.utils.ipmath(2) if _service_static_ip else '' }}"
|
||||
container_mounts:
|
||||
- type: volume
|
||||
source: "{{ service_name }}-redis"
|
||||
destination: /data
|
||||
container_hostname: redis
|
||||
container_auto_update: "{{ service_auto_update }}"
|
||||
|
||||
26
roles/service/templates/pinp-entrypoint.sh.j2
Normal file
26
roles/service/templates/pinp-entrypoint.sh.j2
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
# {{ ansible_managed }}
|
||||
_term() {
|
||||
echo "Received SIGTERM, stopping all containers"
|
||||
kill "$child"
|
||||
}
|
||||
|
||||
podman system service -t 0 &
|
||||
|
||||
podman run \
|
||||
--rm \
|
||||
-v /run/secrets:/run/secrets:ro \
|
||||
{% for key, value in pinp_inner_env.items() %}
|
||||
-e {{ key }}={{ value }} \
|
||||
{% endfor %}
|
||||
-v /tmp/storage-run-1000/podman/podman.sock:/var/run/docker.sock \
|
||||
{% for mount in pinp_inner_mounts %}
|
||||
--mount type={{ mount.type }},source={{ mount.source }},destination={{ mount.destination }}{% if mount.readonly | default(false) %},readonly{% endif %} \
|
||||
{% endfor %}
|
||||
--name {{ pinp_inner_name }} \
|
||||
--network host \
|
||||
{{ pinp_inner_image }} &
|
||||
|
||||
child=$!
|
||||
trap _term SIGTERM
|
||||
wait "$!"
|
||||
@@ -1,12 +1,7 @@
|
||||
---
|
||||
_service_additional_container_defaults:
|
||||
image: "{{ service_container_image }}"
|
||||
requires: []
|
||||
wants: []
|
||||
|
||||
_service_additional_containers_with_default_image: >-
|
||||
{{
|
||||
([_service_additional_container_defaults] * service_additional_containers | length)
|
||||
([{ 'image': service_container_image }] * service_additional_containers | length)
|
||||
| zip(service_additional_containers)
|
||||
| map('combine')
|
||||
}}
|
||||
@@ -18,8 +13,7 @@ _service_additional_container_same_image_defaults:
|
||||
devices: "{{ service_container_devices }}"
|
||||
env: "{{ service_container_env }}"
|
||||
add_capabilities: "{{ service_container_add_capabilities }}"
|
||||
reload_method: "{{ service_container_reload_method }}"
|
||||
reload_command: "{{ service_container_reload_command }}"
|
||||
pinp: false
|
||||
|
||||
_service_additional_container_different_image_defaults:
|
||||
user: ""
|
||||
@@ -30,9 +24,8 @@ _service_additional_container_different_image_defaults:
|
||||
publish_ports: []
|
||||
env: {}
|
||||
add_capabilities: []
|
||||
reload_method: none
|
||||
reload_command: ""
|
||||
secrets: []
|
||||
pinp: false
|
||||
|
||||
_service_additional_same_image_containers: >-
|
||||
{{
|
||||
@@ -81,16 +74,13 @@ _service_additional_containers: >-
|
||||
|
||||
_service_additional_container_wants: >-
|
||||
{{
|
||||
service_wants + _service_additional_container.wants +
|
||||
_service_additional_container_publish_socket_ports
|
||||
service_wants
|
||||
+ _service_additional_container_publish_socket_ports
|
||||
| map(attribute='name')
|
||||
| map('regex_replace', '^', service_name ~ '-')
|
||||
| map('regex_replace', '$', '-socat.socket')
|
||||
}}
|
||||
|
||||
_service_additional_container_requires: >-
|
||||
{{ _service_container_requires + _service_additional_container.requires }}
|
||||
|
||||
_service_additional_container_networks: >-
|
||||
{{
|
||||
[{
|
||||
@@ -156,7 +146,6 @@ _service_additional_container_publish_ports: >-
|
||||
_service_additional_container_publish_port_ports | map(attribute='host_port'),
|
||||
_service_additional_container_publish_port_ports | map(attribute='container_port')
|
||||
) | map('join', ':')
|
||||
| zip(_service_additional_container_publish_port_ports | map(attribute='protocol')) | map('join', '/')
|
||||
}}
|
||||
|
||||
_service_additional_volume_mounts: "{{ _service_additional_container.mounts | selectattr('type', '==', 'volume') }}"
|
||||
@@ -181,7 +170,7 @@ _service_additional_container_template_mounts: >-
|
||||
([{'readonly': true}] * _service_additional_template_mounts | length) |
|
||||
zip(
|
||||
_service_additional_template_mounts |
|
||||
community.general.remove_keys(['mode', 'template_validate_command']),
|
||||
community.general.remove_keys(['mode']),
|
||||
_service_additional_template_mounts |
|
||||
map(attribute='source') |
|
||||
map('regex_replace', '\.j2$', '') |
|
||||
@@ -217,3 +206,59 @@ _service_additional_container_mounts: >-
|
||||
else
|
||||
_service_container_mounts
|
||||
}}
|
||||
|
||||
|
||||
_service_additional_plain_container:
|
||||
image: "{{ _service_additional_container.image }}"
|
||||
entrypoint: "{{ _service_additional_container.entrypoint }}"
|
||||
command: "{{ _service_additional_container.command }}"
|
||||
user: "{{ _service_additional_container.user }}"
|
||||
env: "{{ _service_additional_container.env }}"
|
||||
mounts: "{{ _service_additional_container_mounts }}"
|
||||
|
||||
_service_additional_pinp_container_mounts:
|
||||
- type: bind
|
||||
source: "{{ _service_host_directory }}/mounts/{{ _service_additional_container.name }}-entrypoint.sh"
|
||||
destination: /entrypoint.sh
|
||||
readonly: true
|
||||
- type: volume
|
||||
source: "{{ _service_additional_container.name }}-containers"
|
||||
destination: /home/podman/.local/share/containers
|
||||
|
||||
_service_additional_pinp_container:
|
||||
image: quay.io/podman/stable:latest
|
||||
entrypoint: /entrypoint.sh
|
||||
command: []
|
||||
user: podman
|
||||
env: {}
|
||||
mounts: >-
|
||||
{{
|
||||
_service_additional_pinp_container_mounts
|
||||
+ (
|
||||
_service_additional_container_mounts
|
||||
| zip(
|
||||
_service_additional_container_mounts
|
||||
| map(attribute='source')
|
||||
| map('replace', '/', '_')
|
||||
| map('regex_replace', '^', '/mounts/')
|
||||
| map('community.general.dict_kv', 'destination')
|
||||
)
|
||||
| map('combine')
|
||||
)
|
||||
}}
|
||||
|
||||
_service_additional_container_final: >-
|
||||
{{ _service_additional_pinp_container if _service_additional_container.pinp else _service_additional_plain_container }}
|
||||
|
||||
_service_additional_container_pinp_inner_mounts: >-
|
||||
{{
|
||||
_service_additional_container_mounts
|
||||
| zip(
|
||||
_service_additional_container_mounts
|
||||
| map(attribute='source')
|
||||
| map('replace', '/', '_')
|
||||
| map('regex_replace', '^', '/mounts/')
|
||||
| map('community.general.dict_kv', 'source')
|
||||
)
|
||||
| map('combine')
|
||||
}}
|
||||
|
||||
@@ -30,7 +30,7 @@ _service_container_template_mounts: >-
|
||||
([{'readonly': true}] * _service_template_mounts | length) |
|
||||
zip(
|
||||
_service_template_mounts |
|
||||
community.general.remove_keys(['mode', 'template_validate_command']),
|
||||
community.general.remove_keys(['mode']),
|
||||
_service_template_mounts |
|
||||
map(attribute='source') |
|
||||
map('regex_replace', '\.j2$', '') |
|
||||
|
||||
55
roles/service/vars/main/pinp.yaml
Normal file
55
roles/service/vars/main/pinp.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
_service_plain_container:
|
||||
image: "{{ service_container_image }}"
|
||||
entrypoint: "{{ service_container_entrypoint }}"
|
||||
command: "{{ service_container_command }}"
|
||||
user: "{{ service_container_user }}"
|
||||
env: "{{ service_container_env }}"
|
||||
mounts: "{{ _service_container_mounts }}"
|
||||
|
||||
_service_pinp_container_mounts:
|
||||
- type: bind
|
||||
source: "{{ _service_host_directory }}/mounts/entrypoint.sh"
|
||||
destination: /entrypoint.sh
|
||||
readonly: true
|
||||
- type: volume
|
||||
source: "containers"
|
||||
destination: /home/podman/.local/share/containers
|
||||
|
||||
_service_pinp_container:
|
||||
image: quay.io/podman/stable:latest
|
||||
entrypoint: /entrypoint.sh
|
||||
command: []
|
||||
user: podman
|
||||
env: {}
|
||||
mounts: >-
|
||||
{{
|
||||
_service_pinp_container_mounts
|
||||
+ (
|
||||
_service_container_mounts
|
||||
| zip(
|
||||
_service_container_mounts
|
||||
| map(attribute='source')
|
||||
| map('replace', '/', '_')
|
||||
| map('regex_replace', '^', '/mounts/')
|
||||
| map('community.general.dict_kv', 'destination')
|
||||
)
|
||||
| map('combine')
|
||||
)
|
||||
}}
|
||||
|
||||
_service_container: >-
|
||||
{{ _service_pinp_container if service_container_pinp else _service_plain_container }}
|
||||
|
||||
_service_container_pinp_inner_mounts: >-
|
||||
{{
|
||||
_service_container_mounts
|
||||
| zip(
|
||||
_service_container_mounts
|
||||
| map(attribute='source')
|
||||
| map('replace', '/', '_')
|
||||
| map('regex_replace', '^', '/mounts/')
|
||||
| map('community.general.dict_kv', 'source')
|
||||
)
|
||||
| map('combine')
|
||||
}}
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
_service_container_publish_ports_with_defaults: >-
|
||||
{{
|
||||
([{ 'type': 'port', 'host_address': '0.0.0.0', 'protocol': 'tcp' }] * service_container_publish_ports | length)
|
||||
([{ 'type': 'port', 'host_address': '0.0.0.0' }] * service_container_publish_ports | length)
|
||||
| zip(service_container_publish_ports)
|
||||
| map('combine')
|
||||
}}
|
||||
@@ -13,10 +13,9 @@ _service_container_publish_port_ports: >-
|
||||
|
||||
_service_container_publish_ports: >-
|
||||
{{
|
||||
_service_container_publish_port_ports | map(attribute='host_address')
|
||||
| zip(
|
||||
_service_container_publish_port_ports | map(attribute='host_address') |
|
||||
zip(
|
||||
_service_container_publish_port_ports | map(attribute='host_port'),
|
||||
_service_container_publish_port_ports | map(attribute='container_port')
|
||||
) | map('join', ':')
|
||||
| zip(_service_container_publish_port_ports | map(attribute='protocol')) | map('join', '/')
|
||||
}}
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
service_domains: "{{ [synapse_external_domain] }}"
|
||||
service_vhost_locations:
|
||||
- path: ^/_matrix/client/.*/(login|logout|refresh).*$
|
||||
proxy_target_socket: /run/matrix-authentication-service-caddy-socket-proxy.sock
|
||||
proxy_target_socket: /run/matrix-authentication-service-socat.sock
|
||||
service_wants:
|
||||
- matrix-authentication-service.service
|
||||
|
||||
|
||||
@@ -106,7 +106,12 @@ auto_accept_invites: {{ synapse_auto_accept_invites }}
|
||||
auto_join_rooms: {{ synapse_auto_join_rooms }}
|
||||
autocreate_auto_join_rooms: false
|
||||
|
||||
matrix_authentication_service:
|
||||
enabled: true
|
||||
endpoint: http://matrix-authentication-service:8080/
|
||||
secret: "{{ service_podman_secrets['synapse-mas-homeserver-secret'] }}"
|
||||
experimental_features:
|
||||
msc3861:
|
||||
enabled: true
|
||||
issuer: http://matrix-authentication-service:8080/
|
||||
client_id: 0000000000000000000SYNAPSE
|
||||
client_auth_method: client_secret_basic
|
||||
client_secret: "{{ service_podman_secrets['synapse-mas-client-secret'] }}"
|
||||
admin_token: "{{ service_podman_secrets['synapse-mas-homeserver-secret'] }}"
|
||||
account_management_url: "https://{{ synapse_mas_domain }}/account"
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Installs windmill with worker in podman in podman
|
||||
@@ -17,26 +17,8 @@
|
||||
DATABASE_URL_FILE: /run/secrets/postgres-url
|
||||
MODE: server
|
||||
service_additional_containers:
|
||||
- name: worker-pinp
|
||||
image: quay.io/podman/stable:latest
|
||||
user: podman
|
||||
command:
|
||||
- podman
|
||||
- system
|
||||
- service
|
||||
- --time
|
||||
- "0"
|
||||
mounts:
|
||||
- type: volume
|
||||
source: worker-pinp-containers
|
||||
destination: /home/podman/.local/share/containers
|
||||
- type: volume
|
||||
source: worker-pinp-tmp
|
||||
destination: /tmp/storage-run-1000
|
||||
- type: volume
|
||||
source: worker-pinp-run
|
||||
destination: /tmp/storage-run-1000/podman
|
||||
- name: worker
|
||||
pinp: true
|
||||
mounts:
|
||||
- type: volume
|
||||
source: worker-logs
|
||||
@@ -44,29 +26,21 @@
|
||||
- type: volume
|
||||
source: worker-dependency-cache
|
||||
destination: /tmp/windmill/cache
|
||||
- type: volume
|
||||
source: worker-pinp-run
|
||||
destination: /run/podman
|
||||
readonly: true
|
||||
env:
|
||||
DATABASE_URL_FILE: /run/secrets/postgres-url
|
||||
DOCKER_HOST: unix:///run/podman/podman.sock
|
||||
MODE: worker
|
||||
WORKER_GROUP: default
|
||||
ENABLE_UNSHARE_PID: "true"
|
||||
UNSHARE_ISOLATION_FLAGS: "--user --map-root-user --pid --fork"
|
||||
wants:
|
||||
- windmill-worker-pinp.service
|
||||
|
||||
- name: worker-native
|
||||
env:
|
||||
DATABASE_URL_FILE: /run/secrets/postgres-url
|
||||
MODE: worker
|
||||
WORKER_GROUP: native
|
||||
WORKER_TYPE: native
|
||||
NATIVE_MODE: "true"
|
||||
NUM_WORKERS: "8"
|
||||
SLEEP_QUEUE: "200"
|
||||
ENABLE_UNSHARE_PID: "true"
|
||||
UNSHARE_ISOLATION_FLAGS: "--user --map-root-user --pid --fork"
|
||||
- name: lsp
|
||||
image: ghcr.io/windmill-labs/windmill-extra:latest
|
||||
secrets: []
|
||||
|
||||
Reference in New Issue
Block a user