Server / DB problems after migration to root server

Server / DB problems after migration to root server

by Mark Hubertus -
Number of replies: 15

Dear Community,

  • after a migration from a shared hosting to our own root server we are facing some issues, which at times even crash the server: "Server Error 403 Forbidden - You do not have permission to access this document". This only happens in this particular activity.
  • When trying to register the moved site the registration plugin tells us that registration had been successful. But when I check the task log files there's an error:  Scheduled task failed: website registration (core\task\registration_cron_task), The hub cannot access your site at https://go-moodle.de - Unexpected HTTP response code 503. Your Moodle site and the hub need to be able to communicate with each another.

  • The following task also fails: Scheduled task failed: Remove temporary write access from controlled links  (repository_onedrive\remove_temp_access_task), 'Cannot connect as system user'
When we installed the webserver on our new machine we used a different system user than the one on the shared hosting. This is why I ask myself, whether this may be root of the problem, because there are some tables in the database or files and folders in the moodle code which still have the ownership of the old system user.

Have you got any ideas how to pin down the problem? Where to look?

Here's some background information on our system: 
  • moodle-Version Version 3.10.4 (Build: 20210510) (2020110904)
  • Operating system: Debian 10.9
  • Plesk Obsidian v18.0.35_build1800210430.11 os_Debian 10.0
  • SQL-data base: MariaDB  localhost:3306 

Any help would be appreciated.


Average of ratings: -
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Ken Task -
Picture of Particularly helpful Moodlers

While your operating system is well-known  config of web service on your new environment is not 100 Debian well-known ... but rather Plesk

Your web service is nginx ... and thus you might want to view docs/faqs from Plesk that are related ... like:

https://docs.plesk.com/en-US/obsidian/administrator-guide/web-servers/apache-and-nginx-web-servers-linux/apache-and-nginx-configuration-files.68678/

When you say root ... do you mean as root user via ssh?  or something else ... like root for normal Debian Apache is /var/www/ (or something like that).

In Plesk you should have a tool to browse files ... that will also allow you to check ownerships/permissions on files and folders.  Check those for your transferred moodle code directory as well as moodledata (path to moodledata found in the config.php file of moodle code).

Not sure the DB tables have 'ownerships' ... roles in Moodle ... but not ownerships/permissions on DB files ... that's MariaDB and Pleak and Debian.

Not a Plesk nor Debian user so the above I'd not consider 'expert advice' ... cept to say ... you've picked your 'poison' (OS, Panel) ... now learn your antedote! (we all do that!).   Do know that there are things one should not change via root user via ssh on such a system unless one knows what Plesk expects/allows you to do! smile

'SoS', Ken



In reply to Ken Task

Re: Server / DB problems after migration to root server

by Mark Hubertus -
Dear Ken,

Thank you for your reply!

It is a root server with ssh access on which Plesk Obisdian is installed. The moodle server is a vhost in /var/www/vhosts/... .

I checked the directory and file ownership in /httpdocs and it seems that all files are owned by the correct system use, i. e. the one given when setting up the webserver in Plesk.

I've paid my dues with regards to ssh interference, but I don't think this is the issue here. wink
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Ken Task -
Picture of Particularly helpful Moodlers

Moodle has open_base_dir setting in config.php - last line.

Plesk is kinda restrictive about that ... document root is in htdocs - that's where your moodle code resides.   If, when you migrated moodledata, you located that directory at the same level as htdocs, Plesk settings for open_base_dir might need to have an addtional path added to what it has as default ... that of htdocs.   Full path to moodledata.

The repository thang ... in moodledata/respository/ there is a onedrive directory ... and it's that one reported in the error - access denied.

What are ownerships/permissions on all of moodledata ... recursively?

Since you appear to be using the Plesk interface to login, the owner of htdocs as well as moodledata is who?   root?   Shouldn't that be the user used to login to Plesk.

'SoS', Ken

In reply to Ken Task

Re: Server / DB problems after migration to root server

by Mark Hubertus -
Hi Ken,
if I got you correctly, you think it might be necessary to add the following information to the open_base_dir in the PHP settings:

/var/www/vhosts/sampledomain.com/httpdocs
/var/www/vhosts/sampledomain.com/moodledata

This is where the moodle code and moodledata reside. I did what you suggested for unoconv as this directory lies outside the plesk subscription.
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

Does this happen during busy times? Otherwise this is not necessarily a performance problem.

Noticed the repository_onedrive\remove_temp_access_task. So, what are the additional plug-ins installed?

Did you follow https://docs.moodle.org/310/en/Moodle_migration to the dot? Is the new URL different from the old one? (Even http->https counts.) Then did the final "replace" part?

