This project provides common APIs for applications that live on vets.gov.
Vets-api requires:
- postgres
- Redis
- rails server
To start, fetch this code: git clone https://github.com/department-of-veterans-affairs/vets-api.git
From the vets-api
directory, run ./bin/setup-osx && source ~/.bash_profile && cd .
if you're on a mac. It will ensure that you have all development dependencies setup
-
Install Ruby 2.3. (It is suggested to use a Ruby version manager such as rbenv and then to install Ruby 2.3). Note: rbenv will also provide additional installation instructions in the console output. Make sure to follow those too.
-
Install Bundler to manage dependencies:
gem install bundler
-
Install Postgres (on Mac):
brew install postgres
-
Install Redis (on Mac):
brew install redis
-
Install gem dependencies:
cd vets-api; bundle install
-
Install overcommit
overcommit --install --sign
-
Create a application.yml
cat ./config/application.yml.example > ./config/application.yml
-
Setup localhost certificates / keys
- Create a hidden folder in home directory:
mkdir ~/.certs
- Copy the certificate to ~/.certs
- Copy the key to ~/.certs
- Start Postgres:
brew services start postgres
- Create dev database:
bundle exec rake db:setup
You will need to specify the following environment variables in application.yml
:
REDIS_HOST
REDIS_PORT
For an example, see application.yml.example
- Follow post install instructions
- always have Redis running as service
- manually launch Redis
brew services start redis
- Set the environment variables above according to your Redis configuration
Note: If you encounter Redis::CannotConnectError: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)
this is a sign that redis is not currently running or config/redis.yml
is not using correct host and port.
Tra
The following features require additional configuration, click for details.
- Authentication with ID.me
- EVSS
- Facilities Locator
- My HealtheVet (MHV)
- Education Benefits
- Master Veteran Index (MVI)
Vets-api will still run in a limited capacity without configuring any of the features.
Manually run each:
postgres -D /usr/local/var/postgres
redis-server /usr/local/etc/redis.conf
bundle exec rails server
from <GITHUB_HOME>/vets-api/
- Start the application:
bundle exec foreman start
- Navigate to http://localhost:3000/v0/status in your browser.
bundle exec rake lint
- Run the full suite of linters on the codebase.bundle exec guard
- Runs the guard test server that reruns your tests after files are saved. Useful for TDD!bundle exec rake security
- Run the suite of security scanners on the codebase.bundle exec rake ci
- Run all build steps performed in CI.
Ansible templates and instructions for deploying are in the devops repo. The app_name
for this project is platform-api
. After deploying, you can check that the right version was deployed with:
https://dev-api.vets.gov/v0/status
There is also a jenkins build that will deploy all the apps in a certain environment.
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.
There are many ways to contribute to this project:
Bugs
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:
- Branch or Fork
- Commit changes
- Submit Pull Request
- Discuss via Pull Request
- 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.