API for vets.gov
Clone or download
kalilsn Add environment task to facilities migration (#2737)
## Description of change
Adds environment task as a prereq so the task can access the database. Should be the final step before we can run the task for department-of-veterans-affairs/vets-contrib#990

## Testing done
<!-- Please describe testing done to verify the changes. -->

## Testing planned
<!-- Please describe testing planned. -->

## Acceptance Criteria (Definition of Done)

#### Unique to this PR
<!-- This would be a good place to include feature flag check item and info, specific dashboards and instrumentation check item and info -->
- [x] migrate_points_for_facilities rake task is runnable

#### Applies to all PRs

- [x] Appropriate logging
- [x] Swagger docs have been updated, if applicable
- [x] Provide link to originating GitHub issue, or connected to it via ZenHub
- [x] Does not contain any sensitive information (i.e. PII/credentials/internal URLs/etc., in logging, hardcoded, or in specs)
- [x] Provide which alerts would indicate a problem with this functionality (if applicable)
Latest commit 4045841 Jan 16, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.git-hooks/pre_commit Add Overcommit (#765) Feb 22, 2017
.github Update PULL_REQUEST_TEMPLATE.md Aug 16, 2018
app Fix facilities api bugs (#2735) Jan 16, 2019
bin Add setup instructions for ubuntu. Dec 6, 2018
config Collect MVI error details in MVI::Responses::FindProfileResponse obje… Jan 15, 2019
db Fixes bug - Unable to save any selections in staging (#2681) Dec 19, 2018
docs Add setup instructions for ubuntu. Dec 6, 2018
lib 527 EZ Pad Boxes with 0's (#2688) Jan 16, 2019
modules Add environment task to facilities migration (#2737) Jan 16, 2019
public 526 batch workflow and complete callback (#2398) Oct 31, 2018
rakelib 16224 convert treatment date (#2720) Jan 11, 2019
spec 527 EZ Pad Boxes with 0's (#2688) Jan 16, 2019
.dockerignore Redis / Docker Compose (#1222) Aug 1, 2017
.gitignore BAH Sprint 3 for 4142 (#2284) Sep 25, 2018
.overcommit.yml Possible 22-1995 output updates Feb 24, 2017
.rspec Add Rubocop reporting May 31, 2017
.rubocop.yml Enable Rails 4.2 rules for rubocop (#2699) Jan 8, 2019
.ruby-version Add .ruby-version and Travis ruby version Feb 2, 2016
CONTRIBUTING.md Updating contacts (#941) May 17, 2017
Dockerfile add virus definition update to dockerfile (#2608) Dec 6, 2018
Gemfile Goodbye Token Based Authentication (#2692) Jan 7, 2019
Gemfile.lock BAH SPRINT 12: Updated to the latest vets-json-schema version (#2711) Jan 8, 2019
Guardfile updating guard config to better support development workflow (#1902) May 10, 2018
Jenkinsfile Ensure cleanup is performed even if coverage/ dir doesnt exist (#2079) Jul 3, 2018
LICENSE.md Create LICENSE.md Feb 11, 2016
Makefile Delete Documents from S3 after successful submission to the VA (#1948) May 23, 2018
Procfile restore procfile to master Mar 22, 2018
README.md Art.facility lat long migrations (#2363) Oct 25, 2018
Rakefile Make sure to include the module with rspec Dec 13, 2018
config.ru Update rubocop version (#1641) Jan 17, 2018
docker-compose.test.yml Art.facility lat long (#2365) Nov 1, 2018
docker-compose.yml map port on docker postgres service so local dev host system can conn… Dec 12, 2018


Vets.gov API Build Status

This project provides common APIs for applications that live on vets.gov.

Base setup

See the native setup instructions if you can't use docker

To start, fetch this code:

git clone https://github.com/department-of-veterans-affairs/vets-api.git

  1. Install Docker for Mac. This will configure both docker and docker-compose.
  2. Setup localhost certificates / keys:
    • Create a folder in your vets-api directory: mkdir config/certs
    • Copy the certificate to config/certs/vetsgov-localhost.crt
    • Copy the key to config/certs/vetsgov-localhost.key
    • NOTE: using touch to create blank cert and key files no longer works. If you previously added certs in this manner replace them with the team repo certificate and key listed above.

Running the app

A Makefile provides shortcuts for interacting with the docker images. To run vets-api and its redis and postgres dependencies run the following command from within the repo you cloned in the above steps.

make up

You should then be able to navigate to http://localhost:3000/v0/status in your browser and start interacting with the API. Changes to the source in your local directory will be reflected automatically via a docker volume mount, just as they would be when running rails directly.

The Makefile has shortcuts for many common development tasks. You can still run manual docker-compose commands, but the following tasks have been aliased to speed developlment:

Running tests

  • make spec - Run the entire test suite via the docker image (alias for rspec spec)
  • make guard - Run the guard test server that reruns your tests after files are saved. Useful for TDD!

Running linters

  • make lint - Run the full suite of linters on the codebase.
  • make security - Run the suite of security scanners on the codebase.
  • make ci - Run all build steps performed in CI.

Running a rails interactive console

  • make console - Is an alias for rails console, which runs an IRB like REPL in which all of the API's classes and environmental variables have been loaded.

Running a bash shell

To emulate a local install's workflow where you can run rspec, rake, or rails commands directly within the vets-api docker instance you can use the make bash command.

$ make bash
Creating network "vetsapi_default" with the default driver
Creating vetsapi_postgres_1 ... done
Creating vetsapi_redis_1    ... done
# then run any command as you would locally e.g.
root@63aa89d76c17:/src/vets-api# rspec spec/requests/user_request_spec.rb:26


Vets API is configured with Config. The default configuration is contained in settings.yml. To customize your setup, you can create a config/settings.local.yml file with configuration specific to your needs. For example, to configure Redis and PostgreSQL (PostGIS is required), place something like this in that file:

database_url: postgis://pg_host:9999/custom_db

  host: redis_host
  port: 9999

This is also where you will place any other customizations, such as API tokens or certificate paths.

Config settings that vary in value depending on the deployment environment will also need to be set appropriately for each environment in the relevant devops (Private Repo) configurations (dev-, staging-, and prod-settings.local.yml.j2).

Some examples of configuration that will need to be added to these files are:

  • API keys/tokens
  • 3rd party service hostnames, ports, and certificates/keys.
  • Betamocks settings

Optional application configuration

The following features require additional configuration, click for details.

To mock one or more of the above services see Betamocks

Vets API will still run in a limited capacity without configuring any of these features, and will run the unit tests successfully.


make up fails with a message about missing gems

Could not find %SOME_GEM_v0.0.1% in any of the sources
Run `bundle install` to install missing gems.

There is no need to run bundle install on your system to resolve this. A rebuild of the vets_api image will update the gems. The vets_api docker image installs gems when the image is built, rather than mounting them into a container when it is run. This means that any time gems are updated in the Gemfile or Gemfile.lock, it may be necessary to rebuild the vets_api image using the following command:

  • make rebuild - Rebuild the vets_api image.

Authentication required for enterprise.contribsys.com

Authentication is required for enterprise.contribsys.com.
Please supply credentials for this source. You can do this by running:
 bundle config enterprise.contribsys.com username:password
ERROR: Service 'vets-api' failed to build: The command '/bin/bash --login -c bundle install -j4' returned a non-zero code: 17
make: *** [db] Error 1

Sidekiq Enterprise is used for worker rate limiting and additional reliability. Most developers can bypass the installation of Sidekiq Enterprise with

  • $ EXCLUDE_SIDEKIQ_ENTERPRISE=true make rebuild

Vets.gov Team Engineers should follow instructions here:


to install the enterprise license on their systems.

DO NOT commit Gemfile modifications that result from local builds without sidekiq enterprise if you do not have it enabled on your development system

Deployment instructions

Jenkins deploys vets-api upon each merge to master:


Each deploy is available here:


API request key formatting

When sending HTTP requests use the X-Key-Inflection request header to specify which case your client wants to use. Valid cases are camel, dash, and snake. For example if you set X-Key-Inflection: camel then you can use camelCase keys in your JSON request body and you will get back data with camelCase keys in the response body. If the header is not provided then the server will expect snake_case keys in the request body and output snake_case in the response.

How to contribute

There are many ways to contribute to this project:


If you spot a bug, let us know! File a GitHub Issue for this project. When filing an issue add the following:

  • Title: Sentence that summarizes the bug concisely
  • Comment:
    • The environment you experienced the bug (browser, browser version, kind of account any extensions enabled)
    • The exact steps you took that triggered the bug. Steps 1, 2, 3, etc.
    • The expected outcome
    • The actual outcome (include screen shot or error logs)
  • Label: Apply the label bug

For security related bugs unfit for public viewing, email us feedback@va.gov

Code Submissions

This project logs all work needed and work being actively worked on via GitHub Issues. Submissions related to these are especially appreciated, but patches and additions outside of these are also great.

If you are working on something related to an existing GitHub Issue that already has an assignee, talk with them first (we don't want to waste your time). If there is no assignee, assign yourself (if you have permissions) or post a comment stating that you're working on it.

To work on your code submission, follow GitHub Flow:

  1. Branch or Fork
  2. Commit changes
  3. Submit Pull Request
  4. Discuss via Pull Request
  5. Pull Request gets approved or denied by core team member

If you're from the community, it may take one to two weeks to review your pull request. Teams work in one to two week sprints, so they need time to need add it to their time line.


If you have a question or comment about this project, file a GitHub Issue with your question in the Title, any context in the Comment, and add the question Label.