-
Notifications
You must be signed in to change notification settings - Fork 1
Getting started
This guide helps you get started running and interacting with a local development server and tests.
See also Bloom's setup wiki.
NOTE: At the time of editing, this project requires Node 14.
- Make sure you have node installed with
npm -v - Install node if you don't have it. You may want to use
nvmif you need access to multiple versions. Here is a super helpful link on installing node withoutsudo.
- Check if you have yarn installed with
yarn -v - If you don't have yarn, install with
npm install --global yarn
-
Install git on your machine.
-
Clone the repository.
Run this in your terminal (and/or refer to this guide):
git clone git@github.com:CityOfDetroit/bloom.git -
Configure the
upstreamrepo:git remote add upstream https://github.com/bloom-housing/bloom.git -
In
backend/core, copy.env.templateinto.env -
Copy
sites/public/.env.templateandsites/partners/.env.templateto their respective.envfiles. -
Run
yarn install:allfrom the main directory, which will runyarn installat both the top level and inbackend/core.
For managing redis and postgres, you need to decide whether to:
- On Linux, you can follow these steps.
- If you are hoping to rely on your username with
sudo -u postgres createuser your_username -s, you'll need to edit yourpg_hba.conftotrustlocal connections to the db. - Otherwise, you can create a user WITH a password (like bloom-dev, password bloom1) and put that in your
.env:sudo -u postgres psql CREATE USER lemmy WITH PASSWORD 'myPassword'; - Restart the service afterward:
sudo service postgresql restart
- Verify you have a postgres server running (this should happen automatically in the last step) with
psql postgres. This should launch you into apsqlshell, which you can exit with\quit. - Create a database with a name matching your username:
$ psql postgress
postgres=# CREATE DATABASE your_username_here;
postgres=# \quit
- Install Redis
- Open a terminal and start a redis server with
redis-server. - To check that the server is running, open another terminal and run
redis-cli ping.
-
Install psql globally
sudo apt-get install postgresql-client
-
Add these lines to your
~/.bashrcfile for authentication to the postgres container as the correct user:export PGUSER=postgres export PGPASSWORD=postgres -
Change the
DATABASE_URLline in your .env to be:DATABASE_URL=postgres://localhost:5432/bloom -
Navigate to the
bloomdirectory that you created when you cloned the repo and run the following:docker-compose up redis postgres-
You should see some output indicating that the containers have successfully started.
-
If you wish to stop running the services, you can Ctl-C to kill the processes.
-
If you wish to run the containers in the background and not need to keep the terminal open, kill the previous containers and run:
docker-compose up -d redis postgresYou can stop running the containers in the background via
docker-compose down
-
-
To seed the database with a variety of listings (including CA listings),
cd backend/coreandyarn db:reseed.- For Detroit-only listings, use
yarn db:reseed:detroit. -
psqlmay give you permissions issues here. Locally you can give yourself superuser permissions as a workaround. - Some installations of
psqluse a different default port value. Ifpsqlgives error messages about socket 5433, try addingexport PGPORT=5432to your~/.bashrc.
- For Detroit-only listings, use
-
Check that you can connect to the bloom database and run a simple query:
$ psql bloom bloom=# select count(*) from units;