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

Add reverse proxy example #15

Merged
merged 20 commits into from
Jul 19, 2024
Merged

Add reverse proxy example #15

merged 20 commits into from
Jul 19, 2024

Conversation

apljungquist
Copy link
Contributor

@apljungquist apljungquist commented May 7, 2024

Adds a simple example of a web server exposed through the tcp reverse proxy configuration in the acap manifest.

To Do:

  • Consider including a websocket handler to ensure that works
  • Consider including an UDS example This code is messy, more difficult to run on host, and it is not clear to me that it should be preferred.
  • Consider including an example of serving static files on host
  • Consider adding unit tests. I don't want to spend time figuring out how to do this right now.

@apljungquist apljungquist requested a review from a team as a code owner May 7, 2024 15:48
@apljungquist apljungquist marked this pull request as draft June 7, 2024 09:28
* upstream/main:
  chore(deps): bump glib-sys from 0.19.5 to 0.19.8 in the default group (#28)
  chore: Explain more make targets (#27)
  Add embedded web page example (#14)
  chore: Group and sort imports (#23)
  Demonstrate containerized builds (#17)
  Factor out `app_logging` modules to lib crate (#24)
  chore(deps): bump the default group with 2 updates (#21)
  chore(deps): bump thiserror from 1.0.59 to 1.0.60 in the default group (#20)
  chore(deps): bump the default group with 3 updates (#13)
The web page is meant to facilitate manual testing of the app.
Serving static files on host shortens the feedback cycle since we don't
need to deploy anything to a device.

The way that static files are located will probably not work in general
once support for dynamically generated files is added to the build
system, but this example only uses static files, so it should not block
that feature.
Because the reverse proxy configuration has no built in support for
forwarding the identity that a user is authenticated as or the scopes
that the user is authorized for this example tries to work around that
by exposing one API for each access policy supported by the ACAP
framework.

It would be nice to either:
1. Formalize this pattern using some kind of nested service or similar.
2. Get support from the ACAP framework for forwarding information about
   the authenticated user and it's permissions, e.g. through a header.
* upstream/main:
  fix(embedded_web_page): Put web page in `html/` (#30)
  Organize dependencies consistently (#29)
Because I don't know of an official way for the web page to figure out
what access policy it is authorized for I add an input for selecting it.
Attempting to use a more restricted policy than the user is currently
authorized for will trigger an authentication challenge.

For simplicity the web page always uses the websocket as "anonymous"
because this should always work. Compared to using the selected policy
this is simpler because the websocket does not have to be closed.
* upstream/main:
  Generate app `LICENSE` files (#44)
  Add acap-ssh-utils bin and lib crate (#19)
  Add cargo-acap-build tool (#25)
  Remove partially containerized workflow (#42)
  Improve acap-logging docs (#41)
  chore: Prepare logging library crate for publishing (#40)
  feat: Add metadata broker wrapper and example (#22)
  Rename environment variables controlling the Makefile (#26)
  Adopt dev container as primary environment (#39)
  Make the `build` verb build for only one target (#31)
  chore(deps): bump ghcr.io/devcontainers/features/common-utils (#38)
  chore(deps): bump log from 0.4.21 to 0.4.22 in the default group (#37)
  Add dev container (#36)
  Add link to acap-rs-app-template in `README.md` (#34)
  Document `python3-venv` dependency (#35)
  fix: Repair `Makefile` (#32)
In `about.toml`:
- Add BSD-3-Clause to the list of accepted licenses because it is
  one of two licenses used by `matchit` which in turn is used by
  `axum`. Add it below MIT because I have a feeling that MIT is
  generally considered the most permissive licence. Add it above
  Unicode-DFS-2016 because that text is longer and harder to
  understand. All licenses in the list can already be found in firmware
  indicating they may be acceptable to include in other software as
  well.
* upstream/main:
  feat: Add vapix bindings and example (#33)
@apljungquist apljungquist marked this pull request as ready for review July 19, 2024 19:17
@apljungquist apljungquist merged commit de16e5f into main Jul 19, 2024
2 checks passed
@apljungquist apljungquist deleted the reverse_proxy branch July 19, 2024 19:19
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.

1 participant