Multiple different migration documents - which one should we use?

So, after all this we still have a problem :frowning:

Navigating to the IP address via a browser, we see:

Error: Database connection failed

It is possible that the database is overloaded or otherwise not running properly.

The site administrator should also check that the database details have been correctly specified in config.php

I have NOT copied the config.php file (or any elements within it) from the old /opt/bitnami/apps/moodle/htdocs/config.php to (what I suspect) is the new location at /opt/bitnami/moodle/config.php.

What needs to be done now?

Actually, that was the first error (on boot), now the website direct immediately to "localhost".

It seems as if that running the sudo /opt/bitnami/bncert-tool has resulted in errors:

Performing changes to your installation

The Bitnami HTTPS Configuration Tool will perform any necessary actions to your
Bitnami installation. This may take some time, please be patient.


Error

An error occurred when applying configurations.

The web server configuration was left unchanged. There was an error in the new
configuration, so it was reverted.

Failed steps:
* Starting web server: Failed to start

Find more details in the log file:

/tmp/bncert-202011051107.log

If you find any issues, please check Bitnami Support forums at:

https://community.bitnami.com

Press [Enter] to continue:

I think this is the pertinent line:

Script output:

Script stderr:
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

Which then cause the web server config to be reverted:

Checking web server started
Restoring web server configuration
[11:09:17] Restoring configuration file /opt/bitnami/apache/conf/httpd.conf from /opt/bitnami/apache/conf/httpd.conf.back.202011051107
Setting variable diff from diff -uw /opt/bitnami/apache/conf/httpd.conf /opt/bitnami/apache/conf/httpd.conf.back.202011051107
Script exit code: 1

Script output:
--- /opt/bitnami/apache/conf/httpd.conf 2020-11-05 11:09:09.955909012 +0000
+++ /opt/bitnami/apache/conf/httpd.conf.back.202011051107 2020-10-29 15:22:05.000000000 +0000
@@ -200,7 +200,7 @@
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
-ServerName demomoodle2.mydomain.com:80
+ServerName www.example.com:80

@michiel any thoughts on this? I'm now kinda stuck. I suspect the redirection to "Localhost" is something to do with Apache, although I have looked through the various config files and added server and site name, but as yet nothing. I'm loathed to go too far as the application part of this should be almost OOTB, and navigating to http://ip_address should "just work".

Hi @swin,

I'm sorry to hear that, I hope you will recover soon.

/binami/moodle is a symbolic link pointing to /opt/bitnami/moodle.

The permissions are 775 for folders and 664 for files.

Thank you for the detailed description. Our docs team will check it.

To troubleshoot the issue could you run the bnsupport tool and paste the generated code ID here?

sudo /opt/bitnami/bnsupport-tool

Regards,
Michiel

Are you sure?

bitnami@debian:~$ ls /bitnami/ -halt
total 24K
drwxrwsr-x 13 daemon daemon 4.0K Nov  3 12:57 moodledata
drwxr-xr-x 23 root   root   4.0K Oct 29 15:24 ..
drwxrwxr-x  3 root   root   4.0K Oct 29 15:23 mariadb
drwxrwxr-x  2 daemon root   4.0K Oct 29 15:23 phpmyadmin
drwxr-xr-x  6 root   root   4.0K Oct 29 15:23 .
drwxrwxr-x  2 daemon root   4.0K Oct 29 15:23 moodle

If it were a symbolic link it would show in green/turquoise and look like this (i.e. the stack and htdocs folder) surely?

