Update to 2020-09-30 10:00

master
Daniel Berteaud 4 years ago
parent 06c89e7fb7
commit 84be9e14a1
  1. 2
      roles/funkwhale/tasks/install.yml
  2. 2
      roles/matrix_synapse/tasks/install.yml
  3. 2
      roles/mayan_edms/defaults/main.yml
  4. 8
      roles/mayan_edms/meta/main.yml
  5. 17
      roles/mayan_edms/tasks/archive_pre.yml
  6. 62
      roles/mayan_edms/tasks/install.yml
  7. 3
      roles/mayan_edms/templates/env.j2
  8. 2
      roles/mayan_edms/templates/mayan-edms-beat.service.j2
  9. 2
      roles/mayan_edms/templates/mayan-edms-web.service.j2
  10. 2
      roles/mayan_edms/templates/mayan-edms-worker-fast.service.j2
  11. 2
      roles/mayan_edms/templates/mayan-edms-worker-medium.service.j2
  12. 2
      roles/mayan_edms/templates/mayan-edms-worker-slow.service.j2
  13. 10
      roles/mayan_edms/templates/pre_backup.sh.j2
  14. 8
      roles/repo_base/tasks/main.yml
  15. 2
      roles/wapt_server/tasks/main.yml

@ -5,7 +5,7 @@
name: name:
- gcc - gcc
- git - git
- postgresql12 - postgresql13
- postgresql-devel - postgresql-devel
- openldap-devel - openldap-devel
- cyrus-sasl-devel - cyrus-sasl-devel

@ -19,7 +19,7 @@
- libtool - libtool
- autoconf - autoconf
- automake - automake
- postgresql12 - postgresql13
- postgresql-devel - postgresql-devel
- libpqxx-devel - libpqxx-devel
- jemalloc - jemalloc

@ -6,6 +6,8 @@ mayan_user: mayan-edms
# Should ansible handle upgrades ? If false, only initial install will be done # Should ansible handle upgrades ? If false, only initial install will be done
mayan_manage_upgrade: True mayan_manage_upgrade: True
# Can be mysql or postgresql
mayan_db_engine: postgresql
mayan_db_server: "{{ mysql_server | default('localhost') }}" mayan_db_server: "{{ mysql_server | default('localhost') }}"
mayan_db_user: mayanedms mayan_db_user: mayanedms
mayan_db_name: mayanedms mayan_db_name: mayanedms

@ -4,6 +4,12 @@ dependencies:
- role: mkdir - role: mkdir
- role: repo_remi_safe # for gnupg1 - role: repo_remi_safe # for gnupg1
- role: mysql_server - role: mysql_server
when: mayan_db_server == '127.0.0.1' or mayan_db_server == 'localhost' when:
- mayan_db_engine == 'mysql'
- mayan_db_server == '127.0.0.1' or mayan_db_server == 'localhost'
- role: postgresql_server
when:
- mayan_db_engine == 'postgresql'
- mayan_db_server == '127.0.0.1' or mayan_db_server == 'localhost'
- role: redis_server - role: redis_server
when: mayan_redis_url | urlsplit('hostname') == '127.0.0.1' or mayan_redis_url | urlsplit('hostname') == 'localhost' when: mayan_redis_url | urlsplit('hostname') == '127.0.0.1' or mayan_redis_url | urlsplit('hostname') == 'localhost'

@ -20,13 +20,26 @@
mysql_db: mysql_db:
state: dump state: dump
name: "{{ mayan_db_name }}" name: "{{ mayan_db_name }}"
target: "{{ root_dir }}/archives/{{ mayan_current_version }}/{{ mayan_db_name }}.sql.xz" target: "{{ root_dir }}/archives/{{ mayan_current_version }}/{{ mayan_db_name }}.sql.gz"
login_host: "{{ mayan_db_server }}" login_host: "{{ mayan_db_server }}"
login_user: sqladmin login_user: sqladmin
login_password: "{{ mysql_admin_pass }}" login_password: "{{ mysql_admin_pass }}"
quick: True quick: True
single_transaction: True single_transaction: True
when: mayan_db_engine == 'mysql'
tags: mayan
- name: Dump the database
command: >
/usr/pgsql-12/bin/pg_dump
--clean
--host={{ mayan_db_server | quote }}
--port={{ mayan_db_port | quote }}
--username=sqladmin {{ mayan_db_name | quote }}
--file="{{ mayan_root_dir }}/archives/server_{{ mayan_server_current_version }}/{{ mayan_db_name }}.sql"
environment: environment:
XZ_OPT: -T0 - PGPASSWORD: "{{ pg_admin_pass }}"
when: mayan_db_engine == 'postgresql'
tags: mayan tags: mayan

