|
1 |
| -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
| 1 | +# Cadence Web UI |
| 2 | + |
| 3 | +[](https://github.com/uber/cadence-web/actions/workflows/build.yml) [](https://hub.docker.com/r/ubercadence/web/tags) |
| 4 | + |
| 5 | +Cadence is a distributed, scalable, durable, and highly available orchestration engine we developed at Uber Engineering to execute asynchronous long-running business logic in a scalable and resilient way. |
| 6 | + |
| 7 | +This web UI is used to view workflows from [Cadence][cadence], see what's running, and explore and debug workflow executions. |
| 8 | + |
2 | 9 |
|
3 | 10 | ## Getting Started
|
4 | 11 |
|
5 |
| -First, run the development server: |
| 12 | +### Configuration |
| 13 | + |
| 14 | +Set these environment variables if you need to change their defaults |
| 15 | + |
| 16 | +| Variable | Description | Default | |
| 17 | +| ---------------------------- | --------------------------------------------- | ---------------- | |
| 18 | +| CADENCE_GRPC_PEERS | Comma-delimited list of gRPC peers | 127.0.0.1:7833 | |
| 19 | +| CADENCE_GRPC_SERVICES_NAMES | Comma-delimited list of gRPC services to call | cadence-frontend | |
| 20 | +| CADENCE_CLUSTERS_NAMES | Comma-delimited list of cluster names | cluster0 | |
| 21 | +| CADENCE_WEB_PORT | HTTP port to serve on | 8088 | |
| 22 | +| ENABLE_AUTH | Enable auth feature | false | |
| 23 | +| CADENCE_ADMIN_SECURITY_TOKEN | Admin token for accessing admin methods | '' | |
| 24 | + |
| 25 | +Note: To connect `cadence-web` to multiple clusters, you will need to add comma-delimted entries for `CADENCE_GRPC_PEERS`, `CADENCE_GRPC_SERVICES_NAMES` & `CADENCE_CLUSTERS_NAMES` for each cluster (each cluster values are grouped by their index within the Comma-delimited lists). |
| 26 | + |
| 27 | +Example: |
| 28 | +``` |
| 29 | +CADENCE_GRPC_PEERS=127.0.0.1:3000,127.0.0.1:5000 |
| 30 | +CADENCE_GRPC_SERVICES_NAMES=cadence-frontend-cluster0,cadence-frontend-cluster1 |
| 31 | +CADENCE_CLUSTERS_NAMES=cluster0,cluster1 |
| 32 | +``` |
| 33 | + |
6 | 34 |
|
7 |
| -```bash |
| 35 | +### Using cadence-web |
| 36 | + |
| 37 | +The latest version of `cadence-web` is included in the `cadence` composed docker containers in the [main Cadence repository][cadence]. Follow the instructions there to get started. |
| 38 | +``` |
| 39 | +docker-compose -f docker/docker-compose.yml up |
| 40 | +``` |
| 41 | + |
| 42 | +### Building & developing cadence-web |
| 43 | + |
| 44 | +`cadence-web` requires node `v18` or greater to be able to run correctly. |
| 45 | + |
| 46 | +#### Creating a production build |
| 47 | + |
| 48 | +To create a production build, follow these steps: |
| 49 | + |
| 50 | +1. Install npm packages and download idls |
| 51 | +``` |
| 52 | +npm install && npm run install-idl && npm run generate:idl |
| 53 | +``` |
| 54 | +2. Build the project files |
| 55 | +``` |
| 56 | +npm run build |
| 57 | +``` |
| 58 | +3. After building the code, start the server by running this command from the same directory as the build |
| 59 | +``` |
| 60 | +npm start |
| 61 | +``` |
| 62 | +4. Once the webapp is ready, access it through `localhost:8088` (port can be changed using `CADENCE_WEB_PORT` environment variable) |
| 63 | + |
| 64 | +#### Running development environment |
| 65 | + |
| 66 | +To run the development server, follow these steps: |
| 67 | + |
| 68 | +1. Install npm packages and download idls |
| 69 | +``` |
| 70 | +npm install && npm run install-idl && npm run generate:idl |
| 71 | +``` |
| 72 | +2. Run the development server using |
| 73 | +``` |
8 | 74 | npm run dev
|
9 |
| -# or |
10 |
| -yarn dev |
11 |
| -# or |
12 |
| -pnpm dev |
13 |
| -# or |
14 |
| -bun dev |
15 | 75 | ```
|
| 76 | +3. Once the webapp is ready, access it through `localhost:8088` (port can be changed using `CADENCE_WEB_PORT` environment variable) |
| 77 | + |
| 78 | +Note: For contribution we recommend using dev containers, check [VSCode Dev Containers](#using-vscode-dev-containers) section for more information |
| 79 | + |
| 80 | +#### Using VSCode Dev Containers |
| 81 | + |
| 82 | +1. Set up the [Remote Containers plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) in VSCode. |
| 83 | +2. Open the cadence-web directory in VSCode. |
| 84 | +3. Make sure to update `CADENCE_GRPC_PEERS` with the correct host. (If you are connecting to a server on a container host machine use `host.docker.interal:7833`, where `7833` is the gRPC port for a running [cadence-frontend](https://github.com/cadence-workflow/cadence/tree/master/service/frontend) service) |
| 85 | +4. Use the Command Palette to select the 'Reopen folder in Container' option |
| 86 | +5. Follow same commands listed in [Running development environment](#running-development-environment) section. |
| 87 | + |
| 88 | + |
| 89 | +#### Developing cadence-web against cadence composed docker |
| 90 | + |
| 91 | +To start development against dockerized cadence services, run the following command from the root of the project |
| 92 | +``` |
| 93 | +docker-compose -f docker-compose-backend-services.yml up |
| 94 | +``` |
| 95 | + |
| 96 | +You can customize the YAML file or reuse configurations from the [cadence repository](https://github.com/cadence-workflow/cadence/tree/master/docker). (In case of reusing exsisting files: ensure that cadence-web is not included in the composed container services, or just remove it) |
| 97 | + |
| 98 | +After running `cadence`, start `cadence-web` for development using one of the previous methods ([Running development environment](#running-development-environment), [VSCode Dev Containers](#using-vscode-dev-containers)) |
16 | 99 |
|
17 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
18 | 100 |
|
19 |
| -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. |
| 101 | +#### NPM scripts |
20 | 102 |
|
21 |
| -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. |
22 | 103 |
|
23 |
| -## Learn More |
| 104 | +| script | Description | |
| 105 | +| ----------------- | ----------------------------------------------------------------------------------------------- | |
| 106 | +| build | Generate a production build | |
| 107 | +| start | Start server for existing production build | |
| 108 | +| dev | Run a development server | |
| 109 | +| install-idl | Download idl files required for building/running the project | |
| 110 | +| generate:idl | Move idl files inside the project and generate typescript types for them | |
| 111 | +| test | Run all test cases. To pass extra jest flags, use environment specific scripts e.g. test:unit:* | |
| 112 | +| test:unit | Run all unit tests. To pass extra jest flags, use environment specific scripts e.g. test:unit:* | |
| 113 | +| test:unit:browser | Run only browser unit tests | |
| 114 | +| test:unit:node | Run only node unit tests | |
| 115 | +| lint | Run eslint | |
| 116 | +| typecheck | Run typescript checks | |
24 | 117 |
|
25 |
| -To learn more about Next.js, take a look at the following resources: |
26 | 118 |
|
27 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
28 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
29 | 119 |
|
30 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! |
31 | 120 |
|
32 |
| -## Deploy on Vercel |
| 121 | +## License |
33 | 122 |
|
34 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 123 | +MIT License, please see [LICENSE](https://github.com/cadence-workflow/cadence-web/blob/master/LICENSE) for details. |
35 | 124 |
|
36 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
| 125 | +[cadence]: https://github.com/cadence-workflow/cadence |
0 commit comments