Developer Area/Common issues: Difference between revisions
From Mahara Wiki
< Developer Area
(Created page with "=== Elastic search triggers not dropped properly === At the moment we use DB triggers for elastic search updates, but we're looking into a better alternative. While we're wor...") |
No edit summary |
||
Line 1: | Line 1: | ||
=== Elastic search triggers not dropped properly === | ===Elastic search triggers not dropped properly=== | ||
At the moment we use DB triggers for elastic search updates, but we're looking into a better alternative. While we're working on it, some people might have this problem. | At the moment we use DB triggers for elastic search updates, but we're looking into a better alternative. While we're working on it, some people might have this problem. | ||
==== PROBLEM ==== | ====PROBLEM==== | ||
DB postgres. | DB postgres. | ||
Having elastic search set up on the site. | Having elastic search set up on the site. | ||
Line 11: | Line 11: | ||
This means the cron got stuck while trying to drop/re-create the triggers. | This means the cron got stuck while trying to drop/re-create the triggers. | ||
==== SOLUTION ==== | ====SOLUTION==== | ||
We need to manually remove the trigger that was not dropped. And also check if we need to delete the record in pg_depend table. | We need to manually remove the trigger that was not dropped. And also check if we need to delete the record in pg_depend table. | ||
# search for the trigger name in pg_trigger table | #search for the trigger name in pg_trigger table | ||
select oid,tgname,tgfoid from pg_trigger where tgname ='search_elasticsearch_interaction_forum_post'; | select oid,tgname,tgfoid from pg_trigger where tgname ='search_elasticsearch_interaction_forum_post'; | ||
===== This is how the tables should look like when everything's ok: ===== | #with that result, if there's a record in pg_depend where pg_depend.refobjid=pg_trigger.tgfoid and pg_depend.objid=pg_trigger.oid, then delete it | ||
#delete the trigger with name 'search_elasticsearch_interaction_forum_post' | |||
=====This is how the tables should look like when everything's ok:===== | |||
'''select oid,tgname,tgfoid from pg_trigger where tgname like '%elastic%';''' | '''select oid,tgname,tgfoid from pg_trigger where tgname like '%elastic%';''' | ||
Line 50: | Line 52: | ||
14471171 | search_elasticsearch_queue_artefact_trigger | 14471171 | search_elasticsearch_queue_artefact_trigger | ||
14471172 | search_elasticsearch_queue2_trigger | 14471172 | search_elasticsearch_queue2_trigger | ||
=== PDF export === | |||
==== Chrome / Chromium installed via Snap ==== | |||
When the PDF export process was implemented it worked in Ubuntu because Chromium Browser was installed via apt-get. But then later Chromium was installed via Snap or apt-get. And later still via Snap only. | |||
If your system installs Chromium via snap then to get Chrome-php to work you will need to adjust a couple of things because Snap will only create folders in a /home/ dir path and www-data has it's default home directory in /var/www/ | |||
So to get around this problem we can update the home directory for 'www-data' user. | |||
But keep in mind you are changing the Ubuntu Apache defaults and it may break some things in your setup from working. | |||
TRY AT YOUR OWN RISK | |||
1) As 'root' user - create a new directory in /home/ called 'www-data' with the following permissions: 755 | |||
2) Go into the /home/www-data/ directory and create a new directory called 'snap' that is owned by 'www-data' and permissions: 755 | |||
3) Update the path to www-data home directory: sudo usermod -d /home/www-data www-data | |||
You may need to restart the machine | |||
Then when you try and do an export with Pdfexport active it should work! |
Revision as of 12:19, 12 Mayıs 2022
Elastic search triggers not dropped properly
At the moment we use DB triggers for elastic search updates, but we're looking into a better alternative. While we're working on it, some people might have this problem.
PROBLEM
DB postgres. Having elastic search set up on the site. While running cron, we have an error that looks like this: -5: ERROR: trigger "search_elasticsearch_interaction_forum_post" for relation "interaction_forum_post" already exists] in EXECUTE("CREATE TRIGGER "search_elasticsearch_interaction_forum_post" BEFORE INSERT OR UPDATE OR DELETE ON "interaction_forum_post"
This means the cron got stuck while trying to drop/re-create the triggers.
SOLUTION
We need to manually remove the trigger that was not dropped. And also check if we need to delete the record in pg_depend table.
- search for the trigger name in pg_trigger table
select oid,tgname,tgfoid from pg_trigger where tgname ='search_elasticsearch_interaction_forum_post';
- with that result, if there's a record in pg_depend where pg_depend.refobjid=pg_trigger.tgfoid and pg_depend.objid=pg_trigger.oid, then delete it
- delete the trigger with name 'search_elasticsearch_interaction_forum_post'
This is how the tables should look like when everything's ok:
select oid,tgname,tgfoid from pg_trigger where tgname like '%elastic%'; oid | tgname | tgfoid 14471173 | search_elasticsearch_usr | 14471170 14471174 | search_elasticsearch_interaction_instance | 14471170 14471175 | search_elasticsearch_interaction_forum_post | 14471170 14471176 | search_elasticsearch_group | 14471170 14471177 | search_elasticsearch_view | 14471170 14471178 | search_elasticsearch_artefact | 14471171 14471179 | search_elasticsearch_view_artefact | 14471172 14471180 | search_elasticsearch_block_instance | 14471170 14471181 | search_elasticsearch_collection | 14471170
select objid,refobjid from pg_depend where refobjid in (14471170,14471171,14471172); objid | refobjid 14471173 | 14471170 14471174 | 14471170 14471175 | 14471170 14471176 | 14471170 14471177 | 14471170 14471178 | 14471171 14471179 | 14471172 14471180 | 14471170 14471181 | 14471170
select oid,proname from pg_proc where proname like '%elas%'; oid | proname 14471170 | search_elasticsearch_queue_trigger 14471171 | search_elasticsearch_queue_artefact_trigger 14471172 | search_elasticsearch_queue2_trigger
PDF export
Chrome / Chromium installed via Snap
When the PDF export process was implemented it worked in Ubuntu because Chromium Browser was installed via apt-get. But then later Chromium was installed via Snap or apt-get. And later still via Snap only.
If your system installs Chromium via snap then to get Chrome-php to work you will need to adjust a couple of things because Snap will only create folders in a /home/ dir path and www-data has it's default home directory in /var/www/
So to get around this problem we can update the home directory for 'www-data' user. But keep in mind you are changing the Ubuntu Apache defaults and it may break some things in your setup from working.
TRY AT YOUR OWN RISK
1) As 'root' user - create a new directory in /home/ called 'www-data' with the following permissions: 755 2) Go into the /home/www-data/ directory and create a new directory called 'snap' that is owned by 'www-data' and permissions: 755 3) Update the path to www-data home directory: sudo usermod -d /home/www-data www-data
You may need to restart the machine
Then when you try and do an export with Pdfexport active it should work!