In any case, raise the https://docs.moodle.org/310/en/Debugging level to DEVELOPER and get a detailed trace.

N.B. Your "root" server is perhaps not a full physical server, but a form of virtualization where you get "dedicated" CPUs. Shouldn't change anything in the discussion, as long as you have the real super user (root) login.
In reply to Visvanath Ratnaweera

Re: Server / DB problems after migration to root server

by Mark Hubertus -
Hi Visvanath,

it also happened while still in maintenance mode. So there wasn't anybody else logged in or any other server processes running.

Only with your question I realized that we indeed installed a onedrive plugin. This might actually be responsible for one of the errors. I'll deinstall it and see if this gets rid of the error message.

I followed the migration as described in the document you are referring to but not to the dot as we use exactly the same domain name. This is why I thought the "replace" part might not be necessary.

I'll definitely raise the debugging level to see what causes the problem with the assignment activity.

Cheers
Mark
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Mark Hubertus -
I just noticed that I get the same error message that I get with role switching in the assignment activity when I try to uninstall the OneDrive plugin (repository_onedrive) or any other plugin.

"Server Error 403 Forbidden You do not have permission to access this document." 😳

I'm wondering if there's something wrong with the admin role?!?

Mark
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
The role model in Moodle has absolutely no connection to the users and file permissions in the Linux system. Moodle rides the web server, which in turn is a system user, called www-data in Debian. The errors suggest that there is something wrong at the system level. I assume that you haven't changed Moodle code nor corrupted anything during the transition.

The fact that you are both, the super user root on the shell at the same time manipulating through the Plesk interface makes it impossible for a purely shell user (like me) to go in to details. AFAIAC the log trace I mentioned earlier may open up a line for the others.
In reply to Visvanath Ratnaweera

Re: Server / DB problems after migration to root server

by Mark Hubertus -

Dear Visvanath,

Thanks for the time you are taking for my issue.

As you suggested I raised the debugging leve, but I'm now looking for tge php log files, which I haven't found yet to look for errors. Are we talking about moodle log files or linux log files? Sorry for such an uninformed question.

Mark

In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

The https://docs.moodle.org/310/en/Debugging messages I am talking about look like this https://moodle.org/mod/forum/discuss.php?d=421262#p1697715.

I have a vague feeling that your problem could be something as simple as a wrong Unix file ownership or a stale cache. Unfortunately you are in the wrong forum. Here we look in to performance problems using different tools. The correct forum for your problem is the Installing and upgrading forum where you'll find folks who know Plesk, etc. (Hint to the moderator)
In reply to Visvanath Ratnaweera

Re: Server / DB problems after migration to root server

by Mark Hubertus -
Hi Visvanath,

As we are running a production site I cannot display debugging messages. This is why I would like to read the error logs mentioned in the 'debugging' article you recommended:

"It is recommended that a record of error messages is kept, and for the admin to regularly monitor the error logs. This may be done by setting 'Debug messages' (debug) to Normal and leaving 'Display debug messages' (debugdisplay) off (unticked). Error messages are then recorded in the server logs."

Can theses messages be found anywhere in the moodle-server or are we talking about our linux server, because I just noticed on the phpinfo() page of our plesk that the value for error_log is empty. 


In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Sure you can choose not to display the debug messages on the web page, see the switches in https://docs.moodle.org/310/en/Debugging#Enabling_debugging or the corresponding lines in https://docs.moodle.org/310/en/Debugging#In_config.php. Then the messages go to the web server logs. The usual place in Debian is /var/log/apache2/. Your Plesk could have changed it.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Server / DB problems after migration to root server

by Mark Hubertus -
I found the log files! Thank you for the hint.

We found out that our server problems can be avoided when we switch off the plesk firewall, which of course cannot be the permanent solution.

I am now going to try and reproduce the error and then check the log files.
In reply to Mark Hubertus

Re: Server / DB problems after migration to root server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Local firewall? The problem with site registration was the hint. In fact, firewalls came to my mind but discarded since Debian doesn't install a local firewall by default. Apparently Plesk is not Debian.

If your site works perfectly when the firewall is gone, then your original problem is solved. Firewalls is a different (long) story, luckily unrelated to Moodle. In any case I'm signing off, you are getting good advice from others (Mr K ;) ).
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Server / DB problems after migration to root server

by Mark Hubertus -
After having identified the web application firewall (ModSecurity) configured in plesk as the culprit, we added the IDs of the process given in the error logs (Thanks Visvanath!!) to the exception rules. Now everything seems to be working as it's supposed to. Cased solved! 👍