local testing on Windows for EXISTING moodle site on linux server

local testing on Windows for EXISTING moodle site on linux server

by Billy Zwiener -
Number of replies: 8

So Im in need to testing moodle files locally to verify backups and test upgrades etc. The problem I'm having is there doesnt seem to be a very easy way to accompish this that I can find. I have tried wamp server on Windows to no resolve on this working properly. The LIVE site is the standard linux machine server that most hosts use. The issue though is HOW do I create an environment like that locally to test effectively? Shouyld I build my own linux server for the house since windows seems to be giving such a hassle? I realize there are windows installers from moodle but thats not the entire solution is it? Because Im trying to take backup files and recreate them locally. So Im not looking for a clean windows install. Im looking to assemble the exisiting live site, locally on a different machine. Any guidance on how to piece together these things that isn't a tutorial on a fresh install would be helpful. Clearly, people out there test their sites locally so... how? Whats the easiest solution for a windows machine and if thats simply not possible I don't mind throwing together a linux box JUST for the local host but it seems like overkill. Granted if it helps me learn then so be it. Please advise. Thanks!

Average of ratings: -
In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by Ken Task -
Picture of Particularly helpful Moodlers

First ... am certain you will get differing opinions and suggestions ... things like 'stick with what you know', etc.

The key for this response was your reasoning ... server in production is 'linux' (but it would be a good idea to find out what distro) and your thought on environment (locally) being as close to production server as possible.