bitnami@debian:~$ ls -halt
total 2.5G
-r-------- 1 bitnami bitnami  438 Nov  5 11:10 bitnami_credentials
-rw------- 1 bitnami bitnami 1.2K Nov  5 10:33 .bash_history
drwxr-xr-x 5 bitnami bitnami 4.0K Nov  4 18:26 .
-rw------- 1 bitnami bitnami  182 Nov  4 18:26 .mysql_history
drwxr-xr-x 3 bitnami bitnami 4.0K Nov  4 18:23 htdocs-backup
drwxrwxr-x 7 daemon  root    4.0K Nov  4 17:21 moodledata
-rw-r--r-- 1 bitnami bitnami 1.4K Nov  4 17:20 .profile
-rw-r--r-- 1 bitnami bitnami 4.1K Nov  4 17:20 .bashrc
-rw-r--r-- 1 bitnami bitnami 1.1G Nov  4 14:39 backup-moodle.sql
-rw-r--r-- 1 bitnami bitnami 1.4G Nov  4 14:15 moodledata-backup.tgz
-rw-r--r-- 1 bitnami bitnami  70M Nov  4 14:11 htdocs-backup.tgz
-rw-r--r-- 1 bitnami bitnami 1.3K Nov  3 11:37 upgrade_moodel.txt
drwxrwxr-x 2 daemon  root    4.0K Oct 29 15:23 moodle
drwxr-xr-x 3 root    root    4.0K Oct 29 15:23 ..
lrwxrwxrwx 1 root    root      12 Oct 29 15:22 stack -> /opt/bitnami
lrwxrwxrwx 1 root    root      27 Oct 29 15:22 htdocs -> /opt/bitnami/apache2/htdocs
-rw-r--r-- 1 bitnami bitnami  220 May 25 18:16 .bash_logout
-rw-r--r-- 1 bitnami bitnami   95 May  1  2020 readme.txt

bnsupport-tool GUID: 8cc97f29-16cc-bcee-253d-7493cd19dbe8

Hi @swin,

Sorry, my bad, I meant it the other way around /opt/bitnami/moodle is a symbolic link pointing to /binami/moodle.

Regarding the bncert tool error, it seems the bncert could not restart Apache. Can you try it manually?

sudo ./ctlscript.sh restart apache

Regards,
Michiel

Hi @michiel, err, I think you are wrong there too :slight_smile:. This is also just a plain vanilla directory...

Neither folder links to the other. The folder /opt/bitnami/moodle DOES contain info that was in the old /opt/bitnami/apps/moodle/htdocs/, but there is literally NOTHING in the /binami/moodle. This may be unintended on your part, but it is certainly what you guys have built as of today.

bitnami@debian:~$ ls /opt/bitnami/ -halt
total 92K
drwxr-xr-x  2 bitnami bitnami 4.0K Nov  6 16:26 stats
drwxr-xr-x  3 root    root    4.0K Nov  5 11:09 apps
drwxr-xr-x  4 bitnami root    4.0K Nov  5 11:05 letsencrypt
drwxr-xr-x 20 root    root    4.0K Nov  5 11:05 .
drwxrwxr-x 57 bitnami daemon  4.0K Nov  5 10:41 moodle
drwxr-xr-x  6 root    root    4.0K Nov  4 17:20 var
drwxr-xr-x 13 root    root    4.0K Oct 29 15:23 mariadb
drwxr-xr-x  3 root    root    4.0K Oct 29 15:23 ..
drwxr-xr-x  6 root    root    4.0K Oct 29 15:23 mysql
drwxr-xr-x  4 root    root    4.0K Oct 29 15:23 bnsupport
drwxr-xr-x 11 root    root    4.0K Oct 29 15:23 scripts
drwxrwxr-x 14 bitnami daemon  4.0K Oct 29 15:23 phpmyadmin
drwxr-xr-x 17 root    root    4.0K Oct 29 15:23 apache
drwxr-xr-x  3 root    root    4.0K Oct 29 15:23 bncert
drwxr-xr-x  6 root    root    4.0K Oct 29 15:23 common
drwxr-xr-x  4 root    root    4.0K Oct 29 15:23 gonit
drwxr-xr-x  3 root    root    4.0K Oct 29 15:23 libmod_pagespeed
drwxr-xr-x  3 root    root    4.0K Oct 29 15:23 libmod_pagespeed_ap24
drwxr-xr-x  7 root    root    4.0K Oct 29 15:23 nami
drwxr-xr-x 12 root    root    4.0K Oct 29 15:23 php
-rwxr-xr-x  1 root    root    1.5K Oct 29 15:23 ctlscript.sh
-rwxrwx---  1 bitnami root     114 Oct 29 15:23 properties.ini
lrwxrwxrwx  1 root    root       6 Oct 29 15:21 apache2 -> apache
lrwxrwxrwx  1 root    root      47 Sep  8 12:08 bncert-tool -> /opt/bitnami/bncert/bncert-0.5.12-linux-x64.run
lrwxrwxrwx  1 root    root      52 Jun 25 18:10 bnsupport-tool -> /opt/bitnami/bnsupport/bnsupport-0.9.2-linux-x64.run
-rw-r--r--  1 root    root     754 Apr 15  2020 bnsupport-regex.ini

