mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-15 09:42:38 -05:00
Address PR feedback
This commit is contained in:
32
README.md
32
README.md
@@ -42,19 +42,30 @@ Our other repositories are:
|
||||
|
||||
## Local setup
|
||||
|
||||
### Common steps
|
||||
|
||||
1. Install pre-requisites for setup:
|
||||
* [jq](https://stedolan.github.io/jq/): `brew install jq`
|
||||
* [terraform](https://www.terraform.io/): `brew install terraform` or `brew install tfenv` and use `tfenv` to install `terraform ~> 1.4.0`
|
||||
* [cf-cli@8](https://docs.cloudfoundry.org/cf-cli/install-go-cli.html): `brew install cloudfoundry/tap/cf-cli@8`
|
||||
1. [Log into cloud.gov](https://cloud.gov/docs/getting-started/setup/#set-up-the-command-line): `cf login -a api.fr.cloud.gov --sso`
|
||||
1. Ensure you have access to the `notify-local-dev` and `notify-staging` spaces in cloud.gov
|
||||
1. Run the development terraform with:
|
||||
|
||||
```
|
||||
$ cd terraform/development
|
||||
$ ./run.sh
|
||||
```
|
||||
|
||||
1. If you want to send data to New Relic from your local develpment environment, set `NEW_RELIC_LICENSE_KEY` within `.env`
|
||||
1. Follow the instructions for either `Direct installation` or `Docker installation` below
|
||||
|
||||
### Direct installation
|
||||
|
||||
1. Set up Postgres && Redis on your machine
|
||||
|
||||
1. Install [pipenv](https://pipenv.pypa.io/en/latest/)
|
||||
|
||||
1. Create the .env file
|
||||
|
||||
```
|
||||
cp sample.env .env
|
||||
# follow the instructions in .env
|
||||
```
|
||||
|
||||
1. Run the project setup
|
||||
|
||||
`make bootstrap`
|
||||
@@ -78,12 +89,7 @@ Our other repositories are:
|
||||
|
||||
If you're working in VS Code, you can also leverage Docker for a containerized dev environment
|
||||
|
||||
1. Create the .env file
|
||||
|
||||
```
|
||||
cp sample.env .env
|
||||
# follow the instructions in .env
|
||||
```
|
||||
1. Uncomment the `Local Docker setup` lines in `.env` and comment out the `Local direct setup` lines.
|
||||
|
||||
1. Install the Remote-Containers plug-in in VS Code
|
||||
|
||||
|
||||
13
sample.env
13
sample.env
@@ -1,15 +1,4 @@
|
||||
# STEPS TO SET UP
|
||||
#
|
||||
# 1. Copy this file to `.env`
|
||||
#
|
||||
# 2. Update NEW_RELIC_LICENSE_KEY, if you are testing new relic integrations in development
|
||||
#
|
||||
# 3. Uncomment either the Docker setup or the direct setup
|
||||
#
|
||||
# 4. Comment out the other setup
|
||||
#
|
||||
# 5. Run `cd terraform/development; ./run.sh` to include service credentials in `.env`
|
||||
#
|
||||
# See README.md for local setup instructions
|
||||
|
||||
# ## REBUILD THE DEVCONTAINER WHEN YOU MODIFY .ENV ###
|
||||
|
||||
|
||||
@@ -19,14 +19,15 @@ Options:
|
||||
|
||||
Notes:
|
||||
* OrgManager is required for terraform to create <env>-egress spaces
|
||||
* Requires cf-cli@8
|
||||
* Requires cf-cli@8 & jq
|
||||
"
|
||||
|
||||
cf_version=`cf --version | cut -d " " -f 3`
|
||||
if [[ $cf_version != 8.* ]]; then
|
||||
echo "$usage"
|
||||
echo "$usage" >&2
|
||||
exit 1
|
||||
fi
|
||||
command -v jq >/dev/null || { echo "$usage" >&2; exit 1; }
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
@@ -61,17 +62,17 @@ while getopts ":hms:u:r:o:" opt; do
|
||||
done
|
||||
|
||||
if [[ $space = "" || $service = "" ]]; then
|
||||
echo "$usage"
|
||||
echo "$usage" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cf target -o $org -s $space 1>&2
|
||||
cf target -o $org -s $space >&2
|
||||
|
||||
# create user account service
|
||||
cf create-service cloud-gov-service-account $role $service 1>&2
|
||||
cf create-service cloud-gov-service-account $role $service >&2
|
||||
|
||||
# create service key
|
||||
cf create-service-key $service service-account-key 1>&2
|
||||
cf create-service-key $service service-account-key >&2
|
||||
|
||||
# output service key to stdout in secrets.auto.tfvars format
|
||||
creds=`cf service-key $service service-account-key | tail -n +2 | jq '.credentials'`
|
||||
@@ -79,7 +80,7 @@ username=`echo $creds | jq -r '.username'`
|
||||
password=`echo $creds | jq -r '.password'`
|
||||
|
||||
if [[ $org_manager = "true" ]]; then
|
||||
cf set-org-role $username $org OrgManager 1>&2
|
||||
cf set-org-role $username $org OrgManager >&2
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
|
||||
@@ -45,7 +45,7 @@ set -e
|
||||
|
||||
service_account="$username-terraform"
|
||||
|
||||
if [[ ! -f "secrets.auto.tfvars" ]]; then
|
||||
if [[ ! -s "secrets.auto.tfvars" ]]; then
|
||||
# create user in notify-local-dev space to create s3 buckets
|
||||
../create_service_account.sh -s notify-local-dev -u $service_account > secrets.auto.tfvars
|
||||
|
||||
@@ -54,6 +54,10 @@ if [[ ! -f "secrets.auto.tfvars" ]]; then
|
||||
cf set-space-role $cg_username $org notify-staging SpaceDeveloper
|
||||
fi
|
||||
|
||||
if [[ ! -f "../../.env" ]]; then
|
||||
cp ../../sample.env ../../.env
|
||||
fi
|
||||
|
||||
set +e
|
||||
|
||||
terraform init
|
||||
|
||||
Reference in New Issue
Block a user