So ... if production server was Linux Ubuntu (LTS) with native php, mysql, apache (that's another item for sharing ... what does production server actually run?... etc., etc..

Here's my 2 cents:

VirtualBox https://www.virtualbox.org/

Install of Linux OS same flavor as production

Example Ubuntu 16.04 but could be CentOS 7. https://www.google.com/search?q=installing+ubuntu+16.04+on+virtualbox

Backup your production site ... db dump, tar ball of code, tar ball of moodledata, and restore that to your Ubuntu 16.04 instance in VB.

You will to contend with FQDN ... but one can cheat with a host file edit (harder to do on Windows but from what I have read doable).

After you get VB, Ubuntu (with apache/mysql/php whatever) running and right before you restore your Moodle by FQDN, edit the host file of your PC and give the private IP address on your home network (192.168.0.x) a mapping to your servers FQDN.

You are fooling your PC into thinking mygreat.moodle.org is on your local laptop in VB/Ubuntu.

No change to config.php file needed then.

When done messing with the VB instance and you want to view the production server again, just comment out the line you added to the host file that pointed to your private IP.

Have used the above 'trick' while presenting at a TCEA Moot (in Texas) and the venue didn't have a robust wireless network/coverage for attendees and presenters ... attendees couldn't get to internet without tethering their smart phones - whose connections were 3G at the time .... kinda like the 'world wide wait' of dialup days on 3600 baud.

I was showing them http://somerealserver.org/moodle/ - a backup restored to laptop running virtual box and CentOS 5 at the time.

There's my 2 'sense' (nope, spelled it right! smile)

'spirit of sharing', Ken



Average of ratings: Useful (2)
In reply to Ken Task

Re: local testing on Windows for EXISTING moodle site on linux server

by Billy Zwiener -

Ken, as always greatly helpful answer. Might I add that during the course of the day I managed to get WAMP server to work and am ALMOST there if it wasnt for this redirect that's occuring from my guess the moodle index? I'm not quite sure but if I could figure out why the redirect happens all my configurations could actually work with WAMP. If you ro anyone could glance at this screencast I just made and shed any insight on what's happening it would be massively appreciated. Thank you.



In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by Ken Task -
Picture of Particularly helpful Moodlers

Well, that's good news.   But, the part about assistance with WAMP ... and 'you or anyone' ... will have to be 'anyone else' as I don't do Windows ... not since the early 1990's. smile

Comments to follow on your reponse concerning James suggestion ... which, I think, does come closer to your original question.

'spirit of sharing', Ken

In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by James Steerpike -
I don't test sites locally even though I have a Linux box right beside me. The cost of a VPS is so low now it is just easier to fire one up. My latest is $10 a year with full root access and 2 G of Ram and I can restore my Moodle course ( 350  users, approx 15MB) on to it. You are obviously familiar with Nix and with a server like that, you can play away with course or database backups.
Bonus - I know I can switch sites for my users if I have to. Check out this deal.
A clean and easy install ( though I had to use PHP 7.0) when following the Debian Moodle Install Instructions.
Average of ratings: Useful (2)
In reply to James Steerpike

Re: local testing on Windows for EXISTING moodle site on linux server

by Billy Zwiener -

James I appreciate your post. One thing thats been a hurdle with online testing is my moodle_data folder is 20 Gigs. Database is 2 Gigs. Its a challenge to move things around... takes days via ftp and always is problematic with phpMyadmin. If I was working with a lighter course I could see this method being a great solution but in my circumstance testing a large course I'm not so sure.

In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I ran into the same problem at one time, needing to move a large amount of Moodle data/datbase, from one server to another. After three failures, it finally dawned on me that I could actually just back up the parts of a course that I really "need right now" and restore them to the new server. Eventually, over a few days time, I had everything transferred.

In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by Ken Task -
Picture of Particularly helpful Moodlers

+1 to James suggestion.

Much depends upon how you are hosted.   The info provided about size of Moodle DB and moodledata and methods you have used (ftp) indicates to me, you are not hosted on a VPS ... if you are, you've not explored expansion of the VPS setup ... which one can do.

I admin a few servers on Rackspace for another entity.  More than one of their servers grew larger - same things - DB and moodledata.   But due to the fact the RS boxens are what others would term 'VPS's', the servers could be expanded to handle increased usage ... at present, the need for 'space'.

In RS, one can setup an additional storage device (volume) of desired size ... example below is VMWare but RS is really essentially the same.

Filesystem            1K-blocks       Used Available Use% Mounted on
/dev/mapper/vg_moodle4-lv_root
                       51475068   13964724  34888904  29% /

/ is the root and if moodledata were to be on that device it would have been in /var/www/moodledata

But there isn't enough space ...  in the virtualized server config, a volume was added thus

/dev/mapper/vg_moodle4-lv_home
                     2053461808 1142864368 806280924  59% /home

In this case it was given /home ... but could have been /data and it actually houses the moodledata directory.

In humanly understandable values:

/dev/mapper/vg_moodle4-lv_home
                      2.0T  1.1T  769G  59% /home

Translation: /home is 2 TeraBytes in size it's using 1.1TB and has 769G free space left.

So where you host ... is it a VPS?   And does hosting provider allow customers to 'attach a device' to VPS's of whatever size you can afford (it ain't free)?

Advantage in setup like this  .... same environment ... cloning the production site to another instance of Moodle would be tight ... but doable.  *** NO FTP required *** ... if VPS and space available one could 'clone' moodledata to moodle2data for the dev site with a cp -rp command ... those files never leave the server and are just copied to the moodle2data location.   There would also be a little crunch in getting the dev DB installed at first ... but one could cull some of the moodle tables not needed for a dev site ... like 'log' on mysqldump of production database and thus the resulting SQL file smaller ... thus, if follows, the DB for the dev server also smaller.

Since dev site is really only for your purposes, users accounts could be removed ... courses reset ... which removes student submissions etc.  You have, basically, your own 'playground'.

Expansion of space could be cheaper and a lot less hassle than leasing yet another server that would have to be fixed/patched, etc. ... ie, administered.

Again ... 2 cents.

'spirit of sharing', Ken







In reply to Billy Zwiener

Re: local testing on Windows for EXISTING moodle site on linux server

by James Steerpike -

The  VPS is always up - perhaps rsync and let it plug away even for 20 Gb or more?  Most deals are for a terabyte bandwidth these days.