Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 10.3 KB

DEV_ENV.md

File metadata and controls

48 lines (33 loc) · 10.3 KB

Local Development Environment

Development quickstart

  1. install docker. If brew is installed run brew install docker.
  2. install chamber. If brew is installed run brew install chamber. (This is needed for running functional tests.)
  3. install happy. If brew is installed run brew install chanzuckerberg/tap/happy
  4. Follow the steps in [./REMOTE_DEV.md] under "Remote Dev Pre-requisites".
  5. Run happy install to setup the appropriate DNS entries locally for the local development environment.
  6. From the root of this repository, run make local-init to build and run the dev environment. The first build takes awhile, but subsequent runs will use cached artifacts.
  7. Visit http://backend.naparinet.local:5000 to view the backend, and http://frontend.naparinet.local:3000 for the frontend.
  8. Open the source code and start editing!
  • Modify code in the frontend directory, save your changes and the browser will update in real time.
  • Modify code in the backend directory, and the api will reload automatically.

Containers managed by the dev environment

The dev environment is a set of containers defined in docker-compose.yml. The backend docker image and frontend docker image are built locally. Update any of these files as necessary and run make local-sync to sync your dev environment with these configs.

Updating frontend/backend dependencies

Both the frontend and backend services will automatically reload when their source code is modified, but they won't automatically rebuild when their dependencies (such as npm or pip package lists) change.

To update the dev env to reflect changes to client/package.json or backend/requirements.txt, run make local-sync

Update Dev Data

The dev environment is initialized with AWS Secrets/S3 data in the backend/setup_dev_data.sh script. To add more data, modify these scripts and run make local-init to reload the dev environment's data stores.

Make targets for managing dev:

Command Description Notes
make local-init Launch a new local dev env and populate it with test data.
make local-start Start a local dev environment that's been stopped.
make local-stop Stop the local dev environment.
make local-logs Tail the logs of the dev env containers. Run make local-logs CONTAINER=backend to tail the logs of a specific container. Dev containers are: backend, frontend
make local-shell CONTAINER=frontend Open a command shell in one of the dev containers Dev containers are: backend, frontend, localstack
make local-status Show the status of the containers in the dev environment.
make local-clean Remove everything related to the local dev environment (including db data!)
make local-sync Re-sync the local-environment state after modifying library deps or docker configs

External dependencies

The dev environment has no network dependencies, but it launches some extra containers to mock external dependencies: