-
Notifications
You must be signed in to change notification settings - Fork 25
Setup
Michał Plebański edited this page May 14, 2021
·
4 revisions
-
Install Node.js 12.x and Yarn package manager:
brew install node@12. yarn
-
Install redis by following the instructions here.
-
Install Postgres 12 DB:
brew install postgresql@12
and create a new database called
bloom
.psql -c 'CREATE DATABASE bloom;`
-
Clone this repository:
git clone https://github.com/bloom-housing/bloom.git
-
Install project dependencies
cd backend/core && yarn install
1 . Define environment variables for local based on a provided template:
# backend/core workdir
cp .env.template .env
and edit .env
according to your needs.
Name | Description | Default | Type |
---|---|---|---|
PORT | Defines port number the server will listen to for incoming connections. | 3100 | number |
NODE_ENV | Controls build optimization and enables some additional logging when set to development
|
development | "development" | "production" |
DATABASE_URL | Database connection string | postgres://localhost/bloom | string |
REDIS_TLS_URL | Secure Redis connection string | string | |
REDIS_URL | TCP Redis connection string | redis://127.0.0.1:6379/0 | |
REDIS_USE_TLS | Flag controlling the use of TLS or unsecure transport for Redis | 0 | 0 | 1 |
THROTTLE_TTL | Rate limit TTL in seconds (currently used only for application submission endpoint) | 60 | number |
THROTTLE_LIMIT | Max number of operations in given time window THROTTLE_TTL after which HTTP 429 Too Many Requests will be returned by the server | 2 | number |
EMAIL_API_KEY | Sendgrid API key (see sendgrid docs for creating API keys | SOME-LONG-SECRET-KEY | string |
EMAIL_FROM_ADDRESS | Controls "from" field of all the emails sent by the process | 'Bloom Dev Housing Portal bloom-no-reply@exygy.dev' | string |
APP_SECRET | Secret used for signing JWT tokens (generate it with e.g. openssl rand -hex 48 ) |
SOME-LONG-SECRET-KEY | string |
- Migrate the DB to latest schema:
# backend/core workdir yarn run db:migration:run
- (Optional) Seed the database
This step will create example listings,
yarn db:migration:seed
admin@example.com:abcdef
admin user account, leasing agents user accounts etc.
Development:
yarn run dev
Production:
yarn run build && yarn run start
Go to localhost:3100/docs
page and see if you can e.g. log in using /auth/login
endpoint using following payload:
{
"email": "admin@example.com",
"password": "abcdef"
}
To play with other endpoints that require authentication copy paste the access token from the response to above query into the "Authorize" popup at the top of the page.