Local site configuration notes.
-
Optional (convenience) development tools
I use the dotenv node module for keeping up with the site environments.
Available environment variables:
NODE_DB_HOST
NODE_DB_PORT
NODE_DB_PASS
SESSION_SECRET
NODE_ENV
PORT
SENDGRID_USERNAME
SENDGRID_PASSWORD
You can create .env files specific to the environment, i.e.: .env.development, .env.testing, etc. The defaults can be found in .env
.
See also: app.js, Heroku build config vars
.env.keys
- Buy a MacBook.
- Refer to the local site setup section for Mac OS X.
- Profit!
See the local site setup section for Mac OS X.
Install software dependencies via Homebrew:
brew install -vd git
brew install -vd node
brew install -vd redis
# Be sure to read the caveats here to finish setup
brew install -vd pow
gem install sass
npm install -g grunt-cli
git clone git@github.com:i8degrees/averylawfirm.git averylawfirm.git
cd averylawfirm.git/
# Install deps required for running site
npm install
redis-server /usr/local/etc/redis.conf &
# Run a local web server in the background on a local port number that is free.
PORT=<LOCAL_PORT_NUMBER> NODE_ENV=development npm start &
You should now be able to access the local site at the http://localhost:<LOCAL_PORT_NUMBER> when everything is setup properly.
This optional package restarts the web server anytime the configuration files -- i.e.: app.js, routes/index.js -- are modified.
Simply swap out the use of npm start
with:
# averylawfirm.git
NODE_ENV=development nodemon app.js &
Create a symbolic link from the project's root directory to your user's .pow directory:
ln -s ~/Projects/averylawfirm ~/.pow/averylawfirm
You should now be able to access the local site at the following URL if everything was setup properly (NOTE: Replace the private LAN address [1] according to your site network):
- See the project's config.ru in the project root directory.
-
Defaults to the listening port 5000. -
All site pages generated from Jade templates:
- Exclude LiveReload script.
Minified Modernizr script is used.
-
Error page:
- Error status number is not shown.
-
Contact page:
- Email will be sent out upon successful form submission.
redis-server /usr/local/etc/redis.conf &
NODE_ENV=testing nodemon app.js &
NOTE: The database connection environment variables NODE_DB_HOST
, NODE_DB_PORT
and NODE_DB_PASS
should be set to the Redis URL used by Heroku deployments.
Note: You should ensure that you include the space as the first character of the command when running from the shell (assuming BASH), so that your password is not accidentally committed to your BASH history file.
-
Defaults to the listening port 5000. -
All site pages generated from Jade templates:
- Exclude LiveReload script.
Minified Modernizr script is used.
-
Error page:
- Error status number is not shown.
- Error stack traces are disabled.
-
Contact page:
- Email will be sent out upon successful form submission.
- No dumping of form submission input on successful form submission.
redis-server /usr/local/etc/redis.conf &
NODE_ENV=production nodemon app.js &
NOTE: The database connection environment variables NODE_DB_HOST
, NODE_DB_PORT
and NODE_DB_PASS
should be set to the Redis URL used by Heroku deployments.
Note: You should ensure that you include the space as the first character of the command when running from the shell (assuming BASH), so that your password is not accidentally committed to your BASH history file.
averylawfirm-staging.herokuapp.com
# Local 'dev' branch to Heroku staging app's 'master' branch
git push staging dev:master
# Local 'master' branch to Heroku staging app's 'master' branch
git push staging master
heroku logs --app averylawfirm-staging
# Local 'dev' branch to Heroku app's 'master' branch
git push heroku dev:master
# Local 'master' branch to Heroku app's 'master' branch
git push heroku master
heroku logs --app averylawfirm
The format in which logs are output must follow a particular style in order to work automatically with an automated notification system (powered by LogEntries).
- The following logging output formats have been configured for email alert notifications:
app [ERROR]: ...message...
app [CRITICAL]: ...message...
app [WARNING]: ...message...
app [DEBUG]: ...message...
NOTE: Log output formatting that begins with app-subname
where subname is any alphanumeric combination is also matched for alert notifications.