8000 linksf/docs/SETUP.md at ken/241 · kanugom/linksf · GitHub
[go: up one dir, main page]

Skip to content

Latest commit

 

History

History
128 lines (86 loc) · 5.67 KB

SETUP.md

File metadata and controls

128 lines (86 loc) · 5.67 KB

Setup

This guide explains how to install and setup Link-SF .

Prerequisites

Accounts

Link-SF is designed to be free to setup and free to run in perpetuity. Since hosting files is cheap, we've decided to go with building a static site. There's only one hard dependency as far as accounts go. Parse gives us data persistence, authentication for admins, and querying:

  • Parse

  • If you are on OS X 10.10 the Parse CLI tools may not be installed in their documented fashion. Alternatively the following may be copied into a text editor:

#!/bin/bash

TMP_FILE=/tmp/parse.tmp
if [ -e /tmp/parse.tmp ]; then
echo "Cleaning up from previous install failure"
rm -f /tmp/parse.tmp
fi
echo "Fetching latest version ..."
curl --progress-bar https://www.parse.com/downloads/cloud_code/parse -o /tmp/parse.tmp
if [ ! -d /usr/local/bin ]; then
echo "Making /usr/local/bin"
mkdir -p /usr/local/bin
fi
echo "Installing ..."
mv /tmp/parse.tmp /usr/local/bin/parse
chmod 755 /usr/local/bin/parse

Call the file install.sh (or be creative, whatevs) and execute:

$ bash install.sh

If you want to deploy the site publicly, S3 gives us free file hosting:

The following accounts are optional:

  • Mailgun: For capturing feedback entered in the feedback form as an email to your account.
  • Google Analytics: In addition to capturing useful things like user agent and traffic, we've added a couple custom events that help us keep track of how often a user connects to a service via external link (calling, visiting website, or getting directions).

Command line tools

To build the site (turn a file tree into a monolithic html, js, and css file), you'll need some command line tools installed from the sites below:

Development

Download the source (via git or .zip file).

Secrets

In the project root, you'll find a .env.example file. Make copies of that file called .env.dev and .env.prod in the same directory. They will probably look something like this:

PARSE_APP_NAME=xxxxxxx
PARSE_APP_ID=xxxxxxx
PARSE_JS_KEY=xxxxxxx
PARSE_MASTER_KEY=xxxxxxx
...

There are placeholders for development and production Parse tokens because we don't want any breakage during development to affect the production site. Create a new Parse app and call it 4DFD whatever you'd like. Replace the token placeholder values (xxxx) with those specific to your apps from Parse. The Mailgun and Google Analytics tokens can be ignored for now, if you'd like.

Keep your .env.dev and .env.prod files secret (out of source control, etc).

Building the site

From the project root (and with the command line tools outlined above installed):

  1. npm install
  2. grunt
  3. grunt parse:deploy:dev
  4. open build/index.html

If everything worked, you should have Link-SF open and running in your browser. You won't see any facilities listed in search, so you'll want to add one in the admin interface. First, create a new user in the Parse interface, then:

  1. open build/admin.html

Login using the credentials for the user you just added, then add a facility and service. From the Parse website, go to the Data Browser and set the permissions on the Facility and Service objects to have public GET and FIND permissions. You will be able to return to the enduser app and see the facility in search results.

Making changes to the site

Making changes to the site is pretty simple. grunt will build the site once, then you want to invoke grunt watch which will rebuild the site once the watched set of files change. The flow should be:

  1. grunt
  2. grunt watch
  3. edit a watched file, then save
  4. see the site rebuild in your terminal
  5. reload the page and see updated build

Updating fonts

We use http://fontello.com to generate an icon bundle. Here's a guide on how to add or change icons.

Testing

To test out the app, using an emulator is best in the absence of an actual device; this lets us simulate our target devices fairly well. Our target device is any 320x480 phone on Android 2.2.

To get an android emulator setup on Mac OS:

  1. Download the Android Developer Tools
  2. Open the adt-bundle-mac-... folder, and open Eclipse.app. You may have to control-click and select Open, since this is a .app directly downloaded from an untrusted source.
  3. Window -> Android SDK Manager
  4. In the list of packages, select Android 2.2 (API 8) and click Install packages....
  5. Window -> Android Virtual Device Manager
  6. Click New... and configure a new device with 320x480 resolution and targeting Android 2.2.
  7. Click Start...
  8. Open the Android browser and visit Link-SF.

Feedback form

If you'd like to use a feedback form:

  1. Setup a Mailgun account
  2. Add your Mailgun domain and API key to the .env.xxx files (see example .env.xxx file)
  3. Addany to/from email address you'd like to the .env.xxx files on the MAILGUN_TO_EMAIL_ADDRESS and MAILGUN_FROM_EMAIL_ADDRESS lines.
  4. Deploy your new changes, then check to see if your feedback form works as intended (you'll find the feedback link on the footer of the home and detail pages).
0