So you just finished installing the Webmaker suite of apps on your local machine and you’ve suddenly been overcome with the desire to hack away at the web on your tablet. Or maybe you’re a developer and you want to help Mozilla improve Webmaker on mobile platforms (good on you!). In either case, you’re going to have to do a bit of configuring to get your machine to serve pages to your mobile device. We’re going to do this by exposing localhost to the internet such that any device connected to the internet can view your pages. To accomplish this we’ll use Pagekite, a service that gives local servers public DNS names. It’s free for a month after which it costs $3/month BUT if you’re a developer of open source software they’ll give you a free account! You’ll need Python to run the script so make sure you have it installed before downloading Pagekite. The quickstart guide will get you set up with an account so do that before continuing.
Now we need to know what ports the services/apps are running on so we can create pagekite pages for them. Currently, the ports are:
- http://localhost:3000 – login.webmaker.org
- http://localhost:3500 – thimble.webmaker.org
- http://localhost:5000 – makeapi
- http://localhost:5050 – htmlsanitizer.org
- http://localhost:7777 – webmaker.org
- http://localhost:8888 – popcorn.webmaker.org
- http://localhost:12416 – goggles.webmaker.org
For this example I’ll briefly explain how to expose Thimble. If you open up the .env file in your thimble.webmaker.org directory, you’ll notice a block of code like this:
# hostname for this server according to your browser # if they don't match then Persona will not work export HOSTNAME="http://localhost:3500" # Persona single sign-on host export AUDIENCE="http://localhost:7777" # User bar is hosted at: export USERBAR="http://localhost:3000" # where can we access the webmaker loginAPI? export LOGINAPI="http://testuser:password@localhost:3000" # make API url export MAKE_ENDPOINT="http://localhost:5000"
You’re going to want to replace all instances of http://localhost:#### with a pagekite page that you set up. My main page is called stanica, so I first got thimble up there by running
python pagekite.py 3500 stanica.pagekite.me
inside a terminal. This exposes http://localhost:3500 to the internet via http://stanica.pagekite.me Now we can make sub-domains for each of the other apps. Note that each command needs to be run in its own terminal window.
python pagekite.py 3000 login.stanica.pagekite.me python pagekite.py 5000 makeapi.stanica.pagekite.me python pagekite.py 7777 webmaker.stanica.pagekite.me
Now we simply go back to the .env file in the thimble.webmaker.org directory and replace all the localhost instances with our pagekite kites.
# hostname for this server according to your browser # if they don't match then Persona will not work export HOSTNAME="http://stanica.pagekite.me" # Persona single sign-on host export AUDIENCE="http://webmaker.stanica.pagekite.me" # User bar is hosted at: export USERBAR="http://login.stanica.pagekite.me" # where can we access the webmaker loginAPI? export LOGINAPI="http://testuser:password@login.stanica.pagekite.me" # make API url export MAKE_ENDPOINT="http://makeapi.stanica.pagekite.me"
The final step is to go to each of the folders for webmaker, makeapi, etc and make the same changes in their respective .env files.
Good luck!
