Closed fishfree closed 5 months ago
Heya! The url comes from a setting in the corpus-frontend.properties
config file.
The server exports it as BLS_URLon the html pages.
Here's how to change it:
corpus-frontend.properties
on the server. Example file: https://github.com/inl/corpus-frontend?tab=readme-ov-file#Backend-configurationCORPUS_FRONTEND_CONFIG_DIR
and set it to the directory of the file. If you use the default locations in the example you can skip this step. E.g. /etc/corpus-frontend
blsUrlExternal
and blsUrl
to the blacklab server e.g. https://my-blacklab-server.local:8080/blacklab-server
@KCMertens Thank you! The corpus-frontend.properties
config file is used by docker-deployment way. But I doubt if the ***.properties file will be ignored by pure frontend package command npm install && npm run build
?
Oh, I think I misunderstood your question. You can't deploy the frontend and backend separately at the moment. The java backend creates the initial html page, and it's responsible in a large part for rendering documents. It also serves the .js/.css files, etc.
Quite a bit of work would be needed to completely split the frontend and backend, and I don't think it's worth it at the moment. Main sticking points are that search.xml would need to become a json file the frontend uses, and xslt transformations would need to be ported from saxon-java to saxon-js in the browser.
Just to add to this: if you're using the Dockerfile supplied with this repo: that's derived from the BlackLab image, so it combines everything together: the BlackLab webservice and the frontend (which itself contains a Java backend and a Vue-based frontend, but these are combined into a single .war file).
I think this makes sense because webservice and frontend are both just Tomcat .war applications. Another advantage is that, once you've built this image (or use a publicly available one), you can't accidentally use incompatible versions of the webservice and frontend.
Of course, nothing is stopping you from writing your own Dockerfile for the frontend. You'd run the BlackLab webservice in its own image and the frontend in the image built from your Dockerfile (based on the Tomcat base image, not the BlackLab image like now). That way you're free to deploy the webservice and frontend to different servers if you want to. If you do this, you'll need @KCMertens's original advice about configuring the blsUrl
in corpus-frontend.properties
.
Thank you both! @jan-niestadt If I try to deploy tge decoupled way, where to modify the BLS_URL variable value even hard-coded way in the Vuejs app?
You can't. The page is not static html, so you can't decouple it from the java code easily.
I'm not sure exactly what you mean when you say "deploy the decoupled way".
The frontend is a combination of Vue.js and Java which are not easily separated like @KCMertens says. If I understand correctly, if you configure blsUrl
in corpus-frontend.properties
, BLS_URL
will be set correctly in the page as well.
The frontend and BlackLab can be decoupled, that is, deployed separately, as I described above.
@jan-niestadt I mean how to inject the BLS_URL environment variable into the Vue.js frontend app? It was injected by the Tomcat or other Web server. Now If I deploy it the decoupled way, how to inject BLS_URL?
BLS_URL
is automatically set to the same value as blsUrl
in corpus-frontend.properties
. Did you try that?
I'd like to deploy this great repo the decoupled way: this Vuejs frontend app in server A, and the Java Blacklab backend server in server B.
Is it possible? If so, where to modfiy the Blacklab server URL? I searched nowhere to configure in the Vuejs codes: https://github.com/search?q=repo%3AINL%2Fcorpus-frontend%20localhost&type=code