Awesome
aufond
A résumé for the modern age
Mission
"An elegant and straightforward way to exhibit your lifelong achievements." — Visit the app homepage for more product info.
Structure
Since Meteor.js provides tight conventions for structuring your app, most of the app is structured the way you'd expect if from a Meteor project.
There are two abstractions that stand out the most:
- ReactiveTemplate - Widget-like component that encapsulates the logic related to a template, making use of the reactive programming concept and the powerful Deps API
- MeteorModel - Agnostic model wrapper for the Meteor.Collections with a common ORM interface
Also notable is that the entire app is written in CoffeeScript.
Entry point
The app router is built on top of Backbone.Router. It is intertwined with a global controller, which manages the changing of one controller (page layout) to another. The entire client app starts when Router.start()
is called, when this global controller is initialized, which happens because of its placement in the index.html layout.
Installation
Requirements
- node.js - JS platform on top of which Meteor.js is built
- Meteor.js - The framework at the heart of the application
- PhantomJS - Used to serve crawlable pages through the Spiderable package and to render static .pdf exports
Running locally
aufond is as easy to start as any other Meteor app. Just run meteor
from the repo root.
Settings
A JSON settings file can be loaded using the --settings
option. E.g. meteor --settings settings.json
The settings file is not versioned needs to be created, using the settings.example.json scheleton.
Running in the cloud
Run this on a linux machine, in production environment. — aufond.me works on Debian 7 (Wheezy)
# Define the path where the project will be situated
echo "export AUFOND_PATH='/var/www/aufond'" >> ~/.bashrc && source ~/.bashrc
# $AUFOND_PATH will always be defined on this machine, for this user
mkdir -p $AUFOND_PATH && cd $AUFOND_PATH
# Ensure Git is installed and fetch the aufond repo for the install script
aptitude install -y git && git clone https://github.com/skidding/aufond.git .
# Setup project
script/install.sh
Bundling and starting in production
# Create Meteor bundle
script/bundle.sh
# Start bundled Meteor app on localhost, port 80. If a process is already
# running on this port, its PID will be displayed instead; this is useful for
# killing that process and restarting the app
script/start.sh
# Start app on a specific port
script/start.sh -p 3000
# Start app for a specific hostname. The hostname is used as the value for the
# ROOT_URL environment variable of Meteor. It's used by the framework to
# generate internal URLs
script/start.sh -h aufond.me
# Specify the Mongo connection (the start script defaults to a guest db hosted
# at MongoHQ)
script/start.sh -m mongodb://guest:aufond1234@paulo.mongohq.com:10016/aufond_guest
Don't forget to replicate the settings.json file you're using locally. It will be picked up and included automatically by the start.sh script, from the root project folder.
Importing data
There are a few dumps included the project if you want to start off with some data after installing the app. Considering that the local Mongo connection used by Meteor defaults to running on the 3002 port, here is a command line example for quickly importing a user with timeline entries:
mongoimport -h 127.0.0.1:3002 -d meteor -c users --file private/mongo-dump/sivers.user.json
mongoimport -h 127.0.0.1:3002 -d meteor -c entries --file private/mongo-dump/sivers.entries.json
You can now check out localhost:3000/sivers to display the imported data beautifully.
Exporting
As a reference, here's how the exporting is done using the opposite Mongo utility, mongoexport:
mongoexport -h paulo.mongohq.com:10016 -u guest -p aufond1234 -d aufond_guest -c users -q '{username: "sivers"}' -o sivers.user.json
mongoexport -h paulo.mongohq.com:10016 -u guest -p aufond1234 -d aufond_guest -c entries -q '{createdBy: "XDX52YC3jBPmbsiZS"}' -o sivers.entries.json
Root user
A root user can list all the other users with extended information and can overall do more actions with the help of a few extra tabs in the admin section. Making a regular user root is rather manual and requires direct Mongo access. E.g.
db.users.update({username:'test'}, {$set: {isRoot: true}})
PhantomJS dry run
aufond uses PhantomJS to generate static exports of your timeline, but you can play with or debug the script manually, from the command line. Note that it has a few particularities relevant to the timeline layout.
phantomjs server/.phantomjs/export-pdf.js http://google.com google.pdf