From bb9daf27e5d6ea3dd52dcdb52a705e00a00223b1 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 13 Jan 2024 20:12:39 +0100 Subject: [PATCH] implemented docker volumes for bigbluebutton --- group_vars/all | 5 +++- playbook.destructor.yml | 2 +- roles/backup-docker-to-local/tasks/main.yml | 2 -- roles/docker-bigbluebutton/README.md | 5 ++-- roles/docker-bigbluebutton/handlers/main.yml | 25 +++++++++++++++++ roles/docker-bigbluebutton/tasks/main.yml | 29 ++++++++++++++++---- roles/docker-bigbluebutton/vars/main.yml | 11 ++++---- 7 files changed, 61 insertions(+), 18 deletions(-) diff --git a/group_vars/all b/group_vars/all index 9b86f508..fc25ef86 100644 --- a/group_vars/all +++ b/group_vars/all @@ -115,6 +115,9 @@ nginx_upstreams_directory: "{{nginx_configuration_directory}}upstreams/" enable_central_database: true enable_central_database_mailu: "{{enable_central_database}}" +### Enable Storage Optimizer for Docker Volumes +enable_system_storage_optimizer: true + ### Domain Names for Various Services domain_akaunting: "akaunting.{{top_domain}}" domain_baserow: "baserow.{{top_domain}}" @@ -155,7 +158,7 @@ akaunting_company_email: "DUMMY_VALUE_NEEDS_TO_BE_CHANGED" akaunting_setup_admin_email: "DUMMY_VALUE_NEEDS_TO_BE_CHANGED" #### Big Blue Button -bigbluebutton_enable_greenlight: "false" +bigbluebutton_enable_greenlight: "true" #### Listmonk listmonk_admin_username: "admin" diff --git a/playbook.destructor.yml b/playbook.destructor.yml index d811531e..5c29f2f2 100644 --- a/playbook.destructor.yml +++ b/playbook.destructor.yml @@ -3,4 +3,4 @@ become: true roles: - role: system-storage-optimizer - when: path_mass_storage or path_rapid_storage \ No newline at end of file + when: (path_mass_storage or path_rapid_storage) and enable_system_storage_optimizer | bool \ No newline at end of file diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index a774f5b4..8b12d387 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -53,8 +53,6 @@ database_name: "{{ database_name | default('undefined') }}" database_username: "{{ database_username | default('undefined') }}" database_password: "{{ database_password | default('undefined') }}" - database_host: "{{ database_host | default('undefined') }}" - database_type: "{{ database_type | default('undefined') }}" when: mode_verbose | bool - name: seed database values diff --git a/roles/docker-bigbluebutton/README.md b/roles/docker-bigbluebutton/README.md index 677f1eb8..3fe4ba89 100644 --- a/roles/docker-bigbluebutton/README.md +++ b/roles/docker-bigbluebutton/README.md @@ -7,13 +7,12 @@ Role to deploy [BigBlueButton](https://bigbluebutton.org/). ### cleanup ```bash - docker-compose down; - docker volume rm bigbluebutton_bigbluebutton bigbluebutton_html5-static bigbluebutton_vol-freeswitch bigbluebutton_vol-kurento bigbluebutton_vol-mediasoup bigbluebutton_database + docker compose down -v ``` ### check container status ```bash -watch -n 2 "docker ps -a | grep bigbluebutton" +watch -n 2 "docker compose ps -a" ``` ### database access diff --git a/roles/docker-bigbluebutton/handlers/main.yml b/roles/docker-bigbluebutton/handlers/main.yml index 0a22f4bd..6f8002f3 100644 --- a/roles/docker-bigbluebutton/handlers/main.yml +++ b/roles/docker-bigbluebutton/handlers/main.yml @@ -7,6 +7,31 @@ COMPOSE_HTTP_TIMEOUT: 600 DOCKER_CLIENT_TIMEOUT: 600 listen: setup bigbluebutton + +- name: replace postgres bind mount by volume mount + replace: + path: "{{docker_compose_file}}" + regexp: '\./postgres-data:/var/lib/postgresql/data' + replace: 'postgres-data:/var/lib/postgresql/data' + listen: setup bigbluebutton + +- name: replace greenlight bind mount by volume mount + replace: + path: "{{docker_compose_file}}" + regexp: '\./greenlight-data:/usr/src/app/storage' + replace: 'greenlight-data:/usr/src/app/storage' + listen: setup bigbluebutton + +- name: add volumes to docker compose + blockinfile: + path: "{{docker_compose_file}}" + block: |2 + postgres-data: + greenlight-data: + marker: "# {mark} ANSIBLE MANAGED BLOCK FOR VOLUMES" + insertafter: "html5-static:" + listen: setup bigbluebutton + - name: docker compose up bigbluebutton command: cmd: docker-compose -p bigbluebutton up -d --force-recreate diff --git a/roles/docker-bigbluebutton/tasks/main.yml b/roles/docker-bigbluebutton/tasks/main.yml index fbb01373..273cea68 100644 --- a/roles/docker-bigbluebutton/tasks/main.yml +++ b/roles/docker-bigbluebutton/tasks/main.yml @@ -1,10 +1,6 @@ --- -- name: include docker vars - include_vars: vars/docker-common.yml.j2 - -- name: load docker compose dependencies - include_role: - name: docker-compose +- name: "include docker-compose-common.yml" + include_tasks: docker-compose-common.yml - name: "include task certbot-matomo.yml" include_tasks: certbot-matomo.yml @@ -34,3 +30,24 @@ - name: deploy .env template: src=env.j2 dest={{docker_compose_instance_directory}}/.env notify: setup bigbluebutton + +- name: flush docker service + meta: flush_handlers + +- name: wait for database + pause: + seconds: "{{database_delay}}" + when: mode_setup | bool + +- name: create admin + command: + cmd: docker compose exec greenlight bundle exec rake admin:create + chdir: "{{docker_compose_instance_directory}}" + when: mode_setup | bool + ignore_errors: true + register: admin_creation_result + +- name: print admin user data + debug: + msg: "{{ admin_creation_result.stdout }}" + when: admin_creation_result is defined \ No newline at end of file diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index c6ec695a..48dbcb08 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1,5 +1,6 @@ -docker_compose_project_name: "bigbluebutton" -#database_host: "postgres" # needs to be fixed -#database_name: "greenlight-v3" -#database_username: "postgres" -#database_type: "postgres" \ No newline at end of file +docker_compose_project_name: "bigbluebutton" +docker_compose_file: "{{docker_compose_instance_directory}}/docker-compose.yml" +database_instance: "bigbluebutton" +database_name: "greenlight-v3" +database_username: "postgres" +database_password: "{{bigbluebutton_postgresql_secret}}" \ No newline at end of file