-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Nginx and Github Actions (#2)
- Loading branch information
1 parent
765189d
commit 9de5158
Showing
6 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
### What is the context of this PR? | ||
Describe what you have changed and why, link to other PRs or Issues as appropriate. | ||
|
||
### How to review | ||
Describe the steps required to test the changes (include screenshots if appropriate). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
|
||
docker-push: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set Tag and SHA | ||
run: | | ||
CLEAN_TAG=$(echo "${{ github.event.pull_request.head.ref }}" | tr / -) | ||
echo "TAG=$CLEAN_TAG" >> $GITHUB_ENV | ||
echo "SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | ||
- name: Build | ||
run: > | ||
docker build -t ${{ secrets.GAR_LOCATION }}/${{ secrets.GAR_PROJECT_ID }}/docker-images/eq-runner-maintenance-page:$TAG . | ||
- name: Push to GAR | ||
env: | ||
GAR_SERVICE_KEY: ${{ secrets.GAR_SERVICE_KEY }} | ||
run: | | ||
echo $GAR_SERVICE_KEY | docker login -u _json_key --password-stdin https://${{ secrets.GAR_LOCATION }} | ||
gcloud auth configure-docker ${{ secrets.GAR_LOCATION }} | ||
echo "Pushing to GAR with tag $TAG" | ||
docker push ${{ secrets.GAR_LOCATION }}/${{ secrets.GAR_PROJECT_ID }}/docker-images/eq-runner-maintenance-page:$TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM nginx | ||
COPY static-html /usr/share/nginx/html | ||
COPY nginx/conf.d/default.conf /etc/nginx/conf.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
# eq-runner-maintenance-page | ||
Repo for EQ Questionnaire runner maintenance page | ||
This repo provides a static maintenance page for the EQ Questionnaire Runner application. | ||
|
||
The page at `static-html/service.html` is intended to be served to users when the Runner application is unavailable. | ||
|
||
This repo is not responsible for the provisioning or deployment of the page. | ||
|
||
## Web server | ||
While the `service.html` maintenance page can be deployed directly to a backend location (to be served from there by a CDN for example) this repo also provides an [Nginx](https://nginx.org/) web server Docker container, with a basic configuration to return the maintenance page for all requests it serves. The container can be deployed to a run time replacing the EQ Runner application. | ||
|
||
## Build image locally | ||
``` | ||
docker build -t runner-maintenance-page . | ||
``` | ||
|
||
## Run container locally | ||
``` | ||
docker run -it --rm -d -p 5000:5000 --name runner-maintenance-page runner-maintenance-page | ||
``` | ||
|
||
Requested routes at `http://localhost:5000/` will be served with the maintenance page. | ||
|
||
The route at `http://localhost:5000/status` will return an appropriate status response intending to serve as an indication that the Runner application is unavailable on that URL. | ||
|
||
``` | ||
docker stop runner-maintenance-page | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
server { | ||
listen 5000 default; | ||
server_name _; | ||
server_tokens off; | ||
|
||
if ($http_x_forwarded_proto = "http") { | ||
return 301 https://$host$request_uri; | ||
} | ||
|
||
location /status { | ||
default_type application/json; | ||
return 200 '{"status": "Unavailable"}'; | ||
} | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index service.html; | ||
} | ||
|
||
error_page 404 500 502 503 504 /service.html; | ||
} |
File renamed without changes.