- Install Node.js (version >=10.0.0).
- Install
yarn
(version >=1.19.x):npm install yarn@latest -g
- Install Dependencies:
yarn install
- Set up local database: Local Database Setup
- Start the development server
- This is the list of all environment variables that are are pre-populated in
config/dev
, need to be exported prior to running the Teacher Moments server:PGUSER= PGPASSWORD= PGDATABASE= PGHOST= PGPORT= export AWS_PROFILE= export S3_BUCKET=
- If you are using Mac or Linux, export the required environment variables first:
export $(cat config/dev)
- And then run the dev server with:
yarn dev
- All at once:
...You should see your local site at http://localhost:3000.export $(cat config/dev); yarn dev
- This is the list of all environment variables that are are pre-populated in
yarn build
This project uses Eslint for linting. To catch syntax and style errors, run
yarn lint
-
Export
config/dev
export $(cat config/dev);
You may need to run:
export PGUSER=`whoami`;
-
Install PostgreSQL (unless already installed)
- Mac:
brew install postgres
- Ubuntu (based on https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04)
sudo apt-get update && sudo apt-get install postgresql postgresql-contrib
...Make sure that the Postgres version installed is 11.4.
- Mac:
-
Start PostgreSQL and make yourself a default database
- Mac:
brew services start postgresql createdb # creates a default database under your user name
- Linux
sudo su postgres createuser --interactive # enter your username and make yourself a super user su yourusername createdb # creates a default database under the current user
- Initialize local database
The following should be run with a
$PGUSER
&$PGPASSWORD
for a super user who can create databases and roles (see step 1):
yarn db-init-local
This command creates a database called teachermoments
and then sets up a role called tm and then creates all of the tables in teachermoments
. To do this manually, create a database called teachermoments
: $createdb teachermoments
, then create the role tm
with a password teachermoments
, then run db-migrate up
.
yarn create-migration <migration name>
# Example
yarn create-migration create-users-table
db-migrate tool will subsequently create a JS migration file that can be edited in the migrations
folder.
yarn db-migrate-up
This command can be customized with the following options: https://db-migrate.readthedocs.io/en/latest/Getting%20Started/usage/#running-migrations
Example:
Passing a count: npm run db-migrate-down -- -c 1
yarn db-migrate-down
This command can be customized with the following options https://db-migrate.readthedocs.io/en/latest/Getting%20Started/commands/#down
The AWS bucket used for development is called v2-moments-dev. For access, please contact the AWS administrator for TSL.
The app uses for credentials either
- default credential in your home directory at ~/.aws/credentials with this file format:
[default] #TSL
aws_access_key_id = <your access key id>
aws_secret_access_key = <your secret access key id>
- or set the environment variable AWS_PROFILE
export AWS_PROFILE=tsl