Vets API requires:
- PostgreSQL
- Including PostGIS
- Redis
- Ruby 2.6.6
To start, fetch this code:
git clone https://github.com/department-of-veterans-affairs/vets-api.git
If you are developing on OSX, you can run the automated setup script. From the vets-api
directory, run ./bin/setup-osx && source ~/.bash_profile && cd .
NOTE
This installs rbenv and other homebrew libraries for this project. If you only want to manage your own libraries, it is suggested you continue below.
- Install Ruby 2.6.6
- It is suggested that you use a Ruby version manager such as rbenv and install Ruby 2.6.6.
- 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 and enable on startup
brew install postgres brew services start postgres
- Install PostGIS
brew install postgis
- Install Redis
brew install redis
- Follow post-install instructions to enable Redis on startup. Otherwise,
launch it manually with
brew services start redis
.
- Install ImageMagick
brew install imagemagick
- Install Poppler
brew install poppler
- Install ClamAV
brew install clamav # Take note of the the post-install instructions "To finish installation & run clamav you will need to edit the example conf files at `${conf_files_dir}`", which will vary depending on your homebrew installation cd ${conf_files_dir} touch clamd.sock echo "LocalSocket ${conf_files_dir}" > clamd.conf echo "DatabaseMirror database.clamav.net" > freshclam.conf freshclam -v
- Install pdftk
curl -o ~/Downloads/pdftk_download.pkg https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server-2.02-mac_osx-10.11-setup.pkg
sudo installer -pkg ~/Downloads/pdftk_download.pkg -target /
- Install gem dependencies:
cd vets-api; bundle install
- If you receive an error installing nokogiri, you may need to tell bundle to build with local libraries:
bundle config build.nokogiri --use-system-libraries
- If you receive an error installing nokogiri, you may need to tell bundle to build with local libraries:
- More information about installing with Sidekiq Enterprise as well as our credentials are on the internal system here: https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Platform/Vets-API/Sidekiq%20Enterprise%20Setup.md
- Install overcommit
overcommit --install --sign
- Create dev database:
bundle exec rake db:setup
- Go to the file
config/settings/development.yml
in your local vets-api. Toggle commenting so that the native method is uncommented only.cache_dir: ../vets-api-mockdata # via rails; e.g. bundle exec rails s or bundle exec rails c # cache_dir: /cache # via docker; e.g. make up or make console
- Make sure you have the vets-api-mockdata repo locally installed, preferably in a parallel directory to
vets-api
. - Create a
config/settings.local.yml
file for your local configuration overrides. Add this key pointing to yourvets-api-mockdata
directory.betamocks: cache_dir: ../vets-api-mockdata
- Install Postgres, PostGIS, Redis, ImageMagick, Poppler, ClamAV, etc
- From the
vets-api
directory, run./bin/install-ubuntu-packages
- From the
- Edit
/etc/ImageMagick-6/policy.xml
and remove the lines below the comment<!-- disable ghostscript format types -->
- This may not be necessary. The default policy was updated to fix a variety of vulnerabilities as of October, 2018.
- Install Ruby 2.4.5
- It is suggested that you use a Ruby version manager such as rbenv and install Ruby 2.4.5.
- 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 gem dependencies:
cd vets-api; bundle install
- Install overcommit
overcommit --install --sign
- Setup localhost certificates / keys:
- Create certs directory within config:
mkdir ./config/certs
- Copy these certificates into the certs dir.
- NOTE: If you don't have access to these keys, running the following commands will provide basic functionality, such as for running unit tests:
touch ./config/certs/vetsgov-localhost.crt
touch ./config/certs/vetsgov-localhost.key
- Create certs directory within config:
- Create dev database:
bundle exec rake db:setup
- Make sure you have the vets-api-mockdata repo locally installed, preferably in a parallel directory to
vets-api
. - Create a
config/settings.local.yml
file for your local configuration overrides. Add this key pointing to yourvets-api-mockdata
directory.
betamocks:
cache_dir: ../vets-api-mockdata