Skip to content

Commit

Permalink
Update README: Get cert before running setup script (#939)
Browse files Browse the repository at this point in the history
  • Loading branch information
cvalarida authored Apr 25, 2017
1 parent 3360ebf commit 24bb626
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 18 deletions.
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ To start, fetch this code:

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


#### Automated (OSX)

If you are developing on OSX, you can run the automated setup script. From
Expand All @@ -23,35 +24,35 @@ the `vets-api` directory, run `./bin/setup-osx && source ~/.bash_profile && cd .
#### Alternative (OSX)

1. Install Ruby 2.3.
- It is suggested that you use a Ruby version manager such as
- It is suggested that you use a Ruby version manager such as
[rbenv](https://github.com/rbenv/rbenv#installation) and
[install Ruby 2.3](https://github.com/rbenv/rbenv#installing-ruby-versions).
- *NOTE*: rbenv will also provide additional installation instructions in the
- *NOTE*: rbenv will also provide additional installation instructions in the
console output. Make sure to follow those too.
1. Install Bundler to manage dependencies
- `gem install bundler`
- `gem install bundler`
1. Install Postgres and enable on startup
- `brew install postgres`
- `brew services start postgres`
- `brew install postgres`
- `brew services start postgres`
1. Install Redis
- `brew install redis`
- Follow post-install instructions to enable Redis on startup. Otherwise,
- `brew install redis`
- Follow post-install instructions to enable Redis on startup. Otherwise,
launch it manually with `brew services start redis`.
1. Install gem dependencies: `cd vets-api; bundle install`
1. Install overcommit `overcommit --install --sign`
1. Setup localhost certificates / keys
- Create a hidden folder in your home directory: `mkdir ~/.certs`
- Copy the [certificate][certificate] to `~/.certs/vetsgov-localhost.crt`
- Copy the [key][key] to `~/.certs/vetsgov-localhost.key`
- *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 ~/.certs/vetsgov-localhost.crt`
- `touch ~/.certs/vetsgov-localhost.key`
1. Setup localhost certificates / keys:
- Create a hidden folder in your home directory: `mkdir ~/.certs`
- Copy the [certificate][certificate] to `~/.certs/vetsgov-localhost.crt`
- Copy the [key][key] to `~/.certs/vetsgov-localhost.key`
- *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 ~/.certs/vetsgov-localhost.crt`
- `touch ~/.certs/vetsgov-localhost.key`
1. Create dev database: `bundle exec rake db:setup`


[certificate]: https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Identity%20Discovery%202016/certificates/vetsgov-localhost.crt
[key]: https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Identity%20Discovery%202016/certificates/vetsgov-localhost.key
[certificate]: https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Files_From_IDme/development-certificates/vetsgov-localhost.crt
[key]: https://github.com/department-of-veterans-affairs/vets.gov-team/blob/master/Products/Identity/Files_From_IDme/development-certificates/vetsgov-localhost.key

### Configuration

Expand Down
35 changes: 34 additions & 1 deletion bin/setup-osx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ command_exists () {
}
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
RESET=`tput sgr0`

# Check for homebrew
Expand Down Expand Up @@ -80,6 +81,29 @@ fi

brew services start postgresql

# Make vetsgov-localhost.crt and .key

CERT_INSTALL_REQUIRED=false
if [ ! -d ~/.certs ]; then
mkdir ~/.certs
fi

if [ -f ~/.certs/vetsgov-localhost.crt ]; then
echo "${GREEN} * vetsgov-localhost.crt installed.${RESET}"
else
echo "${RED} * Installing vetsgov-localhost.crt.${RESET}"
touch ~/.certs/vetsgov-localhost.crt
CERT_INSTALL_REQUIRED=true
fi

if [ -f ~/.certs/vetsgov-localhost.key ]; then
echo "${GREEN} * vetsgov-localhost.key installed.${RESET}"
else
echo "${RED} * Installing vetsgov-localhost.key.${RESET}"
touch ~/.certs/vetsgov-localhost.key
CERT_INSTALL_REQUIRED=true
fi

# Install ruby / vet-api deps

bundle install -j4
Expand All @@ -89,8 +113,17 @@ bundle exec overcommit --install --sign
rake db:create db:setup db:seed

cp config/mvi_schema/mock_mvi_responses.yml.example config/mvi_schema/mock_mvi_responses.yml
cp config/application.yml.example config/application.yml

# Run a test to make sure things are working after setup

rake

# Warn the user that the certs installed are blank and have limited functionality

if [ "$CERT_INSTALL_REQUIRED" = true ]; then
echo "${YELLOW}Notice: Blank certificate files were installed for limited functionality. If you have access, go to:"
echo
echo " https://github.com/department-of-veterans-affairs/vets.gov-team/tree/master/Products/Identity/Files_From_IDme/development-certificates"
echo
echo "and copy the .crt and .key files to ~/.certs/${RESET}"
fi

0 comments on commit 24bb626

Please sign in to comment.