Skip to content

Instantly share code, notes, and snippets.

@lirbank
Last active February 21, 2018 13:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lirbank/4d3568094d4266ee9984 to your computer and use it in GitHub Desktop.
Save lirbank/4d3568094d4266ee9984 to your computer and use it in GitHub Desktop.
Run Meteor locally with a real hostname instead of localhost
#!/bin/sh
DOMAIN=airlab.io
PORT=3000
# Find configured IPv4 addresses, skip localhost
IP=`ifconfig |grep -oE "(inet )([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)"|awk '{print $2}' | grep -v "127.0.0.1"`
echo "Your IP: $IP"
# Replace periods with hyphens
HOSTNAME=`echo $IP | tr '.' '-'`
# Append the domain name
HOSTNAME="${HOSTNAME}.${DOMAIN}"
#HOSTNAME="10-0-10-15.${DOMAIN}"
echo "Hostname: $HOSTNAME"
# Check that there is a DNS record for the private IP
printf "Checking DNS: "
if ! test `dig $HOSTNAME +short`; then
echo "ERROR! DNS is not configured for your current IP address (${IP}), shoot an email to mikael@airlab.io and he will fix it."
exit
else
echo "OK"
fi
echo "Configure Facebook:"
echo "1. Go here https://developers.facebook.com/apps/"
echo "2. Select/create a FB app → click Test Apps → select/create a dev app → click Settings"
echo "3. Change the Site URL to \"http://${HOSTNAME}:${PORT}/\""
# Start Meteor
ROOT_URL=http://${HOSTNAME}:${PORT}/ meteor run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment