Skip to content

Commit

Permalink
Add instructions to setup.md and move db data to docker volume
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinzwang committed Oct 15, 2022
1 parent a17d200 commit 8b6b30b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ services:
image: postgres:12.6
volumes:
- ./bt_main.dump:/bt_main.dump
- ./postgres-data:/var/lib/postgresql/data
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- "POSTGRES_DB=bt_main"
- "POSTGRES_USER=bt"
- "POSTGRES_PASSWORD=bt"

volumes:
postgres-data:

# docker-compose up --build backend
13 changes: 10 additions & 3 deletions setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ Docker is a container platform and Docker Compose is a a tool for defining and r
Docker applications. Make sure you have both install on your computer before you start. Docker Compose
comes with Docker in most cases (such as MacOS).

To run Berkeleytime, make sure this repo is clone. From the top level, first download the development
Postgres data with `make init`. This will create a folder `build/postgres-data`. Don't try to push it to Github -
its a local copy of the production data. Note: If you recieve the error `make: wget: No such file or directory`, make sure you have `wget` installed.
### Seeding the Local Database
To run Berkeleytime, make sure this repo is cloned. From the top level, first download the development
Postgres data:
1. `make postgres` - start up the postgres container
2. `curl -O https://storage.googleapis.com/berkeleytime/public/bt_seed.sql.gz` - download the database as a GZip file
3. `gzip -d bt_seed.sql.gz` - unzip this file
4. `cat bt_seed.sql | docker exec -i bt_postgres psql -U bt -d bt_main` - see Postgres container with the data.

Before starting the server, make sure the `DATABASE_URL` entry in your `.env.dev` is `postgres://bt:bt@postgres:5432/bt_main` so that the backend connects to the local DB.

### Starting the local server
To boot the services, run `make up`. This will boot 6 containers (redis, postgres, nginx, Django, Node.js). Wait for both
Postgres and Django to be running before you proceed. Django will say

Expand Down

0 comments on commit 8b6b30b

Please sign in to comment.