Skip to content

Commit

Permalink
Merge pull request #157 from daithihearn/proxy-api-and-ws
Browse files Browse the repository at this point in the history
Proxying API and WS calls
  • Loading branch information
daithihearn authored Apr 6, 2023
2 parents 892dced + b841475 commit 1ec769b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 38 deletions.
57 changes: 21 additions & 36 deletions .github/workflows/publish-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,33 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Update version in package.json
run: yarn version --no-git-tag-version --new-version ${{ github.ref_name }}
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Get version in manifest.json
id: manifestversion
id: manifest-version
uses: notiz-dev/github-action-json-property@release
with:
path: "public/manifest.json"
prop_path: "version"
- name: Update manifest.json version
if: ${{ steps.manifestversion.outputs.prop != github.ref_name }}
uses: jossef/action-set-json-field@v2
- name: Ensure the manifest version matches the tag version
if: ${{ steps.manifest-version.outputs.prop != github.ref_name }}
uses: actions/github-script@v3
with:
script: |
core.setFailed('The version in the manifest must match the tag.')
- name: Get version in package.json
id: package-version
uses: notiz-dev/github-action-json-property@release
with:
path: "package.json"
prop_path: "version"
- name: Ensure the package.json version matches the tag version
if: ${{ steps.package-version.outputs.prop != github.ref_name }}
uses: actions/github-script@v3
with:
file: public/manifest.json
field: version
value: ${{ github.ref_name }}
script: |
core.setFailed('The version in the package.json must match the tag.')
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -42,30 +54,3 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
platforms: linux/amd64,linux/arm64/v8
tags: "latest, ${{ github.ref_name }}"

- name: Create PR with version changes
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PAT_PR }}
commit-message: Update latest version (${{ github.ref_name }})
title: Update latest version (${{ github.ref_name }})
body: |
Update latest version (${{ github.ref_name }})
branch: update-version-${{ github.ref_name }}
delete-branch: true
base: main
add-paths: |
package.json
public/manifest.json
labels: |
update
assignees: |
${{ github.actor }}
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v2
with:
token: ${{ secrets.PAT_PR }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash
20 changes: 20 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ server {
try_files $uri $uri/ /index.html =404;
}

location /api/ {
proxy_pass http://api:8080/;
proxy_set_header Host api;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# WebSocket proxy configuration
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

# WebSocket endpoint proxy configuration
location /ws/ {
proxy_pass http://websocket-service:8080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "5.5.9",
"version": "6.0.0",
"description": "React frontend for the Cards 110",
"author": "Daithi Hearn",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"short_name": "Cards 110",
"name": "Cards 110",
"version": "5.5.9",
"version": "6.0.0",
"icons": [
{
"src": "./assets/favicon.png",
Expand Down

0 comments on commit 1ec769b

Please sign in to comment.