Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend config.js inside the container #1051

Open
ZakarFin opened this issue Mar 20, 2024 · 9 comments
Open

Frontend config.js inside the container #1051

ZakarFin opened this issue Mar 20, 2024 · 9 comments
Assignees
Labels
deployment This issue is about the deployment of the Docker image, WAR file or operational environment

Comments

@ZakarFin
Copy link

ZakarFin commented Mar 20, 2024

I'm trying to setup the docker container that has been uploaded to GitHub packages as is, but it seems only works if run on localhost. The ui.zip in both 2024.0.0 and 2024.0.1 has this config.js file included validator\js\config.js that points to http://localhost:8090. I can't find any configuration option to override this and it basically means that when the user clicks the "Start test" button on Test selection page OR accesses the Test reports page the browser tries to call the localhost instead of the service that the page is shown from. Also I can't find the repository that hosts this ui.zip (it's only included in the release version package as binary zip-file?)

validator/js/config.js has this:

var serverURL = "http://localhost:8090/validator/v2/";
var serverRealURL = "http://localhost:8090/validator/v2/";
var serverDirectURL = "http://localhost:8090/validator/v2/";
var serverCaptchaURL = "http://localhost:8090/validator/captcha/verify";
var swaggerURL = "http://localhost:8090/validator/swagger-ui.html"

A simple solution would be to only include the path, not the server/domain part so the frontend would call the service that it's hosted on:

var serverURL = "/validator/v2/";
var serverRealURL = "/validator/v2/";
var serverDirectURL = "/validator/v2/";
var serverCaptchaURL = "/validator/captcha/verify";
var swaggerURL = "/validator/swagger-ui.html"

What is your take on the container that is hosted on https://github.com/INSPIRE-MIF/helpdesk-validator/pkgs/container/helpdesk-validator%2Finspire-validator? Should it not be used as is, but users should create their own dockerfile/with their own UI.zip instead? Or am I missing something that would let me specify the domain the service is running in?

image

@fabiovinci fabiovinci added the deployment This issue is about the deployment of the Docker image, WAR file or operational environment label Mar 20, 2024
@ZakarFin
Copy link
Author

Any updates for this one? If this won't be changed we will have to build our own version of the container.

@lindsejs
Copy link

lindsejs commented Apr 23, 2024

yes, this is frustrating, I am building my own image with dockerfile:

FROM ghcr.io/inspire-mif/helpdesk-validator/inspire-validator:2024.0.1

# change /docker-entrypoint.sh file:
# add line to update UI JS config from env variable

RUN sed -i "s|# Download Webapp|sed -i 's}http://localhost:8090}'\"\$HOSTNAME_IN_JS_CONFIG\"'}g' /etf/validator/js/config.js \n\n # Download Webapp|g" /docker-entrypoint.sh

And passing env variable in docker-compose:

validator:
    build:
      context: ./
      dockerfile: ./docker/validator.dockerfile
    environment:
      - HOSTNAME_IN_JS_CONFIG=http://localhost:8070
    ports:
      - "8070:8090"

@DanielMartinPerezdeLeon
Copy link
Collaborator

Dear @ZakarFin,

Apologies for the delay in getting back to you. In order to host the validator in a non-local environment, it's essential to include the complete endpoint of the validator in the config.js file. For instance, in the production environment, we utilize https://inspire.ec.europa.eu/validator/v2/.

Regarding the URL of the UI repository, you can find it here: https://github.com/inspire-eu-validation/INSPIRE-Validator-UI.

If you have any further questions or encounter any issues, please don't hesitate to reach out.

Best regards,

@ZakarFin
Copy link
Author

ZakarFin commented Apr 24, 2024

Hi @DanielMartinPerezdeLeon,

Thanks for the answer. So this basically means that the image cannot be used as is even with configuration and making your own version is always required. Any chance on making this configurable?

Can you point to something specific that breaks if I use config.js without the domain part? It seems to work just fine on my instance without the domain part, but I might be missing something. What should I expect to not work if the domain is not included?

Thanks!

@jenriquesoriano jenriquesoriano added user-to-fix Problem is present on user side and removed under analysis user-to-fix Problem is present on user side labels Apr 24, 2024
@jenriquesoriano
Copy link
Collaborator

Dear @ZakarFin ,

in case you are configuring a specific deployment, you can do it following the instructions provided in the release notes.

The Docker image is set up to run at localhost to be deployed on any machine. However, users may need to access their validator on a dedicated host, usually with a domain name. For proper functioning of the validator, the UI and correct rendering of Test Reports, the validator needs to be configured to run on a domain.

If you want to run the webapp in another host, you can change the configuration file, inside the .war file inside the inspire-validator zip file accompanying this release, at WEB-INF/classes/etf-config.properties, and modify the etf.webapp.base.url property.
It is also necessary to configure the Validator UI properties in order to properly point to the ETF. Thus, it is necessary to modify the configuration values in the /validator/js/config.js file inside the ui.zip (to point to the corresponding host domain).
Then you can proceed to the build process described in the previous point.

Please note this involves not only the UI configuration but also the validation endpoint to be requested from the UI.

Best regards,

@HaVRane
Copy link

HaVRane commented Sep 16, 2024

Pushing this question again, it is still tagged as an Open case and this is an issue for us in the coming validation cycle.
We would very much like to run an on prem validator in a proper production environment. Running this type of software on a (non IT) users local machine with Docker etc is not standard at our agency.
The solution here to build the software again does also not go according to guidelines, and it also seems like a big overkill when we are talking of such a thing as avoiding a hardcoded path to localhost!
Any possibility of this being fixed in a release soon, otherwise the option here might be not to host at all, unfortunately.

@ZakarFin
Copy link
Author

We worked around this for now by exposing the 8080 port from the container. It exposes the older UI that also has some localhost-referencing problems, but generally works for validations.

@HaVRane
Copy link

HaVRane commented Sep 27, 2024

There is a note from "last month" that the issue is "moved this to":
To do in Validator issues last month"
Does that mean that this is scheduled to be taken care of in the near time. We still very much want to know since this has implications on our plan for this years inspire validation just coming up!!

@HaVRane
Copy link

HaVRane commented Oct 2, 2024

See also case #1113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment This issue is about the deployment of the Docker image, WAR file or operational environment
Projects
Status: To do
Development

No branches or pull requests

6 participants