-
Notifications
You must be signed in to change notification settings - Fork 5
Adds support for using a remote database. #6
base: master
Are you sure you want to change the base?
Adds support for using a remote database. #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple more spots to touch up:
- https://github.com/Islandora-Devops/ansible-role-matomo/blob/master/templates/config.ini.php.j2#L4 needs to be changed to
{{ matomo_db_host }}
- https://github.com/Islandora-Devops/ansible-role-matomo/blob/master/templates/config.ini.php.j2#L13 needs to be changed to
{{ matomo_host }}:{{ apache_listen_port }}
I'm spinning up an environment now to confirm.
That solves some initial problems, but now the mysql db dump is not restoring properly. Despite having the mysql client installed on the matomo server, it's not able to find it. I'm at a loss as to why, and am toying with |
@dbernstein I managed to get this working, but had to adapt the commands to generate and import the sql dump like so: - name: prepare mysql dump restore
template:
src: "matomo.sql.j2"
dest: "/opt/matomo.sql"
owner: "{{ matomo_user }}"
group: "{{ matomo_user }}"
force: no
register: motomo_sql_dump_create
delegate_to: "root@{{ matomo_db_host }}"
- name: restore dump
mysql_db:
name: "{{ matomo_db_name }}"
target: "/opt/matomo.sql"
state: import
login_user: "{{ matomo_db_root_user }}"
login_password: "{{ matomo_db_root_password }}"
ignore_errors: yes
when: motomo_sql_dump_create | changed
delegate_to: "root@{{ matomo_db_host }}" I'm not entirely sure why I had to do that, as the mysql client exists on the server, and one could presumably pipe a file to it. But it's something. Open to suggestions on this one from folks. @Islandora-Devops/committers? |
Not sure what was going on before, but I've found I can successfully make it through mysql import if you add the proper packages for your distro. If you split out the db server, those packages aren't on the other server if you run the playbook. diff --git a/tasks/main.yml b/tasks/main.yml
index 7389ffe..f2e0c1e 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -13,6 +13,17 @@
httpd_conf_directory: "{{ __httpd_conf_directory }}"
when: httpd_conf_directory is not defined
+- name: Define OS-specific matomo_packages to install
+ set_fact:
+ matomo_packages: "{{ __matomo_packages }}"
+ when: matomo_packages is not defined
+
+- name: Install requisite packages
+ package:
+ name: "{{ item }}"
+ state: present
+ with_items: "{{ matomo_packages }}"
+
# Create database
- include_tasks: db-mysql.yml
tags:
diff --git a/vars/Debian.yml b/vars/Debian.yml
index 221db14..deee5d9 100644
--- a/vars/Debian.yml
+++ b/vars/Debian.yml
@@ -4,3 +4,7 @@ httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf-enabled"
__matomo_user: www-data
__httpd_conf_directory: /etc/apache2
+
+__matomo_packages:
+ - python-mysqldb
+ - mysql-client
diff --git a/vars/RedHat.yml b/vars/RedHat.yml
index 2e115a6..2d8edda 100644
--- a/vars/RedHat.yml
+++ b/vars/RedHat.yml
@@ -4,3 +4,7 @@ httpd_conf_directory_enabled: "{{httpd_conf_directory}}/conf.d"
__matomo_user: apache
__httpd_conf_directory: /etc/httpd
+
+__matomo_packages:
+ - MySQL-python
+ - mysql |
@dbernstein If you can include those changes, I'd be happy to merge this in. |
@dbernstein are those changes going to be included? |
@dannylamb : do these dump/restore tasks go in tasks/main.yml or tasks/db-mysql.yml? |
@dbernstein That was a red herring. You can safely ignore that comment. The patch alone should handle everything. |
GitHub Issue: N/A
Release pull requests, etc.)
What does this Pull Request do?
It allows the matomo database to live on a non-local database server.
What's new?
The parameters that allow for remote database creation and connection.
How should this be tested?
Set up a remote database server and specify the necessary parameter overrides.
Interested parties
Tag (@ mention) interested parties or, if unsure, @Islandora-Devops/committers