mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-16 00:47:29 +02:00
perf(friendica): single-pass patch for DB creds + system.url; align env URL; tidy vars
- Patch local.config.php in one sed exec: * hostname, database, username, password * system.url via '#' delimiter to avoid URL slash escaping * Single notify: docker compose up - env.j2: * FRIENDICA_URL now uses domains|get_url(application_id, WEB_PROTOCOL) * Simplify FRIENDICA_DEBUGGING with |lower * Normalize spacing for readability - vars/main.yml: * Minor cleanups (comment header, spacing) * Consistent friendica_docker_ldap_config path construction Why: fewer container execs ⇒ faster runs; idempotent key updates; consistent URL configuration across env and PHP config. Risk: requires WEB_PROTOCOL and domains|get_url to be defined in inventory/vars as elsewhere in the project. https://chatgpt.com/share/689b92af-b184-800f-9664-2450e00b29d6
This commit is contained in:
parent
b62df5599d
commit
94da112736
@ -1,23 +1,11 @@
|
|||||||
- name: Update DB host
|
- name: Patch Friendica local.config.php (DB + system.url) in one pass
|
||||||
command: >
|
command: >
|
||||||
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
||||||
sed -ri "s/('hostname'\s*=>\s*')[^']*(',)/\1{{ database_host }}:{{ database_port }}\2/" {{ friendica_config_file }}
|
sed -ri
|
||||||
notify: docker compose up
|
-e "s/('hostname'\s*=>\s*')[^']*(',)/\1{{ database_host }}:{{ database_port }}\2/"
|
||||||
|
-e "s/('database'\s*=>\s*')[^']*(',)/\1{{ database_name }}\2/"
|
||||||
- name: Update DB name
|
-e "s/('username'\s*=>\s*')[^']*(',)/\1{{ database_username }}\2/"
|
||||||
command: >
|
-e "s/('password'\s*=>\s*')[^']*(',)/\1{{ database_password }}\2/"
|
||||||
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
-e "s#('url'\s*=>\s*')[^']*(',)#\1{{ domains | get_url(application_id, WEB_PROTOCOL) }}\2#"
|
||||||
sed -ri "s/('database'\s*=>\s*')[^']*(',)/\1{{ database_name }}\2/" {{ friendica_config_file }}
|
{{ friendica_config_file }}
|
||||||
notify: docker compose up
|
|
||||||
|
|
||||||
- name: Update DB user
|
|
||||||
command: >
|
|
||||||
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
|
||||||
sed -ri "s/('username'\s*=>\s*')[^']*(',)/\1{{ database_username }}\2/" {{ friendica_config_file }}
|
|
||||||
notify: docker compose up
|
|
||||||
|
|
||||||
- name: Update DB password
|
|
||||||
command: >
|
|
||||||
docker exec --user {{ friendica_user }} {{ friendica_container }}
|
|
||||||
sed -ri "s/('password'\s*=>\s*')[^']*(',)/\1{{ database_password }}\2/" {{ friendica_config_file }}
|
|
||||||
notify: docker compose up
|
notify: docker compose up
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# The configuration options can be found here:
|
# The configuration options can be found here:
|
||||||
# @see https://hub.docker.com/_/friendica
|
# @see https://hub.docker.com/_/friendica
|
||||||
|
|
||||||
FRIENDICA_URL=https://{{domains | get_domain(application_id)}}
|
FRIENDICA_URL={{ domains | get_url(application_id, WEB_PROTOCOL) }}
|
||||||
HOSTNAME={{domains | get_domain(application_id)}}
|
HOSTNAME={{domains | get_domain(application_id)}}
|
||||||
FRIENDICA_NO_VALIDATION={{friendica_no_validation | lower}}
|
FRIENDICA_NO_VALIDATION={{friendica_no_validation | lower}}
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
FRIENDICA_DEBUGGING={% if enable_debug | bool %}true{% else %}false{% endif %}{{"\n"}}
|
FRIENDICA_DEBUGGING={{ (enable_debug | bool) | lower }}{{"\n"}}
|
||||||
FRIENDICA_LOGLEVEL={% if enable_debug | bool %}9{% else %}5{% endif %}{{"\n"}}
|
FRIENDICA_LOGLEVEL={% if enable_debug | bool %}9{% else %}5{% endif %}{{"\n"}}
|
||||||
FRIENDICA_LOGGER=syslog
|
FRIENDICA_LOGGER=syslog
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ database_type: "mariadb"
|
|||||||
# Docker
|
# Docker
|
||||||
docker_compose_flush_handlers: false
|
docker_compose_flush_handlers: false
|
||||||
|
|
||||||
# Friendica Specific
|
# Friendica
|
||||||
friendica_container: "friendica"
|
friendica_container: "friendica"
|
||||||
friendica_no_validation: "{{ applications | get_app_conf(application_id, 'features.oidc', True) }}" # Email validation is not neccessary if OIDC is active
|
friendica_no_validation: "{{ applications | get_app_conf(application_id, 'features.oidc', True) }}" # Email validation is not neccessary if OIDC is active
|
||||||
friendica_application_base: "/var/www/html"
|
friendica_application_base: "/var/www/html"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user