-
Notifications
You must be signed in to change notification settings - Fork 122
Tips for Running the Shimmer Project
After installing the latest version of Docker, change the General Setting as below:
Click the "setting" button, then select General and unchecked "Use Docker Compose V2".
When starting the containers using docker-compose up -d resourceserver or docker-compose up -d, ensure the Docker is running.
Currently, we only use Fitbit and HealthKit (Apple) services. Please ask lab members to get a set of client credentials (OAuth client ID and client secret). Once you obtain credentials for Fitbit API, set the corresponding values in the resource-server.env file.
1 #OPENMHEALTH_SHIMMER_DATA_PROVIDER_REDIRECT_BASE_URL=http://localhost:8083
2 #OPENMHEALTH_SHIMMER_CLIENT_REDIRECT_URL=http://localhost:3200/callback
3 #OPENMHEALTH_SHIM_FITBIT_CLIENT_ID=set-value-here
4 #OPENMHEALTH_SHIM_FITBIT_CLIENT_SECRET=set-value-here
5 #OPENMHEALTH_SHIM_FITBIT_INTRADAY_DATA_AVAILABLE=false
6 #OPENMHEALTH_SHIM_FITBIT_INTRADAY_DATA_GRANULARITY_IN_MINUTES=1
Please register your postman account first. If you want to run the desktop version, please use Chrome.
Add a new environment by clicking the button at the top-right of the postman console. Then click the "Import" button, select "postman-environment.json" and import the JSON file.
Import the collection by clicking the "Import" button. Then select "postman-collection.json" and import the JSON file.
-
Please select “shimmer (development)” and set shim-key to “fitbit”.
-
Run the following URL: http://localhost:8083/authorize/fitbit?username=user1, with the GET request.
-
Click “Send”; however, if an error shows as follows, please follow step 4. If no error exists, please jump to step 9.
"message": "org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang. RuntimeException: A configuration for shim 'fitbit' wasn't found."
-
Run ./gradlew build in the terminal. If it is failing, please follow steps 5 and 6. If no error exists, please jump to step 7.
-
Java Version Issue
JDK 11 is not supported by Gradle 4, so we need to install a different version of JDK (recommend JDK 8, which has the most support). Then run java -version in the terminal to check the current Java version. Here is the the second way to download; however, you need to register an account.
-
Could not find tools.jar issue
Error: Execution failed for task ':java-shim-sdk:compileJava'
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
Solution:
-
Run echo $JAVA_HOME in the terminal.
-
If it returns nothing, run vim .zshrc in the terminal, add the content as follows:
export JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk1.8.0_311.jdk/Contents/Home'
export PATH=$JAVA_HOME/bin:$PATH
-
After editing, run source .zshrc in the terminal to reload ash, then run echo $JAVA_HOME, and it should return an URL.
-
Run ./gradlew build in the terminal.
-
-
Run docker-compose -f docker-compose-build.yml build in the terminal.
Error: failed to compute cache key: "/assets" not found: not found
[2/3] COPY assets /usr/local/Cellar/nginx/1.21.3/html: ------ failed to compute cache key: "/assets" not found: not found ERROR: Service 'console' failed to build : Build failed
Solution:
-
We need to find and update the correct path for the html folder. For example, in the MacBook, reset the path to /usr/local/Cellar/nginx/1.21.3/html.
-
Since the assets folder does not exist, we need to manually build an empty assets folder under shim-server/shim-server-ui/docker.
-
Delete node_modules folder and package-lock.json file manually from the shimmer project.
-
Open a new terminal from the folder shim-server-ui, then walk through the following steps:
- sudo npm install -g yarn (If the yarn package does not exist.)
- yarn (To check the current version of the yarn package.)
- yarn global add bower
- bower --version
- bower install
- In package.json file, change "grunt-google-cdn": "^0.4.3" to "grunt-google-cdn": "0.3.0". Also please check other details the in the package.json.
- yarn add [email protected]
- grunt build
- After step 8, the assets folder should be built, and it will contain images, scripts, styles, .etc. Then rerun docker-compose -f docker-compose-build.yml build.
-
-
Run docker-compose -f docker-compose-build.yml up -d in the terminal.
Please note we might need to update the Dockerfile (shim-server/shim-server-ui/docker/Dockerfile) in the shimmer project. We need to find and update the correct path for nginx.conf. For example, in the MacBook, the path is /usr/local/etc/nginx/nginx.conf
-
Find the authorizationUrl value in the returned JSON response and redirect your user to this URL. Your user will land on the third-party website where they can login and authorize access to their third-party user account.