Forums | Mahara Community

Support /
Moving Mahara site to new server


anonymous profile picture
Account deleted
Posts: 31

04 September 2012, 1:07

Hi Guys,

We are about to move our mahara site from our test server to our production server. Just wondering about the process?

Is it as easy as:

-Backup and restore database to new server

-Copy Mahara Code to new server

-Copy Dataroot directory to new server.


Or do i have to first download the mahara code and run the installer on the new server, and then copy everything over?

 

Thanks

anonymous profile picture
Account deleted
Posts: 31

05 September 2012, 18:20

Been trying to do an export and import of the mysql database, but im getting the following error. Can anybody help me with this?

Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 12
STR: //
SQL: 
DELIMITER //
CREATE TRIGGER `update_unread_insert_trigger` AFTER INSERT ON `notification_internal_activity`
 FOR EACH ROW BEGIN
                    
            IF NEW.read = 0 THEN
                UPDATE "usr" SET unread = unread + 1 WHERE id = NEW.usr;
            END IF;
                END
//

 

SQL query:

DELIMITER // CREATE TRIGGER `update_unread_insert_trigger` AFTER INSERT ON `notification_internal_activity` FOR EACH ROW BEGIN IF NEW.read = 0 THEN UPDATE "usr" SET unread = unread + 1 WHERE id = NEW.usr; END IF; END //

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"usr" SET unread = unread + 1 WHERE id = NEW.usr;
            END IF;
          ' at line 5

Gordon McLeod's profile picture
Posts: 197

06 September 2012, 6:16

Hi Mathew,

Must be that time of year - I'm also migrating today!

I used mysql workbench to do a backup of the database and only got it restored properly on test server after I dropped the existing (shell) database that was created when I installed Mahara and did a restore without any existing database - otherwise it kept hitting errors.

My next issue is that the new site has a new name/url - but all of the artefact links seem to be hard coded to the old site. What I don't see in the site admin section is anywhere I can do a find & replace of those url's (ie replace blah.blah/mahara bit of the url with blah.blah/maharanew).

Can anyone point me in the right direction - do I need to hack the database to amend the filenames (any tips on syntax to do this would be helpful, databases aren't my thing) - or is there a tool inbuilt that can be run (like the replace.php one in Moodle)?

Thanks, Gordon.

anonymous profile picture
Account deleted
Posts: 31

06 September 2012, 6:30

Ahh after 5-6 hours of constantly exporting and importing, changing options i finally worked out that phpmyadmin was my issue, when i did a dump via command line and then imported via command line it seemed to work and not throw any errors, only weird thing is that on the original server the database was about 140mb and then after the transfer it was about 117mb.

 

But now i am faced with the same issue that you are, main page and menus work, but asoon as i click on a group mahara looks for the old server address even tho ive changed it in the config.php

Gordon McLeod's profile picture
Posts: 197

06 September 2012, 10:15

Another hour of googling before I came across this in the mahara forums 'read me first' smallprint. A nice page about how to move your server to a new address would be useful!

If I'm reading this correctly Mahara pulls the wwwroot address into the address of each artefact, so updating that in the database config setting will repoint all links.

Question - does the new folder structure (ie where you put maharadata and mahara on the server) need to mirror exactly the original site for this to work? - ie if structure changes from var/www/mahara to var/www/sites/mahara (or same idea for maharadata) does that mean the links won't point to the correct place?

*****************

I moved my Mahara installation to a new server/wwwroot, and now it doesn't work?!

Mahara stores the wwwroot for the site in the config table in the database. If you move your site, you must update this value too. An SQL command such as this will suffice:

UPDATE config SET value = '[new-wwwroot]' WHERE field = 'wwwroot'; 

Moving wwwroot will break MNET, because SSL keys are generated for hostnames. If you are moving host, you will have to delete your existing key, and then re-peer with any remote applications. The steps involved are:

  1. Run this SQL: DELETE FROM config WHERE field LIKE 'openssl%';

  2. Visit the Networking page in the admin section, which will generate a new key for you (you can verify this by looking in the config table)

  3. Take the public key shown on the networking page, and give it to the remote application. For example, with Moodle you'll need to update the public key for the Peer that corresponds to your Mahara site.
anonymous profile picture
Account deleted
Posts: 31

06 September 2012, 18:26

Hi Gordon,

Thanks for that.

A post by Account deleted was deleted

anonymous profile picture
Account deleted
Posts: 27

27 September 2012, 17:01

Might as well stack all the "moving to a new server" queries together...

Redhat
Mahara v1.4.0
Apache2
mySQL

I've successfully moved our Mahara instance from one server to another. it's up and running and almost ready to open to the users again except...

A vestige of the old site URL is showing up in many user text blocks where they've created links to pages within Mahara. The vestige is breaking the links.

The old site URL was of the format https://orange.institution.ca/mahara
The new URL is https://apple.institution.ca (no 'mahara', we now have a dedicated server).

The links are appearing as https://apple.institution.ca/mahara/view/view.php?id=10571

I was successful earlier in the transfer process running the database dump through sed, replacing all occurances of the old server name with the new server name and thought I could do the same for this issue. But no.

No matter how carefully I craft the sed replacement string, after I reload the modified database data, the blocks containing the modified links are empty. No links at all. I'm about to tear out my hair over this. Soooo close.

Edited to add: When I look at the modified sql file before I load it, the URLs *have* changed and are correct. I just can't figure out why the text blocks are empty.

Hrynkiw
Kwantlen Polytechnic

anonymous profile picture
Account deleted
Posts: 27

28 September 2012, 11:35

Never did figure out how to remove the vestige from the database dump cleanly. I ended up writing an apache rewrite snippet to prune the offending code from called URLs. It incurs some technical debt, but it got my site back up and running for the users.

I added this to the bottom of my VirtualHost entry in my ssl.conf (httpd.conf would work too).

#Redirect Logic
    RewriteEngine On
# DMH 20120927 Move from oldhost to newhost left vestige 'mahara'
# in user link URLs. This strips it out.
    RewriteRule ^/mahara(.*) $1  [R=301] #drop 'mahara' from the URL

Hrynkiw

Kwantlen Polytechnic University

anonymous profile picture
Account deleted
Posts: 27

27 September 2012, 17:03

From the FAQ at the top of this forum:

I moved my Mahara installation to a new server/wwwroot, and now it doesn't work?!

Mahara stores the wwwroot for the site in the config table in the database. If you move your site, you must update this value too. An SQL command such as this will suffice:

UPDATE config SET value = '[new-wwwroot]' WHERE field = 'wwwroot'; 

-----------

Is this advice still valid? The value for wwwroot in our database bears no resemblance to any location on our server.

Mahara v1.4.0
RedHat
mysql

26 results