From 6a4dd7cd2b81b03804103f12d83e6b3279dc978f Mon Sep 17 00:00:00 2001 From: Viyurz Date: Fri, 23 Feb 2024 12:41:39 +0100 Subject: [PATCH] Etebase: Add etebase-server.ini template. Some environment variables set in docker compose file (TIME_ZONE, ALLOWED_HOSTS) are used only if the etebase-server.ini file doesn't exist, which can be misleading. If we change these variables after the etebase-server.ini file has been generated, the settings won't be updated in the config file. Templating this file allows changing these settings after the first run. --- roles/etebase/tasks/main.yml | 8 ++++++++ roles/etebase/templates/docker-compose.yaml | 3 +-- roles/etebase/templates/etebase-server.ini | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 roles/etebase/templates/etebase-server.ini diff --git a/roles/etebase/tasks/main.yml b/roles/etebase/tasks/main.yml index 0e04c67..2199a6b 100644 --- a/roles/etebase/tasks/main.yml +++ b/roles/etebase/tasks/main.yml @@ -11,6 +11,14 @@ group: "{{ ansible_env['USER'] }}" mode: '640' +- name: Template etebase-server.ini to project directory + template: + src: etebase-server.ini + dest: "{{ etebase_project_dir }}/etebase-server.ini" + owner: "{{ ansible_env['USER'] }}" + group: "{{ ansible_env['USER'] }}" + mode: '644' + - name: "Create directory {{ volumes['etebase_datadir'] }} with correct permissions" file: path: "{{ volumes['etebase_datadir'] }}" diff --git a/roles/etebase/templates/docker-compose.yaml b/roles/etebase/templates/docker-compose.yaml index 02b1445..bb85a9a 100644 --- a/roles/etebase/templates/docker-compose.yaml +++ b/roles/etebase/templates/docker-compose.yaml @@ -6,10 +6,9 @@ services: user: {{ users['etebase'] }}:{{ users['etebase'] }} environment: SERVER: http - ALLOWED_HOSTS: etebase.{{ domain }} AUTO_UPDATE: 'true' - TIME_ZONE: {{ timezone }} ports: - 127.0.0.1:{{ ports['etebase'] }}:3735 volumes: - {{ volumes['etebase_datadir'] }}:/data + - ./etebase-server.ini:/data/etebase-server.ini diff --git a/roles/etebase/templates/etebase-server.ini b/roles/etebase/templates/etebase-server.ini new file mode 100644 index 0000000..ea84207 --- /dev/null +++ b/roles/etebase/templates/etebase-server.ini @@ -0,0 +1,17 @@ +[global] +secret_file = /data/secret.txt +debug = false +static_root = /srv/etebase/static +static_url = /static/ +media_root = /data/media +media_url = /user-media/ +language_code = en-us +time_zone = {{ timezone }} + + +[allowed_hosts] +allowed_host1 = etebase.{{ domain }} + +[database] +engine = django.db.backends.sqlite3 +name = /data/db.sqlite3