matters-server
matters-server copied to clipboard
Implementation of the Matters.Town API server
Matters Server
Development
Local
-
Install dependencies:
npm install --legacy-peer-deps -
Start Postgres, Redis, ElasticSearch, and IPFS daemon
-
Setup Environments:
cp .env.example .env -
Run all migrations:
npm run db:migrate -
Populate all seeds data if needed:
npm run db:seed -
Run
npm run start:dev, then go tohttp://localhost:4000/playgroundto GraphQL Playground. -
Run test cases:
npm run test -
Run db rollup process; use the same psql command line parameters if modified in .env; (hint
-d databaseand-U username, and-wto read saved password of psqlrc)(cd ./db; PSQL='psql -h localhost ... -w' bash -xe bin/refresh-lasts.sh )
Docker
cp .env.example .envdocker-compose -f docker/docker-compose.yml builddocker-compose -f docker/docker-compose.yml run app npm run db:rollbackdocker-compose -f docker/docker-compose.yml run app npm run db:migratedocker-compose -f docker/docker-compose.yml run app npm run db:seeddocker-compose -f docker/docker-compose.yml up- Run test cases:
docker-compose -f docker/docker-compose.yml run app npm run test - Init search indices:
docker-compose -f docker/docker-compose.yml run app npm run search:init
DB migrations and seeds
- Create a new migration:
npm run db:migration:make <migration-name> - Create a new seed file:
npm run db:seed:make <seeds-name>, seed files are run sequential so please pre-fix with order - Rollback a migration:
npm run db:rollback
Email Template
We use MJML to develop our SendGrid email template.
Please refer to the repo matters-email for details.
NOTE
AWS resources that we need to put in the same VPC
- Elastic Beanstalk
- RDS PostgreSQL
- ElastiCache Redis instances
- Pub/Sub
- Cache
- Queue
- ElasticSearch EC2 instances
- IPFS cluster EC2 instances