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

feat(agora): migrate Agora to spec-first development workflow #2767

Merged

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Aug 21, 2024

Closes #2764

Description

This PR updates the Agora product in the monorepo to adopt specification-first development workflow. From now on, the API client for Angular will be automatically generated with OpenAPI Generator. Same goes for the API docs site using Redocly. A reverse proxy (Caddy) is added to the stack to redirect the traffic to different components (web app, REST API, and docs site).

Cc: @sagely1, @JessterB, @jay-hodgson

Changelogs

  • Replace the existing project agora-api-client-angular using model-ad-api-client-angular as a template
  • Add the project agora-api-docs
  • Add several Angular library projects: styles, themes, ui, utils, config
  • Add the Angular library project for the not-found page
  • Rename the project agora-server to agora-api
  • Rename the path /api by /v1 in agora-api
  • Add the project agora-apex (reverse proxy)
  • Update the docker compose files of Agora to deploy the new components

Preview

API Client for Angular

Let's assume that the API specification of Agora has been updated and build:

nx build agora-api-description

We can now update the API client for Angular with OpenAPI Generator:

nx run agora-api-client-angular:generate

That's it! The API client for Angular is ready to be imported in a web app project developed in the monorepo.

REST API service

Send a request directly to the API service:

$ curl agora-api:3333/v1/dataversion
{"_id":"66c64b2e18e5adec7e3894d4","data_file":"syn13363290","data_version":"68","team_images_id":"syn12861877"}

Send the request via the reverse proxy (the "apex" component):

$ curl agora-apex:8000/api/v1/dataversion
{"_id":"66c64b2e18e5adec7e3894d4","data_file":"syn13363290","data_version":"68","team_images_id":"syn12861877"}

Web App

Navigate to localhost:8000 and you will be redirected to the only page of the app.

Note that the page includes data from the REST API.

image

@tschaffter tschaffter changed the title feat(agora): migrate API client for angular to spec-first development workflow feat(agora): migrate Agora to spec-first development workflow Aug 21, 2024
@tschaffter tschaffter marked this pull request as ready for review August 21, 2024 22:03
@tschaffter tschaffter requested a review from a team as a code owner August 21, 2024 22:03
Copy link
Contributor

@sagely1 sagely1 left a comment

Choose a reason for hiding this comment

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

Looks great!

@tschaffter
Copy link
Member Author

tschaffter commented Aug 22, 2024

@sagely1 See updated command descriptions

Helpful commands:
Stop running containers

workspace-docker-stop

See running containers

docker ps

Cleanup stopped container along with other Docker resources (list is printed and user is prompted for confirmation)

docker system prune

Build all the images

agora-build-images

Start containerized apex which will trigger the rest of the containerized stack to be started

nx serve-detach agora-apex

Stop and remove the web app container

docker rm -f agora-app

Start the development server of the web app

nx serve agora-app

@tschaffter tschaffter merged commit 2199038 into Sage-Bionetworks:main Aug 22, 2024
13 of 14 checks passed
@tschaffter tschaffter deleted the agora/update-api-client-angular branch August 22, 2024 21:11
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.

[Story] Update Agora boilerplate based on MODEL-AD's
2 participants