This project uses node v12.4.0. Using nvm and refer to .nvmrc for more info.
We use a .env file to store environment variables. Make sure this is created in root and variables are properly filled out. Use .env.config as a template
# copy .env.config and make any necessary changes
$ mv .env.config .envEnsure mongodb is setup and installed
$ brew tap mongodb/brew
$ brew install mongodb-community
$ brew services start mongodb-community
$ mongo
$ > show dbs$ npm install
Seed database and check there is 79 posts
$ npm run seed
$ mongo
$> use collectivebrain
$> db.posts.count() # should be 79All migrations are in sample_data/XXX_name_of_migration so run them in order. like below.
$ node sample_data/001_convertToSubCategories.js
$ node sample_data/002_convertImagesToFiles.js
$ # etcUsing Jest, run tests via. All should pass.
$ npm test$ npm run startDev # nodemon server
$ npm run buildWatch # webpack / react build
$ open http://localhost:3000Should be one user (admin) added with following
- Username [email specified in .env]
- password [password specified in .env]
Various 3rd party services are used. Refer to shared accounts doc for credentials
- Sendgrid (email api)
- Heroku (hosting)
- ImprovMX (email forwarding)
- godaddy (domains)
- cloudinary (file uploads)
- Mongo Atlas (DB)
- make sure .env
SENDGRID_API_KEYis set and authorized sender is set toadmin@collectivehomeoffice.comin sendgrid dashboard
- make sure .env
CLOUDINARY_URLis set. Access web portal via heroku
- make sure .env
MONGODB_URIis set on heroku to mongo atlas uri (local should be used for developement).
Currently heroku is being used for deployment. Make sure you have access to project like any other heroku project.
$ heroku create # etc see heroku docs
Mimic .env file on heroku's config variables. Use .env.config as a template, although you should already have .env on your local machine.
# to list heroku config vars
$ heroku config
# setting
$ heroku config:set FOO=BARRWebGL is used for rendering some images #TODO
# TDOSimilar to local shell into the machine and run any outstanding migration scripts to update mongo. Only run each one as they are needed.
# shell in
$ heroku ps:exec
$> node sample_data/001_convertToSubCategories.js
$> node sample_data/002_convertImagesToFiles.js
$> #etc$> heroku logs --tail$> git push heroku master