Solved some bugs and optimized nextcloud

This commit is contained in:
Kevin Veen-Birkenbach 2025-02-21 10:53:19 +01:00
parent a61fa3e614
commit 8afb2a3b84
10 changed files with 59 additions and 20 deletions

View File

@ -234,7 +234,7 @@ defaults_applications:
credentials: credentials:
# database_password: Null # Needs to be set in inventory file # database_password: Null # Needs to be set in inventory file
administrator_username: "{{administrator_username}}" administrator_username: "{{administrator_username}}"
administrator_initial_passwords: "{{administrator_initial_password}}" administrator_initial_password: "{{administrator_initial_password}}"
## OAuth2 Proxy ## OAuth2 Proxy

View File

@ -8,7 +8,7 @@
name: nginx-https-get-cert-modify-all name: nginx-https-get-cert-modify-all
vars: vars:
domain: "{{ item }}" domain: "{{ item }}"
http: "{{ ports.localhost.http[application_id] }}" http_port: "{{ ports.localhost.http[application_id] }}"
loop: loop:
- "{{ domains.mailu }}" - "{{ domains.mailu }}"
- "{{ domain }}" - "{{ domain }}"

View File

@ -1,3 +1,5 @@
application_id: "baserow" application_id: "baserow"
database_password: "{{ baserow_database_password }}" database_password: "{{ baserow_database_password }}"
database_type: "postgres" database_type: "postgres"
domain: "{{ domains[application_id] }}"
http_port: "{{ ports.localhost.http[application_id] }}"

View File

@ -28,3 +28,9 @@
COMPOSE_HTTP_TIMEOUT: 600 COMPOSE_HTTP_TIMEOUT: 600
DOCKER_CLIENT_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600
listen: docker compose project build and setup listen: docker compose project build and setup
- name: docker compose restart
command:
cmd: "docker compose restart"
chdir: "{{docker_compose.directories.instance}}"
listen: docker compose restart

View File

@ -0,0 +1,31 @@
- name: "Substitute http with https in {{ nextcloud_config_file_path }}"
replace:
path: "{{ nextcloud_config_file_path }}"
regexp: "http://{{ domain | regex_escape }}"
replace: "https://{{ domain }}"
notify:
- docker compose restart
- name: "Ensure 'overwriteprotocol' is set to 'https' in Nextcloud {{ nextcloud_config_file_path }}"
block:
- name: Check if 'overwriteprotocol' is already set
lineinfile:
path: "{{ nextcloud_config_file_path }}"
regexp: "^\s*'overwriteprotocol'\s*=>\s*'http'"
line: "'overwriteprotocol' => 'https',"
backrefs: yes
state: present
notify:
- docker compose restart
- name: Add 'overwriteprotocol' => 'https' if not present
lineinfile:
path: "{{ nextcloud_config_file_path }}"
regexp: "^\s*\);$"
line: "'overwriteprotocol' => 'https',"
insertafter: "^\s*\);$"
state: present
notify:
- docker compose restart
notify:
- docker compose restart

View File

@ -6,18 +6,12 @@
- name: "include role for {{application_id}} to recieve certs & do modification routines" - name: "include role for {{application_id}} to recieve certs & do modification routines"
include_role: include_role:
name: nginx-https-get-cert-modify-all name: nginx-https-get-cert-modify-all
vars:
domain: "{{domains[application_id]}}"
http: "{{ ports.localhost.http[application_id] }}"
- name: create nextcloud nginx proxy configuration file - name: create nextcloud nginx proxy configuration file
template: template:
src: "proxy-nginx.conf.j2" src: "proxy-nginx.conf.j2"
dest: "{{nginx.directories.http.servers}}{{domains[application_id]}}.conf" dest: "{{nginx.directories.http.servers}}{{domains[application_id]}}.conf"
notify: restart nginx notify: restart nginx
vars:
domain: "{{domains[application_id]}}"
http_port: "{{ports.localhost.http[application_id]}}"
- name: create internal nextcloud nginx configuration - name: create internal nextcloud nginx configuration
template: template:
@ -35,3 +29,6 @@
- name: Include LDAP specific tasks - name: Include LDAP specific tasks
include_tasks: ldap.yml include_tasks: ldap.yml
when: applications[application_id].ldap_enabled | bool when: applications[application_id].ldap_enabled | bool
- name: Include Config specific tasks
include_tasks: config.yml

View File

@ -18,11 +18,11 @@ SMTP_NAME= {{system_email.username}}
SMTP_PASSWORD= {{system_email.password}} SMTP_PASSWORD= {{system_email.password}}
# Email from configuration # Email from configuration
MAIL_FROM_ADDRESS= {{system_email.local}} MAIL_FROM_ADDRESS= "{{system_email.local}}"
MAIL_DOMAIN= {{system_email.domain}} MAIL_DOMAIN= "{{system_email.domain}}"
# Initial Admin Data # Initial Admin Data
NEXTCLOUD_ADMIN_USER= {{applications.[application_id].credentials.administrator_username}} NEXTCLOUD_ADMIN_USER= "{{applications[application_id].credentials.administrator_username}}"
NEXTCLOUD_ADMIN_PASSWORD= {{applications.[application_id].credentials.administrator_initial_password}} NEXTCLOUD_ADMIN_PASSWORD= "{{applications[application_id].credentials.administrator_initial_password}}"
NEXTCLOUD_TRUSTED_DOMAINS= {{domains[application_id]}} NEXTCLOUD_TRUSTED_DOMAINS= "{{domains[application_id]}}"

View File

@ -4,3 +4,6 @@ database_password: "{{applications.nextcloud.credentials.datab
database_type: "mariadb" database_type: "mariadb"
nextcloud_application_container_name: "nextcloud-application" nextcloud_application_container_name: "nextcloud-application"
nextcloud_nginx_container_name: "nextcloud-web" nextcloud_nginx_container_name: "nextcloud-web"
nextcloud_config_file_path: "/var/lib/docker/volumes/nextcloud_data/_data/config/config.php"
domain: "{{domains[application_id]}}"
http_port: "{{ ports.localhost.http[application_id] }}"

View File

@ -3,8 +3,8 @@
include_role: include_role:
name: nginx-https-get-cert-modify-all name: nginx-https-get-cert-modify-all
vars: vars:
domain: "{{domains[application_id]}}" domain: "{{domains[application_id]}}"
http: "{{ ports.localhost.http[application_id] }}" http_port: "{{ ports.localhost.http[application_id] }}"
- name: "generate {{domains[application_id]}}.conf" - name: "generate {{domains[application_id]}}.conf"
template: template:

View File

@ -3,8 +3,8 @@
include_role: include_role:
name: nginx-https-get-cert-modify-all name: nginx-https-get-cert-modify-all
vars: vars:
domain: "{{domains[application_id]}}" domain: "{{domains[application_id]}}"
http: "{{ ports.localhost.http[application_id] }}" http_port: "{{ ports.localhost.http[application_id] }}"
- name: "generate {{domains[application_id]}}.conf" - name: "generate {{domains[application_id]}}.conf"
template: template: