Skip to content

Testing on Mobile

Mike Kasprzak edited this page Jun 18, 2016 · 20 revisions

Step 1.

Open up Vagrantfile in your DairyBox root folder.

Uncomment this line (i.e. remove the #).

#	config.vm.network "public_network"

Shut down and start the VM.

vagrant halt
vagrant up

When prompted, select the 1st interface (wlan0 ?).

Now use the info script to check what the IP address of the public interface is.

./info.sh

This is typically Eth2.

You can punch the IP address in to either your local browser or the browser of your mobile device to see the website. Do note, it may take some time before it resolves, so be patient.

More Details: https://github.com/ludumdare/dairybox#public-server


In some cases, it may be possible to use a real domain name from your remote devices.

ASUS "ASUSWRT" Router

If you have a current ASUS brand router, then you may have an ASUSWRT based firmware installed. If that's the case, you can temporarily modify the /etc/hosts file of the router to include some fake domain names that we will use for testing.

Go to Administration->System and enable Telnet access.

Use either vi or cat > to create a shell script /etc/set-server.sh

#!/bin/sh

if [[ $# -eq 0 ]] ; then
    echo "Usage: $0 ip-address-of-server"
    exit 0
fi

# Copy original /etc/hosts, but only if the copy doesn't exist
[ ! -e "/etc/hosts.original" ] && cp /etc/hosts /etc/hosts.original

# Overwrite Hosts file
cp /etc/hosts.original /etc/hosts

# Our Additions
echo "$1 jammer.dev">>/etc/hosts
echo "$1 bio.jammer.dev">>/etc/hosts
echo "$1 host.jammer.dev">>/etc/hosts
echo "$1 api.jammer.dev">>/etc/hosts
echo "$1 auth.jammer.dev">>/etc/hosts
echo "$1 push.jammer.dev">>/etc/hosts
echo "$1 static.jam.dev">>/etc/hosts
echo "$1 status.ludumdare.dev">>/etc/hosts

echo "$1 ludumdare.dev">>/etc/hosts
echo "$1 api.ludumdare.dev">>/etc/hosts
echo "$1 auth.ludumdare.dev">>/etc/hosts
echo "$1 push.ludumdare.dev">>/etc/hosts
echo "$1 theme.ludumdare.dev">>/etc/hosts

# Restart DNSMasq (to reload hosts file)
killall -HUP dnsmasq

Pass the IP address you want to associate the jammer.dev and ludumdare.dev domains to the set-server.sh script.

TODO: Figure out if there's something that should be run as the asusware/.asusrouter script on a USB key to make this nicer. Some sort of RPC?

Alternatively, set up a custom script in the repos that Telnet's in to the router (given the router IP, username, password, and desired server IP) and runs this script or these commands. Then set it up as a startup script for the Vagrant box, so any time a vagrant box with a public interface goes up, it runs this script (assuming you have an ASUS router, and configure a config file for it).

References

DD-WRT Router

  • dnsmasq
You can’t perform that action at this time.