How to use ngrok with moodle

How to use ngrok with moodle

by Cosme Fulanito -
Number of replies: 6

Hi, i'm using version 3.5.2+ of moodle and i'm wondering if it is possible to use this service. So far I can't get it to work.


I'm using bitnami LAMP on Ubuntu 18 and when I run ./ngrok http 8081 I can access my bitnami home page but when I add try to access ngrok.link.provided/moodle I'm getting a

HTTP Requests                                                                                                                      
-------------                                                                                                                      
                                                                                                                                   
GET /moodle                    301 Moved Permanently 

Response.

On the main config.php of moodle I have tried with my normal localhost address and with the URL that ngrok provides on the $CFG->wwwroot  variable but neither seems to work.


Does any of you have successfully use ngrok with moodle?


Thanks.


Average of ratings: -
In reply to Cosme Fulanito

Re: How to use ngrok with moodle

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Never heard of it. What does it do?

In reply to Howard Miller

Re: How to use ngrok with moodle

by Cosme Fulanito -

"ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels.

What it's good for

  • Demoing web sites without deploying
  • Building webhook consumers on your dev machine
  • Testing mobile apps connected to your locally running backend
  • Stable addresses for your connected devices that are deployed in the field
  • Running personal cloud services from your home"
That info comes from the official web site https://ngrok.com/

Basically what I try to achieve is to allow access to the moodle curse I'm working on from Internet to my localhost, in order to allow someone outside my network to review it. So point number one:

* Demoing web sites without deploying

So if anyone knows a way of doing this please share it!



In reply to Cosme Fulanito

Re: How to use ngrok with moodle

by Ken Task -
Picture of Particularly helpful Moodlers

There is another way ... and have used it to upgrade/clone sites.

Hinges on who is accessing and if they  can edit their host file.

On a public facing/existing moodle server, setup virtual apaches ... the first is existing site.  The second is something like dev.toplevel.domain.

In the host file of the worktation, add a line for the public IP address of existing functioning by FQDN server that points to the dev.toplevel.domain.

dev.toplevel.domain doesn't exist in DNS ... anywhere ... not public, not internal ... the mapping only exist in the host file.

No need to restart anything as all workstations/servers on the internet actually check the host file references first before using DNS ... internal. or externals.

More concrete example (server no longer online, however).

host file of workstation:

207.243.6.94 dev.tcea.org dev

Apache server has that host defined in virtual host.

When workstation user goes to https://dev.tcea.org/  They see the under-development moodle.

Sorta like hiding in plain site ... and nothing special needs be done.  Certificate for that virtual dev.tcea.org site would be locally generated and not a valid cert from a CA ... Firefox user has to allow the exception.   But all things work. smile

'spirit of sharing', Ken



In reply to Ken Task

Re: How to use ngrok with moodle

by Cosme Fulanito -

Thanks for your reply.

In order for that to work, I will need to upload my current database and moodle content to the Apache server right?


In reply to Cosme Fulanito

Re: How to use ngrok with moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Yes ... example ... typical centos 6/7 server 1st/default apache virtual doc root is /var/www/html/

In DNS, real.fqdn points to real.fqdn ... which is the instance @ /var/www/html/

With virtual apache config, another instance of a moodle could be /home/dev/html/ ,,, this is the one using dev.fqdn and the mapping IP -> dev.fqdn in the host file.

'spirit of sharing', Ken