@ -10,7 +10,6 @@
- openldap-devel - openldap-devel
- libjpeg-turbo-devel - libjpeg-turbo-devel
- libpng-devel - libpng-devel
- mysql-devel
- libexif - libexif
- ghostscript - ghostscript
- gnupg1 - gnupg1
@ -28,12 +27,31 @@
- python-setuptools - python-setuptools
tags: mayan tags: mayan
- name: Install MySQL support
yum:
name:
- mysql-devel
- MySQL-python
when: mayan_db_engine == 'mysql'
tags: mayan
# WHen using upstream MariaDB repo, we have to install MariaDB-shared # WHen using upstream MariaDB repo, we have to install MariaDB-shared
- name: Install MariaDB shared libs - name: Install MariaDB shared libs
yum: yum:
name: name:
- MariaDB-shared - MariaDB-shared
when: mysql_mariadb_version is defined and mysql_mariadb_version != 'default' when:
- mayan_db_engine == 'mysql'
- mysql_mariadb_version is defined and mysql_mariadb_version != 'default'
tags: mayan
- name: Install PostgreSQL support
yum:
name:
- postgresql-devel
- postgresql13
- python-psocopg2
when: mayan_db_engine == 'postgresql'
tags: mayan tags: mayan
- name: Wipe the venv on upgrades - name: Wipe the venv on upgrades
@ -50,9 +68,9 @@
name: name:
- pip - pip
- redis - redis
- mysql
- python-ldap - python-ldap
- django_auth_ldap - django_auth_ldap
- "{{ (mayan_db_engine == 'mysql') | ternary('mysql','psycopg2') }}"
state: "{{ (mayan_install_mode == 'none') | ternary('present', 'latest') }}" state: "{{ (mayan_install_mode == 'none') | ternary('present', 'latest') }}"
virtualenv: "{{ mayan_root_dir }}/venv" virtualenv: "{{ mayan_root_dir }}/venv"
virtualenv_command: /usr/bin/virtualenv-3 virtualenv_command: /usr/bin/virtualenv-3
@ -68,12 +86,36 @@
virtualenv_python: /usr/bin/python3 virtualenv_python: /usr/bin/python3
tags: mayan tags: mayan
- import_tasks: ../includes/webapps_create_mysql_db.yml - when: mayan_db_engine == 'mysql'
vars: block:
- db_name: "{{ mayan_db_name }}" - import_tasks: ../includes/webapps_create_mysql_db.yml
- db_user: "{{ mayan_db_user }}" vars:
- db_server: "{{ mayan_db_server }}" - db_name: "{{ mayan_db_name }}"
- db_pass: "{{ mayan_db_pass }}" - db_user: "{{ mayan_db_user }}"
- db_server: "{{ mayan_db_server }}"
- db_pass: "{{ mayan_db_pass }}"
tags: mayan
- when: mayan_db_engine == 'postgresql'
block:
- name: Create the PostgreSQL role
postgresql_user:
db: postgres
name: "{{ mayan_db_user }}"
password: "{{ mayan_db_pass }}"
login_host: "{{ mayan_db_server }}"
login_user: sqladmin
login_password: "{{ pg_admin_pass }}"
- name: Create the PostgreSQL database
postgresql_db:
name: "{{ mayan_db_name }}"
encoding: UTF-8
template: template0
owner: "{{ mayan_db_user }}"
login_host: "{{ mayan_db_server }}"
login_user: sqladmin
login_password: "{{ pg_admin_pass }}"
tags: mayan tags: mayan
- name: Initialize or upgrade database - name: Initialize or upgrade database
@ -83,7 +125,7 @@
{{ (mayan_install_mode == 'install') | ternary('initialsetup','performupgrade') }} {{ (mayan_install_mode == 'install') | ternary('initialsetup','performupgrade') }}
environment: environment:
- MAYAN_MEDIA_ROOT: "{{ mayan_root_dir }}/data" - MAYAN_MEDIA_ROOT: "{{ mayan_root_dir }}/data"
- MAYAN_DATABASE_ENGINE: django.db.backends.mysql - MAYAN_DATABASE_ENGINE: django.db.backends.{{ (mayan_db_engine == 'mysql') | ternary('mysql','postgresql') }}
- MAYAN_DATABASE_NAME: "{{ mayan_db_name }}" - MAYAN_DATABASE_NAME: "{{ mayan_db_name }}"
- MAYAN_DATABASE_PASSWORD: "{{ mayan_db_pass }}" - MAYAN_DATABASE_PASSWORD: "{{ mayan_db_pass }}"
- MAYAN_DATABASE_USER: "{{ mayan_db_user }}" - MAYAN_DATABASE_USER: "{{ mayan_db_user }}"

