DoughFlow, n
the state of flow while baking;
a cheesy cash-flow pun;
a cash flow web app.
DoughFlow is a client/server web application, built on EmberJS/Google Cloud Firebase respectively.
Back-end logic is implemented via Firebase Cloud Functions, using Firebase itself as a backing store for user data. This encapsulates business logic away from clients in a light-weight, server-less deployment.
The front-end is served as a static page from App Engine (TODO don't do this.... serve from GCS or something).
Hosted on Google App Engine, using its microservice framework:
Front-end implemented as service: default
The EmberJS files are served as static files (html & assets).
Back-end functions are implemented as Cloud Functions (NB: Firebase flavor, not "pure" Cloud; integration seems too alpha)
Back-end storage is straight-up Firebase
For convenience, let DOUGH_FLOW=/home/me/my_dough_flow_checkout
(e.g., add to shell rc, you need export
in zsh)
GAE project with GAE app (probably need billing set up)
Google Cloud SDK
https://cloud.google.com/sdk/downloads
NodeJS (I used 7.10 with nvm)
brew install nvm; nvm install v7.10
EmberJS (I used most recent as of 2017-05-26)
npm install -g [email protected]
Firebase
npm install -g firebase-tools; npm install -g firebase-server
Firebase project associated with your Google Cloud project
Firebase Server & SDK
Go to src/frontend
.
ember build
(nb: is that it? does that auto install npm stuff?)
Go to gae/
. Copy the build artifact for GAE deployment.
ln -s ../src/frontend/dist
See the front-end readme for more information.
When building/deploying to actual AppEngine:
ember build --environment=production
TODO
Edit /etc/hosts
(or similar) to map:
127.0.0.1 localhost.firebaseio.test
Firebase likes DB URLs being in a specific format, so you can't just use local ip or local host as the databaseURL
.
From the project root,
bin/start-doughflow-firebase# or for verbose debug: DEBUG=* bin/start-doughflow-firebase
(Note, you need to have DOUGH_FLOW
in your environment for this script to work.)
(NB: you can add
$DOUGH_FLOW/bin
to your shell's path for convenience)
This will start a local Firebase-like server loaded with data from test/firebase.json
, available on localhost.firebaseio.test
port 5555
. The Ember app is set up to use this hostname when environment=development
.
Start the local Firebase server (see above). Then, from src/frontend
,
ember server
This will start a live-reloading web server listening on port 4200. Go to http://localhost:4200 to see the app.
Not sure if we actually need this. We'll need cloud functions for delicate/sensitive server logic that clients shouldn't control. For now we don't have anything like that. But it was a pain to figure out. So here are some notes for posterity.
Set up some functions in src/firebase/functions
, use samples, like helloWorld, should be src/firebase/functions/index.js
.
Set up auth in src/firebase/functions/config.json
file, for local you probably don't need actual credentials.
Run the local function emulator:
From the src/firebase/functions
directory:
export CLOUD_RUNTIME_CONFIG=`pwd`/config.json && firebase serve --only functions
TODO