|
30 | 30 | - [fec node scripts](#fec-node-scripts) |
31 | 31 | - [Usage](#usage-1) |
32 | 32 | - [Patch etc hosts](#patch-etc-hosts) |
| 33 | + - [Dev proxy](#dev-proxy) |
33 | 34 | - [Static](#static) |
34 | 35 | - [Inventory example](#inventory-example) |
35 | 36 | - [In inventory UI repository changes](#in-inventory-ui-repository-changes) |
@@ -380,6 +381,52 @@ Use binary in your `package.json` scripts section: |
380 | 381 | ## Patch etc hosts |
381 | 382 | This is a required step for first time setup. It will allow your localhost to map to [env].foo.redhat.com. This is required to run only once on your machine. **Your OS may require running the script as sudo**! |
382 | 383 |
|
| 384 | +## Dev proxy |
| 385 | + |
| 386 | +A script that starts up a complete development environment with webpack build, static asset serving and a containerized development proxy for environment proxying. |
| 387 | +This command provides an alternative to the traditional webpack dev server approach by using a customized Caddy server container to handle proxy routing, which should be more reliable and faster due to HTTP2 support and better websocket handling. |
| 388 | +The used containerized proxy and its documentation can be found in this repo: [frontend-development-proxy](https://github.com/RedHatInsights/frontend-development-proxy). |
| 389 | + |
| 390 | +**Usage:** |
| 391 | +```bash |
| 392 | +fec dev-proxy [options] |
| 393 | +``` |
| 394 | + |
| 395 | +**Options:** |
| 396 | +- `--port, -p`: Proxy server port (default: 1337) |
| 397 | +- `--staticPort, -sp`: Static assets server port (default: 8003) |
| 398 | +- `--clouddotEnv`: Set platform environment ('stage', 'prod', 'dev', 'ephemeral') |
| 399 | + |
| 400 | +**Requirements:** |
| 401 | +- Docker or Podman installed and available |
| 402 | +- Valid FEC configuration file (fec.config.js) |
| 403 | +- Network access to Red Hat proxy services (for stage environments) |
| 404 | + |
| 405 | +**Example:** |
| 406 | +```bash |
| 407 | +# Start development proxy on default ports |
| 408 | +fec dev-proxy |
| 409 | + |
| 410 | +# Start with custom port and target stage environment |
| 411 | +fec dev-proxy --port 3000 --clouddotEnv stage |
| 412 | + |
| 413 | +# Start with custom static assets port |
| 414 | +fec dev-proxy --staticPort 9000 |
| 415 | +``` |
| 416 | + |
| 417 | +The command will: |
| 418 | +1. Pull and start the development proxy container |
| 419 | +2. Start webpack in watch mode to build your assets |
| 420 | +3. Serve static assets via http-server |
| 421 | +4. Configure routing based on your FEC config (configuration is the same as for the dev command, [Custom routes](#custom-routes)) |
| 422 | +5. Start a local Chrome UI server _(this can be disabled by setting `SPAFallback` var to `false` in the FEC config)_ |
| 423 | +6. Display the development URL when ready |
| 424 | + |
| 425 | +Your application will be available at `https://[env].foo.redhat.com:[port]` where `[env]` is determined by your configuration or the `--clouddotEnv` flag. |
| 426 | + |
| 427 | +**Limitations:** |
| 428 | +This command currently doesn't work in DinD environments. The new proxy can still be used there when launched manually with different network settings for running alongside frontends started with the static command. [1](https://github.com/RedHatInsights/frontend-development-proxy?tab=readme-ov-file#dind-docker-in-docker-ci) |
| 429 | + |
383 | 430 | ## Static |
384 | 431 |
|
385 | 432 | A script that will run webpack build and serve webpack output through `http-serve` server. **This is not supposed to replace webpack dev server!** |
|
0 commit comments