WRT apache, this is running just fine. As noted in my instructions, you MUST fix the fix “Control file ‘/etc/gonit/gonitrc’ does not exists” issue (https://community.bitnami.com/t/control-file-etc-gonit-gonitrc-does-not-exists-lamp-aws/86733/15) in order to get this to work properly though.

bitnami@debian:~$ ps aux | grep apache                                      
root      4997  0.0  1.7  14300  8784 ?        Ss   Nov05   0:04 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
daemon    6231  0.0  1.9 1867376 9724 ?        Sl   00:00   0:00 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
daemon    6232  0.0  1.5 1867376 7720 ?        Sl   00:00   0:00 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
daemon    6580  0.0  1.9 1867376 9720 ?        Sl   00:21   0:00 /opt/bitnami/apache/bin/httpd -f /opt/bitnami/apache/conf/httpd.conf
bitnami   7624  0.0  0.1   6076   804 pts/0    S+   17:06   0:00 grep apache

Actually, I lied, the apache service isn;t starting, even though it says it is:

bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh start apache 
Started apache

bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

Does this have anything to so with the supposed "fix" for gonitrc?

Hmm,

bitnami@debian:~$ sudo gonit
Socket file '/var/run/gonit.sock' is not writable
bitnami@debian:~$ 
bitnami@debian:~$ sudo gonit status
Cannot find any running daemon to contact. If it is running, make sure you are pointing to the right pid file (/var/run/gonit.pid)

Hi @swin,

Can you try to start gonit manually:

sudo gonit

If it does not start could you kill it and restart the services?

sudo pkill -f gonit
sudo rm /var/run/gonit.sock
sudo /opt/bitnami/ctlscript.sh start

If it fails can you tell me the output of the following command:

sudo tail -n30 /var/log/gonit.log

Regards,
Michiel

I rebooted then ran bits of the above. Whilst the ctlscript.sh now ran, the results were disappointing.

bitnami@debian:~$ sudo gonit
daemon with PID 1076 awakened
bitnami@debian:~$ sudo gonit status

Uptime                         73h56m13s
Last Check                     2020-11-09 19:23:24.036754312 +0000 UTC m=+266160.691424689
Next Check                     2020-11-09 19:25:24.036754312 +0000 UTC m=+266280.691424689
Pid                            1076
Pid File                       /var/run/gonit.pid
Control File                   /etc/gonit/gonitrc
Socket File                    /var/run/gonit.sock
Log File                       /var/log/gonit.log
Process 'apache'
  monitoring status                        Not monitored

Process 'mariadb'
  monitoring status                        Not monitored

Process 'php-fpm'
  monitoring status                        Not monitored

bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh status
apache not running
mariadb not running
php-fpm not running
bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh start
Starting services..
bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh status
apache not running
mariadb not running
php-fpm not running

Hmm, tried this, and things started:

bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh start all
bitnami@debian:~$ sudo /opt/bitnami/ctlscript.sh status   
apache already running
mariadb already running
php-fpm already running

But still navigating to the FQDN or IP address result in a redirect to locahost.

Hi @swin,

It seems Moodle is doing the redirection:

HTTP/1.1 303 See Other
Date: Tue, 10 Nov 2020 15:42:07 GMT
Server: Apache/2.4.46 (Unix) OpenSSL/1.1.1d
X-Powered-By: PHP/7.3.23
X-Redirect-By: Moodle
Content-Language: en
Location: http://localhost
Content-Type: text/html; charset=UTF-8

Can you tell me the value of $CFG->wwwroot in the config.php file?

Regards,
Michiel

Hi @michiel - Urgh :frowning: Can't believe I glossed over this. TBH, last week I was recovering from COVID and not particularly focused. There were a number of issues that needed to be fixed relating to themes and plugins, but in general, the site is now up :slight_smile:

1 Like

Hi @swin,

I'm glad to hear that. I hope you have fully recovered now.

Best regards,
Michiel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Thanks for pointing this out. We have updated the detailed guide at https://docs.bitnami.com/general/how-to/migrate-moodle/ and also the page at https://docs.bitnami.com/vmware-marketplace/apps/moodle/administration/migrate/

1 Like