Page MenuHomePhabricator

[mwcli dev] investigate and maybe build in support for ngrok or localtunnel
Open, LowestPublic

Description

https://www.mediawiki.org/wiki/MediaWiki-Docker/Configuration_recipes/Ngrok

Though it would be COOL if this were done via a tool on toolforge instead! :)

From T339857:
I want to demo a local Wikibase change to UX in a way that they can click around in the UI. Therefore, I need my local repo dev wiki to be reachable via the internet.

I tried using ngrok. I circumvented the first error (dial tcp: lookup ... no such host) by adjusting my local /etc/hosts file with what mw docker hosts add provides. However, now I always get a 503 error from nginx. Also, nginx (at least from the jwilder/nginx-proxy container) seems to not provide any errors in its error.log, though I can see the 503 request in the access log. As far as I can tell, the request does not reach Apache/MediaWiki PHP.

Any guidance on how to further debug this local ngrok connection, or suggestions for achieving the overarching goal, would be welcome

Event Timeline

Addshore moved this task from Inbox to Backlog on the mwcli board.
Addshore lowered the priority of this task from Low to Lowest.Oct 16 2021, 11:03 AM

I started looking at local tunnel options using https://theboroer.github.io/localtunnel-www/ which is free, but it appears to currently be broken

Code at
https://gitlab.wikimedia.org/repos/releng/cli/-/commit/67ca722dfbfa4be80be524044d7a4c05014f53d3

I don't like ngrok because of the requirement to signup, so still think a tool for this might be the best perhaps...

Addshore renamed this task from [mwcli dev] investigate and maybe build in support for ngrok to [mwcli dev] investigate and maybe build in support for ngrok or localtunnel.Aug 24 2022, 9:53 AM

I just looked at a one off hack solution to try and make this work for @noarave using the follwing

docker exec -it mwcli-mwdd-default_mediawiki-web_1 bash


curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="/var/www/html/w/cache/docker/nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

nvm install 16

npm install -g localtunnel
lt --port 8080

This basically works but you get to the point where either

  1. You need to force unknown wikis to be "default", but mediawiki then redirects you to the *.localhost domain
  2. You need to install a wiki using the prefix given by localtunnel, such as fruity-insects-rule-95-126-122-113.loca.lt, however in update.php the -s get read as DB name prefixes or something? and mediawiki doesnt successfulyl install

SO this would need some work to work, but the good news is localtunnel seems to work now.
It also could make more sense

Anyway, more work is needed here...

I tried the config snippet that is linked in the description, and it doesn't work for me. Also, it is confusing to me. The prose says "Whatever URL is shown to you needs to be set in your LocalSettings.php.", but it doesn't include what it needs to be set to. Also, the code snippet provided does not include any <paste ngrok url here> or similar.

If / when I implement this
Of if someone else wants to, I'd probably go for https://developers.cloudflare.com/api/#cloudflare-tunnel-create-cloudflare-tunnel at this stage.

I would implement a generic cloudflare command that includes adding the tunneling option, then you could simply pass in the local dev env port (or anything else you want to proxy)