Use mounts instead of volumes + exposes volumes and network

This commit is contained in:
nemunaire 2024-01-08 18:52:44 +01:00
parent a35d78be37
commit 67d954473a
2 changed files with 8 additions and 2 deletions

View File

@ -7,6 +7,10 @@ happydomain_version: "latest"
happydomain_data_dir: "" # defaults to /var/lib/happydomain.{{ instance_name }} if not filled happydomain_data_dir: "" # defaults to /var/lib/happydomain.{{ instance_name }} if not filled
happydomain_inner_data_dir: "/data" happydomain_inner_data_dir: "/data"
happydomain_docker_network: "default"
happydomain_docker_mounts:
- source: "{% if happydomain_data_dir != '' %}{{ happydomain_data_dir }}{% else %}/var/lib/{% if instance_name != 'happyDomain' %}happydomain.{% endif %}{{ instance_name }}{% endif %}"
target: "{{ happydomain_inner_data_dir }}"
happydomain_admin_bind: "./happydomain.sock" happydomain_admin_bind: "./happydomain.sock"
happydomain_baseurl: "" happydomain_baseurl: ""

View File

@ -4,12 +4,14 @@
name: "{{ instance_name }}" name: "{{ instance_name }}"
image: "happydomain/happydomain:{{ happydomain_version }}" image: "happydomain/happydomain:{{ happydomain_version }}"
pull: true pull: true
volumes:
- "{% if happydomain_data_dir != '' %}{{ happydomain_data_dir }}{% else %}/var/lib/{% if instance_name != 'happyDomain' %}happydomain.{% endif %}{{ instance_name }}{% endif %}:{{ happydomain_inner_data_dir }}"
state: started state: started
restart: "{{ happydomain_docker_restart | default('no') }}"
restart_policy: unless-stopped restart_policy: unless-stopped
memory: 256M memory: 256M
memory_swap: 512M memory_swap: 512M
mounts: "{{ happydomain_docker_mounts }}"
tmpfs: "{{ happydomain_docker_tmpfs | default([]) }}"
networks: "{{ happydomain_docker_network | default({}) }}"
env: env:
HAPPYDOMAIN_ADMIN_BIND: "{{ happydomain_admin_bind }}" HAPPYDOMAIN_ADMIN_BIND: "{{ happydomain_admin_bind }}"
HAPPYDOMAIN_BIND: "0.0.0.0:8081" HAPPYDOMAIN_BIND: "0.0.0.0:8081"