The Ultimate Boilerplate for Products.
Want to work side-by-side with an experienced, trusted mentor? Check out Clever Beagle.
NOTE: The following represents example README.md
content for your product. The information below should be customized for your product.
- Infrastructure
- Settings & Configuration
- Dependencies
- Commands
- Git & Branching
- Testing
- Releasing
The following explains how the production
and staging
environments for this app are managed and configured.
DNS for the app is configured and managed via DNSimple.
The database is hosted via Compose. A single deployment cleverbeagle
exists with a pup
database for the production
environment and a pup-staging
database for the staging
environment. Additionally, the "Oplog Access" add-on has been enabled to improve the performance of Meteor in production
.
The app is deployed to https://galaxy.meteor.com. It has two versions:
staging
which is accessed viahttps://pup-staging.cleverbeagle.com
and is used to test a release in a production environment before being deployed toproduction
.production
which is accessed viahttps://pup.cleverbeagle.com
and is the live, customer-facing server.
Deployment to these domains is controlled via NPM scripts defined in the package.json
file at the root of the project, npm run staging
and npm run production
.
SSL certificates are generated via the UI at https://galaxy.meteor.com/cleverbeagle. Each application's certificates are managed via the app's settings page:
SSL certificates are auto-generated by Galaxy using the Let's Encrypt Certificate Authority and shouldn't require any maintenance. If maintenance or edits are required, locate the "Domains & Encryption" section of the app's settings page (linked above) and click on the domain you'd like to manage.
Settings for the app are defined in three files at the root of the project:
settings-development.json
contains the settings specific to thedevelopment
environment (i.e., when running the app on your computer).settings-staging.json
contains the settings specific to thestaging
environmnet (i.e., when deploying the app topup-staging.cleverbeagle.com
).settings-production.json
contains the settings specific to theproduction
environment (i.e., when deploying the app topup.cleverbeagle.com
).
Each settings file should only be used in conjunction with the environment it's intended for. Further, each settings file's contents should be restricted to that specific environment (i.e., don't use an API key intended for the production
environment in development
and vice-versa—only break this rule when a given service's API key provisioning makes this prohibitive).
Settings files are automatically loaded for you as part of the NPM commands listed below. It's best to rely on these instead of doing it manually.
If you need to obtain an API key, password, or other secret information, you can find this in the Clever Beagle 1Password Vault. If you do not have access to this, send a direct message to @rglover in Slack or email him [email protected].
Dependencies for pup.cleverbeagle.com
are installed via NPM and Meteor's Atmosphere package system. Atmosphere dependencies are installed automatically on app startup. NPM dependencies can be installed with the following command before the first startup of the application:
meteor npm install
The following NPM commands can be used when working on the app.
$ npm run dev
Runs the app development server at https://localhost:3000
and loads the settings-development.json
file.
$ npm run staging
Deploys the app to the staging server at https://pup-staging.cleverbeagle.com
and loads the settings-staging.json
file.
$ npm run production
Deploys the app to the production server at https://pup.cleverbeagle.com
and loads the settings-production.json
file.
$ npm run test
Runs all Jest test suites in the app once and then quits.
$ npm run test-watch
Runs all Jest test suites in the app in watch mode and reruns whenever a test or file in the app changes.
$ npm run test-e2e
Runs all end-to-end tests using TestCafe once and then quits.
Read the "Managing branches in Git" tutorial in the Pup docs
There are two types of testing performed in relation to the app: manual and automated. Manual testing is any testing where you're manually clicking around the app yourself to test things out. Automated testing is any where you're relying on the automated test suites in the app to test things out.
When you start the app for the first time in development and staging mode, we create a set of test users to use when testing different permissions:
Email Address | Password | Roles | Notes |
---|---|---|---|
[email protected] | password | admin |
Full access to the application. |
[email protected] | password | user |
Access to user-only features. |
[email protected] | password | user |
Access to user-only features. |
[email protected] | password | user |
Access to user-only features. |
[email protected] | password | user |
Access to user-only features. |
[email protected] | password | user |
Access to user-only features. |
When you start the app for the first time, we create test data for all collections in the application. If you ever want to "start over" with fresh data in your development
environment, stop the app and in your terminal run:
meteor reset
Upon restarting the app, the databased will be reseeded with the default test data.
FAIR WARNING: This command will PERMANENTLY ERASE (😈) any data that you've added to the app manually. If you've added something that you will need/want after the reset, make sure to back it up first.
Read the "Writing and running automated tests" tutorial in the Pup docs
Releasing the app to both the staging
and production
environment should be performed primarily via continuous integration. This is configured via Circle CI and the .circleci/config.yml
file at the root of the app.
If an emergency deployment is required, the npm run staging
and npm run production
commands detailed in the "NPM Commands" section above can be utilized.
In order for a release to be pushed to either the staging
or production
environment via continuous integration, code must be pushed to:
- The
master
branch when releasing new code into production. - The
staging
branch when releasing new code to thestaging
server.
When code is pushed, the continuous integration service should pick this change up and automatically deploy per the rules in the .circleci/config.yml
file in the app.
When code has been tested and confirmed ready for production, it's important to tag the release in Git so that it's clear when and where certain code is introduced. In order to tag a release, it's recommended that the Git Extras library be used, specifically, the git release <Semantic Version Number>
command be utilized.
This pushed the code to the master
branch while also creating a tag locally and remotely, all simultaneously.
For more information on Semantic Versioning, visit the official documentation site.