The U.S. Forest Service is engaged in an ongoing effort to modernize and simplify their permitting processes. One facet of this effort is to make special use permits available to obtain online. Flexion worked with GSA's Technology Transformation Service's Office of Acquisitions and the Forest Service to build out this platform for noncommercial and temporary use permits.
The opportunity statement = the problem we are trying to solve with the ePermitting project
We had the opportunity to modernize the ability to apply for special use permits within a pilot forest (Mt. Baker-Snoqualime) of the Forest Service. Our belief is that this will simplify and speed up the ability to apply for and act on special use permits.
See CONTRIBUTING for additional information.
This project is in the worldwide public domain. As stated in CONTRIBUTING:
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
Install yarn package manager
Install Node ^6.10.3
Install Git
git clone [repository url] fs-intake-module
Navigate to cloned repo
cd fs-intake-module
A running Postgresql database is required in order to run the server locally. Please make sure you have installed Postgresql locally and created a database for this project.
There are environment variables that are required to be set in order to run tests and to run the server in general. Please set up these environment variables either in your shell or on the command line.
In general setting an environment variable in your shell is similar to:
export ENV_VAR=something
and on the command line as part of a command:
ENV_VAR=something ANOTHER_ENV_VAR=somethingelse <rest of command>
In order to pass end to end tests locally or on CircleCI, you must include valid s3 credentials in the VCAP_SERVICES variable.
DATABASE_URL
postgres://<user>:<pass>@localhost:<port>/<dbname>
or for CircleCI
postgres://ubuntu:@127.0.0.1:5432/circle_test
PLATFORM
local
or for CircleCI
CI
SNYK_TOKEN
(from https://snyk.io/account)
VCAP_APPLICATION
{"uris":["http://localhost:8080"]}
VCAP_SERVICES
{
"user-provided": [
{
"credentials": {
"middlelayer_base_url": "https://fs-middlelayer-api-staging.app.cloud.gov/",
"middlelayer_password": "",
"middlelayer_username": ""
},
"label": "user-provided",
"name": "middlelayer-service",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
},
{
"credentials": {
"intake_client_base_url": "http://localhost:4200",
"intake_password": "",
"intake_username": "",
"jwt_secret": "shhhhhhhh!"
},
"label": "user-provided",
"name": "intake-client-service",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
},
{
"credentials": {
"entrypoint": "",
"issuer": "",
"private_key": "",
"discovery_url": "https://secure.login.gov/.well-known/openid-configuration",
"idp_username": "",
"idp_password": "",
"jwk": {
"d": "1234",
"dp": "1234",
"dq": "1234",
"e": "1234",
"kty": "RSA",
"kid": "1234",
"n": "1234",
"p": "1234",
"q": "1234",
"qi": "1234"
}
},
"label": "user-provided",
"name": "login-service-provider",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
},
{
"credentials": { "whitelist": [], "issuer": "", "entrypoint": "", "cert": "", "private_key": "" },
"label": "user-provided",
"name": "eauth-service-provider",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
},
{
"credentials": { "smtp_server": "", "username": "" },
"label": "user-provided",
"name": "smtp-service",
"syslog_drain_url": "",
"tags": [],
"volume_mounts": []
},
{
"name": "auth-service",
"credentials": { "jwt_secret_key": "shhhhhhhh!" }
}
],
"s3": [
{
"name": "intake-s3",
"credentials": { "bucket": "", "access_key_id": "", "region": "us-east-1", "secret_access_key": "" }
}
]
}
run cd server
then run yarn
to install dependencies.
To run any of the server commands, either the environment variables above must be available in your shell or on the command line, and you must be in the server directory.
To setup the database run yarn migrate
Run yarn dev
to start the server, and visit http://localhost:8080.
To revert the last database migration run
yarn undoLastMigrate
To revert all of the database migrations and start with a blank database run
yarn undoAllMigrate
To run eslint for linting:
yarn lint
The linting results will be put into server/lint-results.html
.
To run all of the tests locally, be sure your Postgresql server is running and then run: yarn test
To run code coverage locally, be sure your Postgresql server is running then run:
yarn coverage
The coverage results can be found in server/coverage/index.html
With your local Node server running, browse to http://localhost:8080/docs/api in order to view the interactive Swagger API documentation. This documentation will allow interactive access to the API endpoints.
Public users must authenticate with login.gov, and Forest Service admins must authenticate with USDA eAuth. Both of these authentication techniques are handled by the Passport library for Node.js.
Login.gov uses the openid-client passport plugin for the OpenID Connect protocol, and USDA eAuth uses the passport-saml plugin for the SAML protocol.
Due to security restrictions testing can't be done locally, you must use a server on cloud.gov. Setting the PLATFORM environment variable will bypass all authentication checks.
Run yarn global add @angular/cli
cd frontend
Run yarn
Run ng serve
for a development server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng build --prod --env=prod --aot=false
to build the static files for the single paged app. The build artifacts that can be deployed will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Add --code-coverage
flag to print out code coverage statistics.
Run yarn run e2e
to execute the end-to-end tests via Protractor.
Install typedoc globally: yarn global add typedoc
cd frontend
build typedoc yarn run docs
typedoc are added to frontend/src/assets/typedoc
and are accessible via url at /assets/typedoc/index.html
Navigate to /assets/typedoc/index.html
In order to enable pushstate for single page apps on cloud.gov using the static build pack, you must add a file called Staticfile
to the root directory with a single line pushstate: enabled
This allows you to use urls like /some/path
instead of /#/some/path
The current configuration implements email via google smtp relay. Follow the documentation at https://support.google.com/a/answer/2956491?hl=en to set up your google SMTP relay.
Authentication is set up to support whitelisted IP addresses that are allowed to send emails, so no SMTP authentication is required.
The smtpserver
value in your VCAP_SERVICES should be smtp-relay.gmail.com
As an alternative to installing all the development tools necessary to run the entire environment on your computer, Docker can be used instead. These instructions will detail how to use Docker to setup a full environment to run the application.
Install Docker for your platform at https://www.docker.com/. Make sure that the Docker service is started.
Clone this repository.
In a console terminal navigate to the directory the repository was cloned to. Now cd
to the docker
directory.
$ cd fs-intake-module
$ cd docker
Now use Docker Compose to build and start the containers.
$ docker-compose up --build --force-recreate
The first time the containers are created it will take a few minutes. There will be a whole lot of output to the screen, but eventually the output will stop and something like the following should be displayed:
fs-intake-frontend_1 | webpack: Compiled successfully.
The containers and servers are now running. There are four containers:
fs-intake-frontend - This container runs the Angular application. It can be accessed in the browser at http://localhost:4200.
fs-intake-server - This container runs the server side Node application. It can be accessed in the browser at http://localhost:8080.
fs-intake-postgres - This container runs the PostgreSQL database server.
adminer - This container runs a PHP based database administration application. It can be accessed at http://localhost:8081. The front page for Adminer is a database login page. The values to use are:
Changes made to any of the JavaScript code will be automatically picked up and the appropriate server will auto-reload so that your changes can be seen immediately.
If either of the package.json
files are modified, at this time simply Ctrl+C in the terminal you ran docker-compose
in to stop the running containers and then re-run the docker-compose
command to rebuild the containers.
The file frontend/src/sass/_focus-fix.scss implements a style fix in the upstream repository: https://github.com/18F/web-design-standards/pull/2112/files Eventually once these changes are released we can remove this file.
While developing we spent time usability testing features with the correct users and applied majority feedback.
This repository includes usability testing conducted by Flexion