Optimized friendica database patch

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-20 16:13:48 +02:00
parent 257d0c4673
commit 2699edd197
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
3 changed files with 9 additions and 7 deletions

View File

@ -1,5 +1,6 @@
- name: flush handlers to ensure that friendica is up before friendica addon configuration - name: flush handlers to ensure that friendica is up before friendica addon configuration
meta: flush_handlers meta: flush_handlers
- name: Check if Friendica local.config.php exists - name: Check if Friendica local.config.php exists
command: docker exec --user {{ friendica_user }} {{ friendica_container }} test -f {{ friendica_config_file }} command: docker exec --user {{ friendica_user }} {{ friendica_container }} test -f {{ friendica_config_file }}
register: friendica_config_exists register: friendica_config_exists
@ -12,23 +13,23 @@
- name: Update DB host - name: Update DB host
command: > command: >
docker exec --user {{ friendica_user }} {{ friendica_container }} docker exec --user {{ friendica_user }} {{ friendica_container }}
sed -i "s/'hostname' => .*/'hostname' => '{{ database_host }}:{{ database_port }}',/" {{ friendica_config_file }} sed -ri "s/('hostname'\s*=>\s*')[^']*(',)/\1{{ database_host }}:{{ database_port }}\2/" {{ friendica_config_file }}
notify: docker compose up notify: docker compose up
- name: Update DB name - name: Update DB name
command: > command: >
docker exec --user {{ friendica_user }} {{ friendica_container }} docker exec --user {{ friendica_user }} {{ friendica_container }}
sed -i "s/'database' => .*/'database' => '{{ database_name }}',/" {{ friendica_config_file }} sed -ri "s/('database'\s*=>\s*')[^']*(',)/\1{{ database_name }}\2/" {{ friendica_config_file }}
notify: docker compose up notify: docker compose up
- name: Update DB user - name: Update DB user
command: > command: >
docker exec --user {{ friendica_user }} {{ friendica_container }} docker exec --user {{ friendica_user }} {{ friendica_container }}
sed -i "s/'username' => .*/'username' => '{{ database_username }}',/" {{ friendica_config_file }} sed -ri "s/('username'\s*=>\s*')[^']*(',)/\1{{ database_username }}\2/" {{ friendica_config_file }}
notify: docker compose up notify: docker compose up
- name: Update DB password - name: Update DB password
command: > command: >
docker exec --user {{ friendica_user }} {{ friendica_container }} docker exec --user {{ friendica_user }} {{ friendica_container }}
sed -i "s/'password' => .*/'password' => '{{ database_password }}',/" {{ friendica_config_file }} sed -ri "s/('password'\s*=>\s*')[^']*(',)/\1{{ database_password }}\2/" {{ friendica_config_file }}
notify: docker compose up notify: docker compose up

View File

@ -1,6 +1,7 @@
{% include 'roles/docker-compose/templates/base.yml.j2' %} {% include 'roles/docker-compose/templates/base.yml.j2' %}
application: application:
image: "{{ applications | get_app_conf(application_id, 'images.friendica', True) }}" image: "{{ applications | get_app_conf(application_id, 'images.friendica', True) }}"
container_name: "{{ friendica_container }}"
{% include 'roles/docker-container/templates/base.yml.j2' %} {% include 'roles/docker-container/templates/base.yml.j2' %}
volumes: volumes:
- html:{{ friendica_application_base }} - html:{{ friendica_application_base }}

View File

@ -1,6 +1,6 @@
application_id: "web-app-friendica" application_id: "web-app-friendica"
database_type: "mariadb" database_type: "mariadb"
friendica_container: "application" 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"
friendica_docker_ldap_config: "{{friendica_application_base}}/config/ldapauth.config.php" friendica_docker_ldap_config: "{{friendica_application_base}}/config/ldapauth.config.php"