PharmaLedger-IMI / ctr-workspace

UC8 Clinical Trials Recruitment
MIT License
2 stars 0 forks source link

homepage integration #92

Closed joaoluis-pdm closed 2 years ago

joaoluis-pdm commented 2 years ago

Homepage integration into the DEV and TST environments.

joaoluis-pdm commented 2 years ago

Looking at answer to question 2, there seems to be no way to keep all the site files URL under a static prefix like "/homepage" (ex: /homepage/index.html, /homepage/logo.png, etc...), so we will have use 2 "DNS" domain names and develop something in task 2 below.

I would suggest the following tasks (for discussion, or just go ahead and do-it if you agree with everything):

1 - (for Prateek) If all the files are cleared for public sharing, please checkout the master branch of

https://github.com/PharmaLedger-IMI/ctr-workspace

and create a new top-level folder inside, named ctr-homepage/doc-root *1 put the site files inside, and push it into master (at any time).

(I've created issue https://github.com/PharmaLedger-IMI/ctr-workspace/issues/92 for these tasks. Please start the commit coment with "#92 - ... etc" for automatic code<->issue linkage).

2 - (for Prateek + PDM, after step 1) Figure out a way to redirect from

Sponsors: /sponsors.html - add some on-page-load JS code to figure out base domain name, and
If it starts with ctr., redirect to https://ctrapi.pharmaledger.pdmfc.com/backoffice/dashboard?type=SponsorUser&v=0.11.0
If it is ctr-dev., redirect to https://ctrapi-dev.pharmaledger.pdmfc.com/backoffice/dashboard?type=SponsorUser&v=0.11.0
If it is localhost, redirect to https://localhost:4200/backoffice/dashboard?type=SponsorUser&v=0.11.0
If JS is disabled, say the user needs to enable JS.
Similar for patient, physicians, and clinical site sites.

(Version numbers will be handled in another task...)

3 - (for PDM) Meanwhile step 2 is ongoing, PDM will write the docker scripts and reverse-proxy configuration to deploy the site at https://ctr.pharmaledger.pdmfc.com and https://ctr-dev.pharmalegder.pdmfc.com)

The old landing page will probably be renamed to something like https://ctrapi.pharmaledger.pdmfc.com (and ctrapi-dev) and will remain a technical page (for those who know this technical URL).

(Manual deployment triggered by PDM for the time being).

4 - (for PDM) find a way to automate version deployments of both sites and replace URL version numbers automatically.

This task will be done later (+/- on between-tasks time), but the general idea, is that, as soon as anyone pushes anything into the master branch under ctr-homepage, a few minutes after (15min to 60min... to tune, while letting manual trigger to occur - on the CI/CD site on jenkins.pharmaledger.pdmfc.com) it will be deployed to https://ctr-dev.pharmalegder.pdmfc.com automatically.

Deployment to TeST environment will still be manually triggered by PDM.

(The automatition of replacing version numbers will come even later on...)

*1 - This is name is a suggestion entirely open for discussion. Why a "doc-root" sub-folder ? Because I still need to add a ctr-homepage/docker/ folder with some scripts (to build a docker apache httpd 2.4.x container) inside, and doc-root seems a clear to indicate that it is the "document root" of the site.

If you prefer, we can ask RomSoft to create a separate Pharmaledger-IMI repo just for the homepage's files, and I would add an octopus.json dependency + actions to download and copy it, (but I would try to keep the # of repos to a minimum).

Prateek-Pfizer commented 2 years ago

@joaoluis-pdm

  1. Added a new folder and committed the code there
  2. Have added the links with ../ which should help to redirect correctly

Let me know any help needed

joaoluis-pdm commented 2 years ago

Hello @Prateek-Pfizer !

For the moment I've merged the contents of ctr-homepage into ctr-patient/apihub-root/ during the deploy script.

(This is not what I wrote in the plan. What I wrote was that there would be a separate site/domain for this homepage, but this will not be ready before next business meeting on Tuesdays, so I will show it as it is now. Then I will ask business if we have a "go" to swap the old homepage by a new one, and put the old one somewhere else ).

You can see the result at https://ctr-dev.pharmaledger.pdmfc.com/ and you have to click the 1st green button named "Landing Page" (I will rename it to Home Page" on the next fix) to see the page.

For the moment, the clinical sites URL is broken

https://ctr-dev.pharmaledger.pdmfc.com/doc-root/clinical%20sites.html

I believe that this web-server (the apihub) does not support filenames with spaces on it properly.

Can I rename the page from "clinical sites.html" to "clinical_sites.html" ? Or do you rather do it ? (I think I can do it without any problem, Just taking the ocasion to ask who will do the future minor changes...)

Prateek-Pfizer commented 2 years ago

Hi @joaoluis-pdm, I renamed the clinical sites page and its references. If you are planning for another domain, let me know if you need my help, I can update the links.

joaoluis-pdm commented 2 years ago

Thank @Prateek-Pfizer !

New version deployed at https://ctr-dev.pharmaledger.pdmfc.com/

I've changed our ha-proxy configuration (for my own notes)

        acl ctr-dev hdr(host) -i ctr-dev.pharmaledger.pdmfc.com
        acl ctr-is-root path /
        #92 root / redirected to /doc-root/
        http-request redirect code 301 location https://ctr-dev.pharmaledger.pdmfc.com/doc-root/index.html if ctr-dev ctr-is-root

so that every visitor to https://ctr-dev.pharmaledger.pdmfc.com/ is immediately redirected https://ctr-dev.pharmaledger.pdmfc.com/doc-root/index.html

The old homepage is still there to someone that accesses https://ctr-dev.pharmaledger.pdmfc.com/index.html explicitly.

I am thinking on keeping this until next Tuesday (business meeting) for business demo.

If we think it is ok like this, then I may ask you (afterwards) to rename/move the ctr-homepage/assets/ into ctr-homepage/doc-root/assets/ to avoid possible conflicts with existing ctr-patient/apihub-root/assets/ (but that is not urgent, as there are no conflicts now).

If we find that this is not ok for a test-pilot, then I will probably have to setup a separate deployment container for the site, and decide if it stays on distinct web domain (or just a distinct path prefix). (Keeping the other links as ../ is very handy).

PS: You can tell anyone to go an check the site. (I will wait until Tuesday).

joaoluis-pdm commented 2 years ago

Along with deploy of v0.11.5 , add default homepage redirect to TST.

        acl ctr-tst hdr(host) -i ctr.pharmaledger.pdmfc.com
        acl ctr-dev hdr(host) -i ctr-dev.pharmaledger.pdmfc.com
        acl ctr-is-root path /
        #92 root / redirected to /doc-root/
        http-request redirect code 301 location https://ctr-dev.pharmaledger.pdmfc.com/doc-root/index.html if ctr-dev ctr-is-root
        http-request redirect code 301 location https://ctr.pharmaledger.pdmfc.com/doc-root/index.html if ctr-tst ctr-is-root