The focal point for an 18F/TTS project with the United States Forest Service on their Grants & Agreements program.
18F is partnering with the United States Forest Service on a project focused on their Grants & Agreements program. This repo contains documentation describing the project. To learn about the project, what it can do, and why it's important, head to our project wiki.
18F had been working with Forest Service to prepare this project to be ready for a vendor to begin product development. We focused on user research, experimentation and prototyping to de-risk core functionality, rather than developing the solution following the Product Roadmap.
We are pausing this prototyping work to get alignment across Forest Service on:
- The vision for the product
- The roles and responsibilities for product development.
The present prototyping team is being re-assigned and a reconfigured team will work on these alignment issues. This README describes how to work with the prototype application that we developed. See the page on Platform and Technologies for more on how the production application will run.
First, ensure Docker Desktop is installed.
- To build the containers and make sure they're working, run
docker compose up
. Then shut them down with ctrl+C. - Once we know the containers are working, run them in detached mode:
docker compose up -d
. - Create the database. Shell into the postgres container by running
docker compose exec postgres psql -U postgres
. Then, once inside, runCREATE DATABASE nrm_dev;
. Exit the container. - TODO: Add instructions to migrate the database and load data once we have an ORM in the Angular/Lambda environment
- To run API tests, run
docker-compose run api npm run test
while the containers are running, orexec
instead ofrun
if they're not running. - To run frontend tests, cd into
frontend
and runng test
(to watch files) ornpm run test
(for a one-time run). (TODO: Need to add Chromium toweb
indocker-compose.yml
.)
Visit the Angular app at http://localhost:4200, and the API at http://localhost:3000. (Ports are in the docker-compose.yml file in the project root.)
To do.
- Move into the
/api
directory withcd /api
. - Run
npm install
. - Compile TypeScript to JavaScript with
npx tsc
. The JavaScript insrc
will be bundled tobin/index.js
- Run the local development server with
npm run serve
.
Ensure you have AWS Credentials set up:
- Get access to the 18F AWS Sandbox account.
- After logging in, click your account name and go to My Security Credentials.
- Under "Access keys for CLI, SDK, & API access", click "Create access key". Copy these values to a file at
~/.aws/credentials
. Use the format in the Claudia tutorial. - In the AWS console, go to IAM > Roles > lambda_basic_execution. You may need to copy the role ARN and pass a
--role {lambda_basic_execution Role ARN}
flag to claudia commands, as well as aAWS_PROFILE=claudia
env var before claudia invocations. - To push updated code to the AWS Sandbox Lambda setup, run
npm run update
. This will recompile the code tobin/index.js
, and push it and its Lambda handler to the sandbox Lambda.
Run the following:
$ pushd api && DATABASE_URL=postgres://empty npm run update && popd
Ensure you have the AWS CLI (awscli
) installed. Then run:
$ pushd frontend \
&& ng build --configuration=sandbox \
&& aws s3 sync dist/frontend/ s3://gov.usda.fs.nrm.ga \
&& popd
We use husky to manage git hooks.
To opt-in to using the hooks, run either:
npx husky install
or
git config --add core.hooksPath .husky
Test that the setup worked by creating a commit—you should see, at minimum, prettier
checks being run on TypeScript files.