This repository contains the Apache rewrite rules & static HTML homepage for a persistent identifier (PID) server implemented by Geoscience Australia for the pid.geoscience.gov.au
domain which GA administers for geoscience matters on behalf of Australian geoscience community.
NOTE: this server is currently in development and it online not at http://pid.geoscience.gov.au but at http://surroundaustralia.com.
- htdocs/ folder
The main server configuration file is conf/httpd.conf. It includes (IncludeOptional conf/sites/*.conf
) files in the conf/sites folder. Currently, there is only one site supported by the server: pid.geosciecne.gov.au
.
There is one data file, rule-cases.json
that contains tests for all implemented rules. The test case format is:
"<KEY>":[
{
"label": "<LABEL>}",
"from": "{HOST}/<FROM-IRI>",
"to": "<TO-IRI>",
"headers": {<HEADERS>}
}
],
<KEY>
- just an ID for a case, could be anything
<LABEL>
- a label for each test case that must be unique as it is needed to indicate which tests faile, if any
<FROM-IRI>
- an IRI that is matched by a RedirectRule in the redirect server. Must include Query String Arguments if used
<TO-IRI>
- where the full IRI of {HOST}/<FROM-IRI>
is expected to redirect to
<HEADERS>
- any HTTP headers needed to make the redirect, e.g. Accept: text/turtle
There are two testing files:
test_redirects.py
- tests only that the<FROM-IRI>
redirects to<TO-IRI>
. Doesn't matter if the<TO-IRI>
doesn't existtest_resolutions.py
- tests that redirect to<TO-IRI>
receive an HTTP 200 code, i.e. that the<TO-IRI>
works
If a local Apache server is established, e.g. localhost on a Windows, Linux or Mac desktop, then the PID rules can be tested with it by just loading the file in the conf/sites folder into that local server's sites and ensuring it is configured to see it (e.g. an Include
statement to that file in your main httpd.conf
file).
You can use the Dockerfile with Docker Desktop to create a Docker container locally and run tests with that.
You can set the host
variable in the two testing files to test not locally (http://localhost) but remotely, e.g. http://pid.geoscience.gov.au.
An Apache server loaded with this repository's static content and redirect rules can be deployed with GitHub Actions using the files in .github/worklflows. One Action is used to validate new rules, the other reloads the server online:
- On pull request to the
main
branch:- Run a test Docker image to run
pytest
tests
- Run a test Docker image to run
- On push to the
main
branch:- Build Docker image, push to AWS ECR & deploy to a Kubernetes cluster
The file Dockerfile
is used to create a Docker container that can be run locally for testing or pushed remotely.
This code is licensed using the Apache licence. See the LICENSE file for the deed.
owner:
Geoscience Australia
https://www.ga.gov.au
[email protected]
creator:
SURROUND Australia Pty. Ltd.
https://surroundaustralia.com
[email protected]