- Install Docker and docker-compose
- You can install docker hub directly: https://hub.docker.com/. This is the preferred solution and should come with docker-compose
- Alternatively, you can install docker and run it as a daemon:
brew install docker
.
There are two major pieces:
- Java Spring
- Postgres
To run the service, you needs a DB and a connection to Okta for it to work. Locally, you can disable authentication, but you still need the database running locally.
If Java isn't installed on a Mac you can get it from brew
:
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8
brew install gradle
Running with docker:
cd backend
- Run
docker-compose up --build
- view site at http://localhost:8080
Running spring app locally and db in docker
cd backend
- Run
docker-compose up db
- Run
gradle bootRun --args='--spring.profiles.active=dev'
- view site at http://localhost:8080
Running spring app locally and db in docker on port 5433
cd backend
- Run
docker-compose --env-file .env.development up db
- Run
SR_DB_PORT=5433 gradle bootRun --args='--spring.profiles.active=dev'
- view site at http://localhost:8080
When there are DB schema changes the backend may throw and error and fail to start.
Restarting the docker way:
- run
cd backend
- Bring down the service by running
docker-compose down
- Wipe the db by running
docker system prune && docker images prune && docker volumes prune
- Restart the service
docker-compose up --build
Restarting the SQL way:
- run
db-setup/nuke-db.sh
- restart the spring app
gradle bootRun --args='--spring.profiles.active=dev'
Go to localhost:8080
to see interact with the graphql api. You would need to point the api endpoint to the backend at: http://localhost:8080/graphql
This gives you a preview to query/mutate the local database.
All the test can be run with gradle test
Running a single test with a full stacktrace can be accomplished by supping the path to gradle test
. Example
gradle test --tests gov.cdc.usds.simplereport.api.QueueManagementTest.updateItemInQueue --stacktrace
cd backend
docker-compose up db
docker-compose up --build schemaspy
# to run on a different port than 8081
SR_SCHEMASPY_PORT=8082 docker-compose up --build schemaspy
visit http://localhost:8081
The frontend is a React app. The app uses Apollo to manage the graphql API. For styling the app leverages the U.S. Web Design System (USWDS)
- Install nvm
- (optional) Install react developer tools extensions
cd frontend && nvm use && yarn install
yarn start
- view site at http://localhost:3000
- Note: frontend need the backend to be running to work
See https://github.com/usds/prime-simplereport-docs/blob/main/azure/manual-app-deploy.md