diff --git a/.github/workflows/archivematica-upgrade.yml b/.github/workflows/archivematica-upgrade.yml index e4ddc54..c2b6b84 100644 --- a/.github/workflows/archivematica-upgrade.yml +++ b/.github/workflows/archivematica-upgrade.yml @@ -71,10 +71,11 @@ jobs: -e "archivematica_src_configure_ss_url=http://archivematica:8000" \ -vvv - name: "Debug" - if: ${{ failure() }} + if: ${{ always() }} working-directory: "${{ github.workspace }}/tests/archivematica-upgrade" run: | podman-compose exec -u root archivematica bash -c "journalctl -xeu mysql.service --no-pager" + podman-compose exec -u root archivematica bash -c "cat /etc/mysql/my.cnf" - name: "Get the Archivematica version" run: | curl \ diff --git a/playbooks/archivematica-jammy/vars-singlenode-1.16.yml b/playbooks/archivematica-jammy/vars-singlenode-1.16.yml index 9527b04..8289427 100644 --- a/playbooks/archivematica-jammy/vars-singlenode-1.16.yml +++ b/playbooks/archivematica-jammy/vars-singlenode-1.16.yml @@ -5,46 +5,6 @@ archivematica_src_am_version: "stable/1.16.x" archivematica_src_ss_version: "stable/0.22.x" -archivematica_src_ss_db_name: "SS" -archivematica_src_ss_db_user: "ss" -archivematica_src_ss_db_password: "demo" -archivematica_src_ss_db_host: "{{ archivematica_src_am_db_host }}" - -archivematica_src_configure_dashboard: "yes" -archivematica_src_configure_ss: "yes" -archivematica_src_configure_ss_user: "admin" -archivematica_src_configure_ss_password: "archivematica" -archivematica_src_configure_ss_api_key: "this_is_the_ss_api_key" -archivematica_src_configure_ss_url: "http://192.168.168.198:8000" -archivematica_src_configure_ss_email: "admin@example.com" -archivematica_src_configure_am_user: "admin" -archivematica_src_configure_am_password: "archivematica" -archivematica_src_configure_am_email: "admin@example.com" -archivematica_src_configure_am_api_key: "this_is_the_am_api_key" -archivematica_src_configure_am_site_url: "http://192.168.168.198" - -nodejs_version: "22.x" - -# elasticsearch role - -elasticsearch_version: "6.5.4" -elasticsearch_apt_java_package: "openjdk-8-jre-headless" -elasticsearch_java_home: "/usr/lib/jvm/java-1.8.0-openjdk-amd64" -elasticsearch_heap_size: "1g" -elasticsearch_max_open_files: "65535" -elasticsearch_timezone: "UTC" -elasticsearch_node_max_local_storage_nodes: "1" -elasticsearch_index_mapper_dynamic: "true" -elasticsearch_memory_bootstrap_mlockall: "true" -elasticsearch_install_java: "true" -elasticsearch_thread_pools: - - "thread_pool.write.size: 2" - - "thread_pool.write.queue_size: 1000" -elasticsearch_network_http_max_content_lengtht: 1024mb -elasticsearch_discovery_zen_ping_multicast_enabled: "false" -elasticsearch_max_locked_memory: "unlimited" -elasticsearch_network_host: "127.0.0.1" - # percona role mysql_version_major: "8" @@ -52,25 +12,5 @@ mysql_version_minor: "0" mysql_character_set_server: "utf8mb4" mysql_collation_server: "utf8mb4_0900_ai_ci" -mysql_databases: - - name: "{{ archivematica_src_am_db_name }}" - collation: "{{ archivematica_src_am_db_collation }}" - encoding: "{{ archivematica_src_am_db_encoding }}" - - name: "{{ archivematica_src_ss_db_name }}" - collation: "{{ archivematica_src_ss_db_collation }}" - encoding: "{{ archivematica_src_ss_db_encoding }}" - -mysql_users: - - name: "{{ archivematica_src_am_db_user }}" - pass: "{{ archivematica_src_am_db_password }}" - priv: "{{ archivematica_src_am_db_name }}.*:ALL,GRANT" - host: "{{ archivematica_src_am_db_host }}" - - name: "{{ archivematica_src_ss_db_user }}" - pass: "{{ archivematica_src_ss_db_password }}" - priv: "{{ archivematica_src_ss_db_name }}.*:ALL,GRANT" - host: "{{ archivematica_src_ss_db_host }}" - mysql_root_password: "MYSQLROOTPASSWORD" - -archivematica_src_ss_environment: - SS_DB_URL: "mysql://{{ archivematica_src_ss_db_user }}:{{ archivematica_src_ss_db_password }}@{{ archivematica_src_ss_db_host }}:3306/{{ archivematica_src_ss_db_name }}" +mysql_default_authentication_plugin: "mysql_native_password" \ No newline at end of file diff --git a/tests/archivematica-upgrade/playbook.yml b/tests/archivematica-upgrade/playbook.yml index a20a84c..5b4d226 100644 --- a/tests/archivematica-upgrade/playbook.yml +++ b/tests/archivematica-upgrade/playbook.yml @@ -15,38 +15,93 @@ - "fish" become: "yes" - roles: - - - role: "artefactual.elasticsearch" + tasks: + - name: "Block" become: "yes" - tags: - - "elasticsearch" - when: "archivematica_src_search_enabled|bool" + block: + - name: "Install gnupg" + apt: + name: gnupg2 + update_cache: yes - - role: "artefactual.percona" - become: "yes" - tags: - - "percona" + - name: "Install percona-release package" + apt: + deb: "https://repo.percona.com/apt/percona-release_latest.{{ ansible_distribution_release }}_all.deb" - - role: "artefactual.nginx" - become: "yes" - tags: - - "nginx" + - name: "Update apt cache" + apt: + update_cache: yes - - role: "artefactual.gearman" - become: "yes" - tags: - - "gearman" + # https://www.percona.com/doc/percona-server/LATEST/installation/apt_repo.html + - name: "Enable Percona repository (Percona version >= 8)" + command: "percona-release setup ps{{ mysql_version_major }}{{ mysql_version_minor }}" + when: mysql_version_major|int >= 8 + changed_when: False # TODO: check for task idempotency - - role: "artefactual.clamav" - become: "yes" - tags: - - "clamav" + - name: "Install python-is-python3 (Ubuntu >= Focal/20.04)" + apt: + name: "python-is-python3" + when: + - ansible_distribution_version is version_compare('20.04', '>=') - - role: "artefactual.archivematica-src" - become: "yes" - tags: - - "archivematica-src" + - debug: + msg: "ansible_python_interpreter major version: {{ ansible_python.version.major }}" + + - name: "Install package dependencies for ansible MySQL modules (python 2)" + apt: + name: "python-mysqldb" + when: + - ansible_python.version.major == 2 # version is a number, do not quote + + - name: "Install package dependencies for ansible MySQL modules (python 3)" + apt: + name: + - "python3-pymysql" + - "python3-mysqldb" + when: + - ansible_python.version.major == 3 # version is a number, do not quote + + - name: "Install | configure debconf for version 8.0 (Use Legacy Authentication Method)" + debconf: + name: 'percona-server-server' + question: 'percona-server-server/default-auth-override' + value: 'Use Legacy Authentication Method (Retain MySQL 5.x Compatibility)' + vtype: select + changed_when: false + when: + - mysql_version_major|int >= 8 + - mysql_default_authentication_plugin is defined + - mysql_default_authentication_plugin == "mysql_native_password" + + - name: "Install percona packages and dependencies on Ubuntu (Percona version >= 8)" + apt: + name: + - "percona-server-server={{ mysql_version_major }}.{{ mysql_version_minor }}*" + - "percona-server-client={{ mysql_version_major }}.{{ mysql_version_minor }}*" + - "percona-toolkit" + state: "present" + when: mysql_version_major|int >= 8 + + - name: "Update the my.cnf" + template: "src=foo.cnf.j2 dest=/etc/mysql/my.cnf owner=root mode=0644" + + - name: "Adjust permissions of datadir" + file: + path: "/var/lib/mysql" + owner: "mysql" + group: "mysql" + mode: 0700 + state: "directory" + + - name: "Restart mysql to apply changes done in my.cnf file" + service: + name: "mysql" + state: "stopped" + + - name: "Restart mysql to apply changes done in my.cnf file" + service: + name: "mysql" + state: "started" post_tasks: diff --git a/tests/archivematica-upgrade/templates/foo.cnf.j2 b/tests/archivematica-upgrade/templates/foo.cnf.j2 new file mode 100644 index 0000000..ec43aad --- /dev/null +++ b/tests/archivematica-upgrade/templates/foo.cnf.j2 @@ -0,0 +1,95 @@ +# +# The MySQL database server configuration file. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock + +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 +open-files-limit = 16384 + +[mysqld] +# * Basic Settings +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +disable_log_bin +lc_messages_dir = /usr/share/mysql/ +bind-address = 127.0.0.1 +skip-external-locking +default_authentication_plugin=mysql_native_password + +# * Fine Tuning +key_buffer_size = 16M +max_allowed_packet = 256M +thread_stack = 192K +thread_cache_size = 8 +myisam-recover-options = BACKUP +max_connections = 500 +table_open_cache = 64 +sort_buffer_size = 256K + +# ** Query Cache Configuration, removed in MySQL >= 8.0 + +# ** Logging and Replication +log_error = /var/log/mysql/error.log +log_error_verbosity = 1 +#general_log_file = /var/log/mysql/mysql.log +#general_log = 1 +# +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name + +# ** InnoDB +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +innodb_flush_log_at_trx_commit = 1 +innodb_buffer_pool_size = 256M +innodb_lock_wait_timeout = 50 +innodb_log_buffer_size = 1M +innodb_log_file_size = 64M +innodb_file_per_table = 1 + + +# ** Security Features +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ + +character_set_server = utf8mb4 +collation_server = utf8mb4_0900_ai_ci +character-set-client-handshake = FALSE + +[mysqldump] +quick +quote-names +max_allowed_packet = 128M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completition + +[isamchk] +key_buffer = 16M + +# +# * IMPORTANT: Additional settings that can override those from this file! +# The files must end with '.cnf', otherwise they'll be ignored. +# +!includedir /etc/mysql/conf.d/ \ No newline at end of file