-
Notifications
You must be signed in to change notification settings - Fork 0
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
Updated build process #101
Conversation
Updated accessibility statement to reflect the adjusted release dates for both the expected Qonsole update and preparation timestamp alongside the removal of the deadlines for test revisions. Also includes minor copy changes to resolve typos/punctuation issues.
While waiting for the approved translation for the latest update I've updated the copy to improve various characters to be safer to use online.
As provided by the client's translations as requested
Updated to reflect date of latest changes
Refactored the single quotes, apostrophes, and em-dashes to use the appropriate html entity codes to ensure the presentation of the character was maintained due to differences in language use
Wrapped the appropriate html examples within both a `<code>` wrapper for screen-readability as well as removed erroneous back tick characters
Refactored to contain information inside an `<article>` element instead of duplicating the `<main>` element and ID from the template
…statement-update HMLR Accessibility Statement Updates
Resolved incorrect traps for missing env vars in `entrypoint.sh`, added updated commands for `Dockerfile`, as well as added new `SHORTNAME` variable to `Makefile`.
Implements unification approach to Make, Docker and other associated build files to ensure the process completes for specific environments as expected
Updated the matching configuration settings on each environment configuration file to uniify the settings for all apps
re-added `config.welsh_language_enabled = true`, the feature flag for showing the Welsh language switch affordance
minor addition of live links for the different apps alongside primarily formatting changes for layout
entrypoint.sh
Outdated
@@ -28,8 +24,8 @@ then | |||
fi | |||
|
|||
export RAILS_RELATIVE_URL_ROOT=${APPLICATION_ROOT:-'/app/root'} | |||
export SCRIPT_NAME=${APPLICATION_ROOT} | |||
export SCRIPT_NAME=${RAILS_RELATIVE_URL_ROOT} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of setting SCRIPT_NAME
via this environment variable?
This can only break the system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-pickin-epi SCRIPT_NAME
is used to "[... ] have both the assets paths and path helpers configured for serving a Rails application from a subdirectory." 1
It is similar to RAILS_RELATIVE_URL_ROOT
in that "[...] SCRIPT_NAME
isn't available during the asset compilation task so config.relative_url_root needs to be set so that it knows where they will be served from by the webserver. This is especially important for Sass since the asset helpers like image-url, etc. will generate absolute urls." 2
I don't follow how this can break the system though and we went through all this together?
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can break the system is RAILS_RELATIVE_URL_ROOT
different at run-time from what it's set to at build-time (or if either of these is different from SCRIPT_NAME
). And this is still possible,
entrypoint.sh
Outdated
then | ||
exit 1 | ||
fi | ||
echo "{\"ts\": $(date -u +%FT%T.%3NZ), \"level\": \"INFO\", \"message\": \"Initiating ${PUBLIC_NAME} application using APPLICATION_ROOT=${APPLICATION_ROOT}, API_SERVICE_URL=${API_SERVICE_URL}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
APPLICATION_ROOT
is stale here.
API_SERVICE is redundant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This echo was created as a verification flag for the build process and, while I agree and will remove the APPLICATION_ROOT
variable, having the API_SERVICE_URL
is good to know at this point in case you're needing to validate any local configuration being passed in at invocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-pickin-epi Upon further reflection I've not removed the APPLICATION_ROOT
from the application as it does allow us to pass in a temporary value, like /
, when trying to get things running locally.
I would like to say I think this makes the app more robust when developing locally even as an image as that will also match the development.rb configuration settings:
# The RAILS_RELATIVE_URL_ROOT should be set in the entrypoint.sh script via the
# build-time environment variable `APPLICATION_ROOT`; however, if this is not set
# the following fallback is passed in as a standard root value when the app is run
# directly via `rails server`
config.relative_url_root = ENV.fetch('RAILS_RELATIVE_URL_ROOT', '/')
Therefore the echo above will allow us to verify the expected value is being used when creating and/or running the image.
N.B. Please forgive me if I've gotten my build-time
v. run-time
variables mixed up nonetheless! 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't make it more robust.
If it's possible to set the variable differnetly at build time and run time the it can break,
IF you want to have two setups to run with the without a path then define different environment files.
Further this IS a function of rails or at least rake. So No APPLICAITON_ROOT makes no sense at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-pickin-epi while trying to resolve the proxy configuration mentioned previously via further investigation of the older versions of this application, and therefore also the other LR app configurations, we seem to have gotten things slightly muddled up in our approach.
While I appreciate your guidance throughout these updates, and a lot of good choices were made, I would like to revert the RAILS_RELATIVE_URL_ROOT
run-time variables to it's previous configuration based on my findings; let me explain.
Back in January we discussed and agreed that the naming of the variables being passed around during the build process, specifically RAILS_RELATIVE_URL_ROOT
, was misleading in its use in the build files. We decided then to rename that specific variable to APPLICATION_PATH
APPLICATION_ROOT
to be more clear on its purpose.
I, in my Rails naivety, misunderstood the use for that specific name and changed all instances of the RAILS/Rake variable used across the application as well.
@der kindly highlighted my error to which I revised the renamed variable to only be the ones used in the build files, to which you then updated the validation methods you felt were appropriate in the entrypoint.sh
file.
Upon further investigation, and in order to improve the quality of the codebase for the new infrastructure, we revised those validation flags together whilst also realising that the run-time value would work if the variable was "locked" to the expected /app/root
path value in the rails production configuration file. We then cleaned up those validations to only check for the API_SERVICE_URL
where applicable (funny enough, not in this application).
The Makefile configuration was also refactored as we realised the value being passed in during the precompile phase was being overwritten by the run-time locked value and therefore unnecessary.
While investigating the original configuration of the build files [52, 72, 79] to sort out the proxy I've come to the conclusion that APPLICATION_ROOT
, and subsequently RAILS_RELATIVE_URL_ROOT
, should be available to the build process on ALL environments because if you're trying to run the docker image locally without having the proxy running you cannot see the styles, scripting, etc. if you can't change the RAILS_RELATIVE_URL_ROOT
value; and if you try to run the rails server outside of docker in production mode to use the locked value, it won't build because the RAILS_SECRET
isn't available.
Could we please discuss this together to agree on an approach that will allow for the most application resilience while still allowing for all of the environments to be run, tested, and validated both inside and out of docker images?
PS. I'm not averse to introducing specific environment files as suggested if that's the best way forward?
entrypoint.sh
Outdated
|
||
echo '{"ts": "'"$(date -u +%FT%T.%3NZ)"'", "level": "INFO", "message": "Starting LR Landing application with RAILS_ENV='"${RAILS_ENV}"'", "RAILS_RELATIVE_URL_ROOT"="'"${RAILS_RELATIVE_URL_ROOT}"'", "SCRIPT_NAME"="'"${SCRIPT_NAME}"'", "API_SERVICE_URL"="'"${API_SERVICE_URL}"'"}' | ||
echo "{\"ts\": $(date -u +%FT%T.%3NZ), \"level\": \"INFO\", \"message\": \"Starting ${PUBLIC_NAME} application with RAILS_ENV=\"${RAILS_ENV}\", \"RAILS_RELATIVE_URL_ROOT\"=\"${RAILS_RELATIVE_URL_ROOT}\", \"SCRIPT_NAME\"=\"${SCRIPT_NAME}\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is PUBLIC_NAME
?
RAILS_RELATIVE_URL_ROOT
and SCRIPT_NAME
should not be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PUBLIC_NAME
is set on line 9 (to LR Landing) presumably to give one place to change a bit of text that's embedded in two locations.
Not understanding the objection to logging the value of RAILS_RELATIVE_URL_ROOT
to aid debugging but agreed that SCRIPT_NAME
is redundant given how it's being set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added PUBLIC_NAME
to allow better code portability and is similar to SHORTNAME
in the Makefile; which is used to flag which app is being initiated.
Again, the echo itself was another verification flag for the build process and should be left as is.
I could wrap this in a check for RAILS_ENV
being development
if that helps?
We use a number of environment variables to determine the runtime behaviour of | ||
the application: | ||
We can use a number of environment variables to determine the runtime behaviour | ||
of the application while developing the codebase locally: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Env var table needs re-write.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm working on unpicking the comments and threads found on epimorphics/hmlr-linked-data#52 in order to resolve epimorphics/hmlr-linked-data#79 and your comment.
README.md
Outdated
|
||
With the proxy and Docker container running you can access the application as | ||
[`localhost:3001/app/root/`](http://localhost:3001/app/root/) | ||
(note the trailing path). | ||
[`localhost:3001/app/root/`](http://localhost:3001/app/root/) (note the trailing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is inconsistent with ports in production.
Move proxy from 3001.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I used localhost:3030
in my changes which I will push up in a new PR for the simple web proxy repository and update accordingly where needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reconsidered this. I think the proxy should listen on 8080.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue with using 8080
is that's the API port: http://localhost:8080
set in the API_SERVICE_URL
default value?
Mind you I only went with 3030
as it was still in the 3k range but we could choose something that works for all the different endpoints?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't really comment the SCRIPT_NAME
discussion. Have attempted to understand where that might be used without success. If it's not actually needed then better to get rid of it but if testing shows it is need then so be it.
Once that's resolved then happy for this to merge.
entrypoint.sh
Outdated
|
||
echo '{"ts": "'"$(date -u +%FT%T.%3NZ)"'", "level": "INFO", "message": "Starting LR Landing application with RAILS_ENV='"${RAILS_ENV}"'", "RAILS_RELATIVE_URL_ROOT"="'"${RAILS_RELATIVE_URL_ROOT}"'", "SCRIPT_NAME"="'"${SCRIPT_NAME}"'", "API_SERVICE_URL"="'"${API_SERVICE_URL}"'"}' | ||
echo "{\"ts\": $(date -u +%FT%T.%3NZ), \"level\": \"INFO\", \"message\": \"Starting ${PUBLIC_NAME} application with RAILS_ENV=\"${RAILS_ENV}\", \"RAILS_RELATIVE_URL_ROOT\"=\"${RAILS_RELATIVE_URL_ROOT}\", \"SCRIPT_NAME\"=\"${SCRIPT_NAME}\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PUBLIC_NAME
is set on line 9 (to LR Landing) presumably to give one place to change a bit of text that's embedded in two locations.
Not understanding the objection to logging the value of RAILS_RELATIVE_URL_ROOT
to aid debugging but agreed that SCRIPT_NAME
is redundant given how it's being set.
Reorganised and adjusted content to be clearer for local development
Brings the latest accessibility changes from the dev branch into the current updates
Brings the latest CHANGELOG changes from the dev branch in the correct order of release.
…esolve-failed-build
Updated to handle locking the root path for individual environments as well as removing unnecessary environment variables
Rewritten to reflect the latest approach for both local and dockerised invocations of the application. Recorded summaries of changes for future reference.
…esolve-failed-build
also includes adjusted comment on Dockerfile
Specific to Epimorphics internal gems
|
||
[ -n "${RAILS_RELATIVE_URL_ROOT}" ] && echo "{\"ts\":\"$(date -u +%FT%T.%3NZ)\",\"level\":\"INFO\",\"message\":\"RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT}\"}" | ||
[ -n "$RAILS_RELATIVE_URL_ROOT" ] && echo "{\"ts\":\"$(date -u +%FT%T.%3NZ)\",\"level\":\"INFO\",\"message\":\"RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT}\"}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does landing work with RAIL_RELATIVE_URL_ROOT work with anything but '/'.
Is this machinery and log entry relevant for Landing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrew-pickin-epi this was felt to be logical and safe if a RAILS_RELATIVE_URL_ROOT value was passed in we would report the non-default value
Removed `${HOME}/` from path
|
||
```sh | ||
rails server -e production -p <port> -b 0.0.0.0 | ||
API_SERVICE_URL=http://localhost:8888 rails server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you referencing API_SERVICE_URL in this repository when it's not used here.
Further the, where it is being used we should attempt to use the internal docker name as reference in the Makefile, unless there is a reason to used something else when attempting to set up some alternative routing, in which case the purpose of the alternative should be made clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andy, when you're running locally in Rails and you want to test Qonsole then you need to pass in the API_SERVICE_URL or else Qonsole doesn't have the api access needed as per the comment above states.
README.md
Outdated
|
||
- [HMLR Common Styles](https://github.com/epimorphics/lr_common_styles) | ||
- [PPD Explorer](https://github.com/epimorphics/ppd-explorer) | ||
- [Standard Reports UI](https://github.com/epimorphics/standard-reports-ui) | ||
- [UKHPI](https://github.com/epimorphics/ukhpi) | ||
- [Qonsole (Rails)](https://github.com/epimorphics/qonsole-rails) | ||
|
||
## Production Mode | ||
## Developer notes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a section here call ed "Developer notes" but the contents are not just for a audience of developers, this is a bad choice of title
Resolved incorrect traps for missing env vars in
entrypoint.sh
, added updated commands forDockerfile
, as well as added newSHORTNAME
variable toMakefile
.