@ -4,8 +4,7 @@ DJANGO_SETTINGS_MODULE={{ mayan_ldap_auth | ternary('auth','mayan.settings.produ
MAYAN_MEDIA_ROOT="{{ mayan_root_dir }}/data" MAYAN_MEDIA_ROOT="{{ mayan_root_dir }}/data"
MAYAN_CELERY_RESULT_BACKEND="{{ mayan_redis_url }}/{{ mayan_redis_db.result_backend }}" MAYAN_CELERY_RESULT_BACKEND="{{ mayan_redis_url }}/{{ mayan_redis_db.result_backend }}"
MAYAN_CELERY_BROKER_URL="{{ mayan_redis_url }}/{{ mayan_redis_db.broker }}" MAYAN_CELERY_BROKER_URL="{{ mayan_redis_url }}/{{ mayan_redis_db.broker }}"
MAYAN_DATABASES="{default: {ENGINE: django.db.backends.mysql, HOST: '{{ mayan_db_server }}', NAME: '{{ mayan_db_user }}', PASSWORD: '{{ mayan_db_pass }}', USER: '{{ mayan_db_user }}'}}" MAYAN_DATABASE_ENGINE="django.db.backends.{{ (mayan_db_engine == 'mysql') | ternary('mysql','postgresql') }}"
MAYAN_DATABASE_ENGINE="django.db.backends.mysql"
MAYAN_DATABASE_NAME={{ mayan_db_name | quote }} MAYAN_DATABASE_NAME={{ mayan_db_name | quote }}
MAYAN_DATABASE_PASSWORD={{ mayan_db_pass | quote }} MAYAN_DATABASE_PASSWORD={{ mayan_db_pass | quote }}
MAYAN_DATABASE_USER={{ mayan_db_user | quote }} MAYAN_DATABASE_USER={{ mayan_db_user | quote }}

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Mayan EDMS celery beat service Description=Mayan EDMS celery beat service
After=redis.service postgresql.service mysql.service mariadb.service After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
[Service] [Service]
User={{ mayan_user }} User={{ mayan_user }}

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Mayan EDMS web service Description=Mayan EDMS web service
After=redis.service postgresql.service maysql.service mariadb.service After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
Wants=mayan-edms-worker-fast.service mayan-edms-worker-medium.service mayan-edms-worker-slow.service mayan-edms-beat.service Wants=mayan-edms-worker-fast.service mayan-edms-worker-medium.service mayan-edms-worker-slow.service mayan-edms-beat.service
[Service] [Service]

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Mayan EDMS fast celery worker Description=Mayan EDMS fast celery worker
After=redis.service postgresql.service mysql.service mariadb.service After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
[Service] [Service]
User={{ mayan_user }} User={{ mayan_user }}

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Mayan EDMS medium celery worker Description=Mayan EDMS medium celery worker
After=redis.service postgresql.service mysql.service mariadb.service After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
[Service] [Service]
User={{ mayan_user }} User={{ mayan_user }}

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Mayan EDMS slow celery worker Description=Mayan EDMS slow celery worker
After=redis.service postgresql.service mysql.service mariadb.service After=redis.service {{ (pg_version is defined and pg_version != 'default') | ternary('postgresql-' + pg_version | string,'postgresql') }}.service mysql.service mariadb.service
[Service] [Service]
User={{ mayan_user }} User={{ mayan_user }}

@ -1,8 +1,16 @@
#!/bin/bash -e #!/bin/bash -e
{% if mayan_db_engine == 'mysql' %}
/usr/bin/mysqldump --user={{ mayan_db_user | quote }} \ /usr/bin/mysqldump --user={{ mayan_db_user | quote }} \
--password={{ mayan_db_pass | quote }} \ --password={{ mayan_db_pass | quote }} \
--host={{ mayan_db_server | quote }} \ --host={{ mayan_db_server | quote }} \
--quick --single-transaction \ --quick --single-transaction \
--add-drop-table {{ mayan_db_name | quote }} | zstd -c > {{ mayan_root_dir }}/backup/{{ mayan_db_name }}.sql.zst --add-drop-table {{ mayan_db_name | quote }} | zstd -c > {{ mayan_root_dir }}/backup/{{ mayan_db_name }}.sql.zst
{% else %}
PGPASSWORD='{{ mayan_db_pass }}' /usr/pgsql-13/bin/pg_dump \
--clean \
--username={{ mayan_db_user | quote }} \
--host={{ mayan_db_server | quote }} \
{{ mayan_db_name | quote }} | \
zstd -c > "{{ mayan_root_dir }}/backup/{{ mayan_db_name }}.sql.zst"
{% endif %}

@ -32,14 +32,14 @@
enabled: False enabled: False
tags: repo tags: repo
- name: Configure lastest PostgreSQL repository - name: Configure latest PostgreSQL repository
yum_repository: yum_repository:
name: postgresql-client name: postgresql-client
description: PostgreSQL description: PostgreSQL
baseurl: https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-$releasever-$basearch baseurl: https://download.postgresql.org/pub/repos/yum/13/redhat/rhel-$releasever-$basearch
gpgcheck: True gpgcheck: True
gpgkey: https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-12 gpgkey: https://download.postgresql.org/pub/repos/yum/RPM-GPG-KEY-PGDG-13
state: "{{ repo_postgres | ternary('present','absent') }}" state: "{{ repo_postgres | ternary('present','absent') }}"
includepkgs: postgresql12 postgresql12-libs includepkgs: postgresql13 postgresql13-libs
tags: repo tags: repo
... ...

@ -5,7 +5,7 @@
name: name:
- tis-waptserver - tis-waptserver
- tis-waptsetup - tis-waptsetup
- postgresql12 - postgresql13
- python-psycopg2 # Needed to manage PG with ansible - python-psycopg2 # Needed to manage PG with ansible
tags: wapt tags: wapt

Loading…
Cancel
Save