Skip to content

Commit

Permalink
make local development easier with regards to google credential json
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Soto committed Nov 22, 2023
1 parent 12584f5 commit 73d6ecb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ To run locally:
1. Make sure you have the requirements installed from above. We recommend IntelliJ as an IDE.
2. Clone the repo (if you see broken inputs build the project to get the generated sources)
3. Run the commands in `scripts/postgres-init.sql` in your local postgres instance. You will need to be authenticated to access Vault.
4. Run `scripts/write-config.sh`. Be sure to follow instructions from output, especially setting the GOOGLE_APPLICATION_CREDENTIALS environment variable
5. Run `./gradlew bootRun` to spin of the server.
4. Run `scripts/write-config.sh`
5. Run `./gradlew bootRun` to spin up the server.
6. Navigate to [http://localhost:8080/#](http://localhost:8080/#)

#### Local development with debugging
Expand Down
4 changes: 1 addition & 3 deletions scripts/write-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,8 @@ function vaultgetdb {
jq -r '.username' "${datafile}" > "${outputdir}/${fileprefix}-username.txt"
}

# grab tsps service account json from vault
vaultget "secret/dsde/firecloud/${fcenv}/tsps/tsps-account.json" "${outputdir}/tsps-sa.json"
echo "Run
GOOGLE_APPLICATION_CREDENTIALS='${outputdir}/tsps-sa.json'
to set the GOOGLE_APPLICATION_CREDENTIALS environment variable"

# We made it to the end, so record the target and avoid redos
echo "$target" > "${outputdir}/target.txt"
9 changes: 7 additions & 2 deletions service/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,15 @@ dependencies {
testImplementation 'org.testcontainers:postgresql:1.17.3'

}
// set environment variable for google default credentials when running bootRun
// workaround for local development
// set GOOGLE_APPLICATION_CREDENTIALS if this file exists - should only exist when
// write-config.sh is run.
// GOOGLE_APPLICATION_CREDENTIALS is set for us when running in a deployed environment
def googleCredentialsFile = "${rootDir}/config/tsps-sa.json"
bootRun {
environment.put("GOOGLE_APPLICATION_CREDENTIALS", "${googleCredentialsFile}")
if(project.file(googleCredentialsFile).exists()) {
environment.put("GOOGLE_APPLICATION_CREDENTIALS", "${googleCredentialsFile}")
}
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public List<ListAppResponse> queryForWorkspaceApps() {
List<ListAppResponse> getAppsResponse =
leonardoService.getApps(workspaceId, samService.getTspsServiceAccountToken(), false);

logger.debug(
logger.info(
"GetAppsResponse for workspace id {}: {}",
imputationConfiguration.workspaceId(),
getAppsResponse);
Expand Down
10 changes: 5 additions & 5 deletions service/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ env:
exportEnabled: ${CLOUD_TRACE_ENABLED:false}
samplingRate: ${SAMPLING_PROBABILITY:0}
urls:
sam: ${SAM_ADDRESS:https://sam.dsde-dev.broadinstitute.org}
leonardo: ${LEONARDO_ADDRESS:https://leonardo.dsde-dev.broadinstitute.org}
sam: ${SAM_ADDRESS:https://sam.jsoto-fourth-try.bee.envs-terra.bio/}
leonardo: ${LEONARDO_ADDRESS:https://leonardo.jsoto-fourth-try.bee.envs-terra.bio/}
imputation:
# default workspace id is for this workspace in the dev environment
# https://bvdp-saturn-dev.appspot.com/#workspaces/tsps_dev_BP/Imputation_Control_Workspace_test
# should be updated when trying to run on a bee.
workspaceId: ${IMPUTATION_WORKSPACE_ID:a2e9cfbb-e4f0-4788-8aa1-de23533205fc}
# https://bvdp-saturn-dev.appspot.com/#workspaces/tsps_dev_BP/Imputation_Control_Workspace_test.
# this should be updated when trying to run on a bee.
workspaceId: ${IMPUTATION_WORKSPACE_ID:5046acb0-32a1-437d-9a18-fac6897c8f03}

# Below here is non-deployment-specific

Expand Down

0 comments on commit 73d6ecb

Please sign in to comment.