reporting-analytics
v1.0.1
Published
* [What technologies being used?](#what-technologies-being-used) * [Development](#development) * [Testing](#testing) * [New Developer Local setup instructions.](#new-developer-local-setup-instructions) * [`Step 1` OnBoarding Goals](#step-1-onboa
Readme
REPORTING-ANALYTICS
- What technologies being used?
- New Developer Local setup instructions.
Step 1OnBoarding GoalsStep 2SSH SetupStep 3Repos (use the SSH methodology after setting up ssh)Step 4IDEStep 5NodeJSStep 6Java Development Kit (JDK)Step 7GitStep 8Artifactory SetupStep 9NPM SetupStep 10Gradle SetupSTEP 11aSet up your environment variables in order to runStep 11bRunning the Config ServerStep 12Running the ERA app
- Upgrading from an Older Version
What technologies being used?
Development
- Java 21
- Spring Boot
- Spring Boot Data JPA
- SAML & OAuth (IAM)
- Swagger
- Gradle
- React JS
- Node v12.16.1
Testing
- JUnit (test case executor)
Upgrading from an Older Version
If you are upgrading from a previous version of reporting-analytics that used Java 8 and Spring boot 2.X, follow these steps:
- Download Java 21 jdk https://www.oracle.com/java/technologies/downloads/#jdk21-mac
- Set your JAVA_HOME to the Java 21 jdk, or use a tool such as JENV. Using a tool is recommended as es-config-server still uses Java 8. Alternatively you can set Java Home in the terminal before the bootRun command EX: JAVA_HOME="C:/Program Files/Java/jdk1.8" ./gradlew bootRun Make sure to use the actual path and file name your machine uses for the relavent sdk.
- If you are using Intellij or another IDE capable of designating an sdk for the project, ensure it is pointing to jdk 21.
- Refresh your Gradle dependencies.
- Using the git bash terminal run the following lines one at a time in the project.
./gradlew wrapper --gradle-version 8.5./gradlew --stop./gradlew clean build- You can now run the project with
./gradlew bootRun
New Developer Local setup instructions.
...ALL THE BEST....
Step 1 OnBoarding Goals
- Get access and check that it works (OKTA, Artifactory, GitHub, VPN, etc)
- Setup tools and configs (IntelliJ, Clone BB repos, Gradle, SSH, NPM)
- Run Config-Server locally
- Run Reporting analytics locally
Step 2 SSH Setup
- You will need to setup SSH on your machine so that the remote Bitbucket repositories can be accessed from your local Config Server.
- To setup SSH, see https://docs.github.com/en/authentication/connecting-to-github-with-ssh
- Here if you do not already have a key, you can add a new key by clicking Add Key.
- Here you will paste in the key, if you are not sure how to create the key, or what to paste in, follow the helpful link on the Add Key page, which should bring you to the Creating SSH Keys help page.
Step 3 Repos (use the SSH methodology after setting up ssh)
Clone these repos to the same folder on your machine (now going to be referred to as "${ERA_CODE_FOLDER}" (i.e. "/Users/rhervey/rt/rtWorkbox/gitLocal/era")
- Config-Server (server) > config-server
- ERA application > reporting-analytics
- Rna-config > rna-config
Step 4 IDE
- IntelliJ IDEA (recommended)
- Personally I am using using IntelliJ now, so this is not recommended
- If you are more familiar and comfortable with Eclipse then go for it
Step 5 NodeJS
- You can just download the v12.16.1 version of Node or 12 version (16 and above does not work and do not use any other version).
- Node and NPM are needed for building the front end files of ERA.
- See NPM Setup for details on how to configure NPM.
Step 6 Java Development Kit (JDK)
- Download the latest version of JDK 21 from Oracle. (Do not use any other version).
- After installing the JDK, you need to setup CA certs, follow this guide to do so: Installing McKesson CA in Java [Steps-install certs] (https://mckesson.atlassian.net/wiki/spaces/PT/pages/79896080408/Installing+McKesson+CA+in+Java)
- Setup the JAVA_HOME environmental variable and add the JDK to your PATH variable if not done automatically during the installation process.
Step 7 Git
- You will want to use git bash at times which comes installed with Git.
Step 8 Artifactory Setup
- Your JFrog account will need to have been enabled in order for you to do this.
- Navigate to https://mckesson.okta.com/app/UserHome and login using your email and password. This will require verification via the Okta Verify app.
- Once logged in, click the Artifactory link.
- You should be navigated to the McKesson JFrog page and be logged in automatically.
- Click on the top right where it shows your email address.
- In the dropdown, you should see an option for "Edit Profile". If you do not see this option, you will need to reach out to other team members so that the correct access can be provided.
- After clicking "Edit Profile" you should be navigated to the User Profile page. Here you should see an option to generate an API key. Generate the key, this will be needed later.
Step 9 NPM Setup
You will need to configure NPM to use the internal McKesson registry. To this you need to set the registry in the .npmrc file.
The below commands can be used to configure the needed settings. Please use Terminal to run cmds. Note that you need to replace the email and the API key with your values. This is the same API key that we generated in #Artifactory Setup. The _auth value will in the end just be a base64 encoded string of your email address and your API key
npm config set strict-ssl false npm config set registry https://mck.jfrog.io/artifactory/api/npm/npm-common curl -k -u <mckessonEmail>:<APIKey> https://mck.jfrog.io/artifactory/api/npm/auth/ npm config set _auth=<from last response>Validate that your NPM is configured by viewing the .npmrc file found in your home directory
${HOME}/.npmrc
Step 10 Gradle Setup
- Set up your environment variables. Builds should be executed with the Gradle wrapper (https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:using_wrapper)
- You will need to setup Gradle to use the internal McKesson registry similar to how we did for NPM.
- Create empty init.gradle and gradle.properties in your HOME/.gradle/ folder to ease setup across repositories
- Update the empty gradle.properties with your McKesson email and API Key from JFrog (see example below)
- Update the empty init.gradle with what's in the example below as is
$HOME/.gradle/gradle.properties
[email protected]
systemProp.artifactory-password= ** key from Artifactory Setup step 6 **$HOME/.gradle/init.gradle
allprojects {
repositories {
maven {
url 'https://mck.jfrog.io/artifactory/cxp'
credentials {
username = System.properties['artifactory-username']
password = System.properties['artifactory-password']
}
}
maven {
url 'https://mck.jfrog.io/artifactory/cxp-common-local/'
credentials {
username = System.properties['artifactory-username']
password = System.properties['artifactory-password']
}
}
maven {
url 'https://mck.jfrog.io/artifactory/common/'
credentials {
username = System.properties['artifactory-username']
password = System.properties['artifactory-password']
}
}
maven {
url 'https://mck.jfrog.io/artifactory/cxp-data-analytics-gradle-local/'
credentials {
username = System.properties['artifactory-username']
password = System.properties['artifactory-password']
}
}
}
}
ext._ver = gradle.gradleVersion.substring(0, gradle.gradleVersion.indexOf('.'))
ext._majorVersion = ext._ver.isInteger() ? ext._ver.toInteger() : 0
if (ext._majorVersion < 5) {
println 'Gradle version ' + ext._majorVersion + '.X.Y - no support for mck-gradle plugin!'
}
else {
settingsEvaluated { settings ->
settings.pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'com.mckesson.mck-gradle') {
useModule("com.mckesson.plugin:mck-gradle:${requested.version}")
}
}
}
repositories {
maven {
url 'https://mck.jfrog.io/artifactory/common'
credentials {
username = System.properties['artifactory-username']
password = System.properties['artifactory-password']
}
}
gradlePluginPortal()
}
}
}
}STEP 11a Set up your environment variables in order to run
# This value is availabe from the team, reach out to them
export ENCRYPT_KEY=''
# This folder will be different for everyone
export ERA_CODE_FOLDER='/Users/rhervey/rt/rtWorkbox/gitLocal/era'
export SPRING_PROFILES_ACTIVE=local
export SPRING_CLOUD_CONFIG_USERNAME=user
export SPRING_CLOUD_CONFIG_PORT=8888
# This value is available from the team, reach out to them
export SPRING_CLOUD_CONFIG_PASSWORD=''
export SPRING_CLOUD_CONFIG_SERVER_GIT_URI="${ERA_CODE_FOLDER}/rna-config"Step 11b Running the Config Server
Open Teriminal or IDE for "${ERA_CODE_FOLDER}/z_archive_com.mckesson.ms.config-server" and run follwing cmd
./gradlew bootRun \
-Dapp.encrypt.key=${ENCRYPT_KEY} \
-Dapp.spring.security.user.name=${SPRING_CLOUD_CONFIG_USERNAME} \
-Dapp.spring.security.user.password=${SPRING_CLOUD_CONFIG_PASSWORD} \
-Dapp.spring.cloud.config.server.git.uri=${SPRING_CLOUD_CONFIG_SERVER_GIT_URI}NOTE:(reach out to a developer for values) Additionally, currently the config server uses a different version of Java. If you are using Windows and don't have JENV try using a command like this (your JDK and file paths will need to be personalized to your machine):
JAVA_HOME="C:/Program Files/Java/jdk1.8" ./gradlew bootRun \
-Dapp.encrypt.key=${ENCRYPT_KEY} \
-Dapp.spring.security.user.name=${SPRING_CLOUD_CONFIG_USERNAME} \
-Dapp.spring.security.user.password=${SPRING_CLOUD_CONFIG_PASSWORD} \
-Dapp.spring.cloud.config.server.git.uri=${SPRING_CLOUD_CONFIG_SERVER_GIT_URI} \
-Dapp.server.port="8888"Step 12 Running the ERA app
Open the Project in IDE and wait for dependecy download then do a bootRun
- Run in the terminal
./gradlew bootRun
NOTE: If you see below logs then Login at http://localhost:8080/
2022-03-14 14:09:56,986 INFO [main] waa [] [] [] com.mckesson.app.Application : Started Application in 23.244 seconds (JVM running for 23.893)
2022-03-14 14:09:57,023 INFO [main] waa [] [] [] mckesson.config : Ready to Go!!END OF SETUP HAPPY CODING.......
