Openmrs 3.0 windows spa module setup

Hi,

I have been trying to setup Openmrs 3.0 spa to run alongside v2. The guide states that i should drop my OpenMRS Frontend 3.0 application files into the frontend subdirectory of the OpenMRS server’s [application data directory]. I have dropped the content of the dist file generated from building ’ GitHub - openmrs/openmrs-module-spa: The OpenMRS Java module that allows Tomcat to serve a Single-SPA’ in ‘C:\Users\minimalist\AppData\Roaming\OpenMRS\frontend’. When i run the project, the openmrs css and js files are not found . I have attached my logs here : 3.0 spa logs - Pastebin.com and an image of the console . I have updated my modules with web rest services 2.32.0, FHIR2 1.3.0 and Single Page Application 1.0.9-SNAPSHOT. I also tried adding an absolute path, or relative to the application data directory to my openmrs settings, but the error in the pastebin still persist. My server is jetty. Is there any extra configuration i should d

o ? Any tips or advise will be highly appreciated. Thanks.

1 Like

@minimalist building openmrs-module-spa doesn’t generate any dist folder. Instead, it serves frontend assets from the /frontend directory. I would to look into these two PRs (PR#48 and PR#54) get some insights on module spa serves static assets.

For now, I’m assuming you’re setting up a development environment. After installing the spa module, configure it to serve remote assets. How to achieve this? set the global property spa.remote.enabled value: true , it will serve assets from spa.remote.url value: https://spa-modules.nyc3.digitaloceanspaces.com/@openmrs/esm-app-shell/latest/dist/ (If/when serving local assets(local/application dir); these are the assets you’re required to provide in your frontend directory after building openmrs-esm-core, just use the default - relative path frontend ~ application dir). Hopefully that might unblock you.

1 Like

I didn’t realise this feature existed!

We’ve done a poor job documenting it. Quite a helpful feature! With the plans to depreciate the openmrs spa environment, does the depreciation includes not publishing assets(dist - currently serve by OpenMRS) to CDN Digital Oceans spaces?

Thnak you for your response. There is something i still don’t understand After installing the spa module, configure it to serve remote assets. . In this repo, the spa directory is inside ‘openmrs-module-spa/omod/src/main/java/org/openmrs/module/spa’ and i cant run npm install in there. Does the statement mean that i should run npm/yarn install in the GitHub - openmrs/openmrs-esm-core: The core modules of the OpenMRS Frontend system directory ?

Forget abt this readMe documentation, it’s outdated. I will try to update this. Configure it using the legacy UI (refapp)

No… we don’t have a good CDN replacement, so the plan is to continue using the Digital Ocean CDN at least for resources for the dev system (at the very least, I don’t want to have to change the ESM CI builds).

I need to give some thought to this, because I couldn’t understand why the import map didn’t include the apps from esm-core, but that makes it clear what’s going on…

Go to refapp UI, then navigate to system administration, then manage global properties

Search for spa.remote.enabled, change it to true, make sure spa.remote.url points to https://spa-modules.nyc3.digitaloceanspaces.com/@openmrs/esm-app-shell/latest/dist/

2 Likes