Skip to content
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

Separate deployment of Gateway frontend and backend #2032

Merged
merged 5 commits into from
Aug 22, 2024

Conversation

zkokelj
Copy link
Contributor

@zkokelj zkokelj commented Aug 21, 2024

Why this change is needed

In this PR I separated the deployment of gateway frontend and backend.
This is necessary for:

  • easier and separate deployments of frontend and backend
  • in the next step we will make Ten Gateway run on SGX and this is a prerequisite for that (removes static files, nginx, etc.)

What changes were made as part of this PR

Please provide a high level list of the changes made

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

@zkokelj zkokelj changed the title Ziga/gateway decouple fe be Separate deployment of Gateway frontend and backend Aug 21, 2024
@badgersrus badgersrus self-requested a review August 21, 2024 14:33
Copy link
Contributor

@badgersrus badgersrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few minor comments

@@ -139,6 +139,6 @@ jobs:
-e OBSCURO_GATEWAY_VERSION="${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}" \
--log-opt max-file=3 --log-opt max-size=10m \
${{ vars.DOCKER_BUILD_TAG_GATEWAY }} \
-host=0.0.0.0 -port=8080 -portWS=81 -nodeHost=${{ vars.L2_RPC_URL_VALIDATOR }} -verbose=true \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we stick to the usual FE convention of 3000 for the FE?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this workflow is for the backend gateway (API)

steps:
- name: 'Print GitHub variables'
run: |
echo "Selected Testnet Type: ${{ matrix.testnet_type }}"
echo "Gateway API URL: ${{ matrix.GATEWAY_API_URL }}"
echo "Gateway API URL: ${{ vars.GATEWAY_URL }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how is this differentiated for each env?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have separate environments (https://github.com/ten-protocol/go-ten/settings/environments ) and for each environment we need GATEWAY_URL variable which represents the URL for that specific testnet type.

To build a docker image use docker build command. Please note that you need to run it from the root of the repository.
To run the container you can use `./docker_run.sh`. You can add parameters to the script, and they are passed to the wallet extension
(example: `-host=0.0.0.0` to be able to access wallet extension endpoints via localhost).
The frontend will be accessible on `http://localhost:80`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would need to be updated as well if you're happy to switch to 3000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that gateway backend also runs on port 3000 (by default).
If you think it would be better I can switch to a different port for the backend and leave frontend one on port 3000.

@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev -p 80",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this

Copy link
Contributor

@badgersrus badgersrus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - sticking to port convention will just reduce confusion for node ops/ devs

@zkokelj zkokelj merged commit cb41817 into main Aug 22, 2024
4 checks passed
@zkokelj zkokelj deleted the ziga/gateway_decouple_fe_be branch August 22, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants