Collective lift and shift updates#188
Conversation
Refactored the version cadence creation to include a SUFFIX value if provided; otherwise no SUFFIX is included in the version number.
Expands Method block length rule to allow for slightly longer method names
Following community guidance for measuring elapsed time in rails the logging mechanism has been changed to use the CPU time instead of RealTime. This also has the added benefit to return the results in the requested `microseconds` unit without further mathematical manipulation.
Refined text changes to the `Gemfile` to include instructions for running Epimorphics specific gems locally during the development of those gems. Updated the production environment gem versions to be at least the current version to cover out of sync release versions. Also includes slight reordering of specific groups of included gems for different environments.
This sets the cache control headers for HMLR apps to be public and cacheable in the production environment. Price Paid Data uses a time limit of 5 minutes (300 seconds) epimorphics/hmlr-linked-data#114
In Production no default URL values are passed on the basis that missing configuration options represent a category of bug, and in that case the deployment should fail fast and noisily. This does include a default value of `true` for the `RAILS_SERVE_STATIC_FILES` nonetheless. https://github.com/epimorphics/ijd-transfer-notes/blob/main/rails-app-pattern.md#environment-variables-and-run-time-configuration
In order to improve the ux minor tweaks have been made to the layout and formatting of the returned error message and reference code presentation.
Following lengthy internal discussions the global env variable `RAILS_RELATIVE_URL_ROOT` has been renamed to `APPLICATION_PATH` to be more clear on it's use; needs to be monitored once deployed. Also includes better guards in `entrypoint.sh` to ensure the required env vars are set accordingly or deployment will fail noisily.
Refactored the `StandardError` rescue block to use the provided status from the current exception outside of `MalformedSearchError` and `ArgumentError` types and otherwise fall back to a generic 500 status;
Refactored the error messages displayed to be semantically formatted as well as incorporated ALL lines for the returned message to be held in the variable instead of being possibly displayed outside of the intended context.
Also includes minor update to layout format for older entries
…epimorphics/ppd-explorer into spike/collective-lift-and-shift-updates
Adjusted the processing of error status to use the application template; also includes adjustments to not double render the error response. epimorphics/hmlr-linked-data#103
…updates' into spike/collective-lift-and-shift-updates
refactored the gem paths to use the remote Epimorphics repository locations, also includes the regenerated gemfile.lock reflecting as such.
Added the updated configuration for the AWS credential improvements as per other readme's; included further info to run the application locally; resolved a markdown linting issue with using HTML in markdown.
This resolves that Rails would want the `RAILS_RELATIVE_URL_ROOT` env var set, while using `APPLICATION_ROOT` is clearer in the `entrypoint.sh` code - this also updates the readme’s to reflect this change
Fixed typo for `APPLICATION_ROOT` env var
fixes variable for development environments
…updates' into spike/collective-lift-and-shift-updates
der
left a comment
There was a problem hiding this comment.
Looks fine, just one comment in line.
Implements unification approach to Make, Docker and other associated build files to ensure the image process completes as expected.
as these are not used in the app they were actually causing more issue on production images and therefore were removed.
now mirrors other app structures
`config.assets.precompile` and `config.assets.version` have moved to `config/initializers/assets.rb`
Updated the matching configuration settings on each environment configuration file to uniify the settings for all apps
Makefile
Outdated
| COMMIT=$(shell git rev-parse --short HEAD) | ||
| VERSION?=$(shell /usr/bin/env ruby -e 'require "./app/lib/version" ; puts Version::VERSION') | ||
| TAG?=$(shell printf '%s-%s-%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER}) | ||
| TAG?=$(shell printf '%s_%s_%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER}) |
There was a problem hiding this comment.
Has it been confirmed that changing the Tag format doesn't break deployment?
README.md
Outdated
| | name | description | typical value | | ||
| | -------------------------- | -------------------------------------------------------------------- | -------------------------- | | ||
| | `RAILS_RELATIVE_URL_ROOT` | The path from the server root to the application | `/app/ppd` | | ||
| | `APPLICATION_ROOT` | The path from the server root to the application | `/app/ppd` | |
There was a problem hiding this comment.
NO. This shouldn't be an environment variable unless the image has no knowledge of the path from build time. I VERY much suspect this is not the case.
What does "Typical Value" mean?
entrypoint.sh
Outdated
| fi | ||
|
|
||
| export RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT:-'/app/ppd'} | ||
| export RAILS_RELATIVE_URL_ROOT=${APPLICATION_ROOT:-'/app/ppd'} |
There was a problem hiding this comment.
No. Don't use environment variables.
entrypoint.sh
Outdated
| export SCRIPT_NAME=${RAILS_RELATIVE_URL_ROOT} | ||
|
|
||
| echo "{'ts': '`date -u +%FT%T.%3NZ`', 'message': {'text: 'Starting Standard Reports UI. API_SERVICE_URL=${API_SERVICE_URL} RAILS_ENV=${RAILS_ENV} RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT}', 'level': 'INFO'}}" | ||
| 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.
No. Don't use environment variables.
der
left a comment
There was a problem hiding this comment.
Looks fine to me apart from not understanding the point of SCRIPT_NAME.
Don't understand @andrew-pickin-epi 's concern about use of environment variable to set RAILS_RELATIVE_URL_ROOT but once that's resolved to mutual satisfaction I don't think I need to re-review so approving now.
entrypoint.sh
Outdated
|
|
||
| export RAILS_RELATIVE_URL_ROOT=${RAILS_RELATIVE_URL_ROOT:-'/app/ppd'} | ||
| export RAILS_RELATIVE_URL_ROOT=${APPLICATION_ROOT:-'/app/ppd'} | ||
| export SCRIPT_NAME=${RAILS_RELATIVE_URL_ROOT} |
There was a problem hiding this comment.
Is this needed? I thought we only used RAILS_RELATIVE_URL_ROOT
…ollective-lift-and-shift-updates
improvements for handling error pages. will need to be ported onto the other apps as well post lift & shift testing
as per other HMLR apps
specific to epimorphics internal gems
andrew-pickin-epi
left a comment
There was a problem hiding this comment.
I suspect there a broken merge going on here.
The Makefile is certainly in error.
| - (Jon) Refactored the version cadence creation to include a SUFFIX value if | ||
| provided; otherwise no SUFFIX is included in the version number. | ||
| - (Jon) Adjusted the processing of error status to use the application template; | ||
| also includes adjustments to not double render the error response. |
There was a problem hiding this comment.
APPLICATION_ROOT has been dropped.
README.md
Outdated
|
|
||
| | name | description | typical value | | ||
| | -------------------------- | -------------------------------------------------------------------- | -------------------------- | | ||
| | `APPLICATION_ROOT` | The path from the server root to the application | `/app/ppd` | |
There was a problem hiding this comment.
APPLICATION_ROOT has been dropped.
Makefile
Outdated
| COMMIT=$(shell git rev-parse --short HEAD) | ||
| VERSION?=$(shell /usr/bin/env ruby -e 'require "./app/lib/version" ; puts Version::VERSION') | ||
| TAG?=$(shell printf '%s-%s-%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER}) | ||
| TAG?=$(shell printf '%s_%s_%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER}) |
There was a problem hiding this comment.
This still using the wrong path for the bundle conf.
Broken merge?
Removed `${HOME}/` from path
Includes further clarification on running the app individually, or as part of the HMLR suite of apps; alongside using Docker containers and accessing the Data API locally.
This PR includes the following updates and resolves the linked issues:
Gemfileto include instructions for running Epimorphics specific gems locally during the development of those gems.data_services_apigem version to be at least the current version~>1.3.2(this is to cover out of sync release versions)lr_common_stylesgem version to be at least the current version~>1.9.0(this is to cover out of sync release versions)entrypoint.shto ensure the required env vars are set accordingly or deployment will fail noisily.