Skip to content

Commit d6f2639

Browse files
[flagd-ui] improved flagd-ui
1 parent 5e5ea33 commit d6f2639

40 files changed

+1261
-593
lines changed

.env

+5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ SHIPPING_SERVICE_DOCKERFILE=./src/shippingservice/Dockerfile
129129
FLAGD_HOST=flagd
130130
FLAGD_PORT=8013
131131

132+
#flagd-ui
133+
FLAGD_UI_HOST=flagd-ui
134+
FLAGD_UI_PORT=4000
135+
FLAGD_UI_DOCKERFILE=./src/flagd-ui/Dockerfile
136+
132137
# Kafka
133138
KAFKA_SERVICE_PORT=9092
134139
KAFKA_SERVICE_ADDR=kafka:${KAFKA_SERVICE_PORT}

.github/workflows/component-build-images.yml

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ jobs:
111111
tag_suffix: shippingservice
112112
context: ./
113113
setup-qemu: true
114+
- file: ./src/flagd-ui/Dockerfile
115+
tag_suffix: flagdui
116+
context: ./
117+
setup-qemu: true
114118
- file: ./test/tracetesting/Dockerfile
115119
tag_suffix: traceBasedTests
116120
context: ./

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ the release.
2323
* [frontend] fix imageSlowLoad headers not applied
2424
to 1.8.0 together with other dependencies
2525
([#1733](https://github.com/open-telemetry/opentelemetry-demo/pull/1733))
26+
* [flagd-ui] Add UI for managing Flagd feature flags
27+
([#1725](https://github.com/open-telemetry/opentelemetry-demo/pull/1725))
2628

2729
## 1.11.1
2830

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ start:
134134
@echo "Go to http://localhost:8080/jaeger/ui for the Jaeger UI."
135135
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
136136
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
137-
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
137+
@echo "Go to http://localhost:8080/feature/ to to change feature flags."
138138

139139
.PHONY: start-minimal
140140
start-minimal:

docker-compose.yml

+31
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ services:
340340
- ENVOY_PORT
341341
- FLAGD_HOST
342342
- FLAGD_PORT
343+
- FLAGD_UI_HOST
344+
- FLAGD_UI_PORT
343345
depends_on:
344346
frontend:
345347
condition: service_started
@@ -349,6 +351,8 @@ services:
349351
condition: service_started
350352
grafana:
351353
condition: service_started
354+
flagd-ui:
355+
condition: service_started
352356

353357
# Imageprovider
354358
imageprovider:
@@ -597,6 +601,33 @@ services:
597601
logging:
598602
*logging
599603

604+
# Flagd-ui, UI for configuring the feature flagging service
605+
flagd-ui:
606+
image: ${IMAGE_NAME}:${DEMO_VERSION}-flagd-ui
607+
container_name: flagd-ui
608+
build:
609+
context: ./
610+
dockerfile: ${FLAGD_UI_DOCKERFILE}
611+
deploy:
612+
resources:
613+
limits:
614+
memory: 150M
615+
restart: unless-stopped
616+
environment:
617+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
618+
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
619+
- OTEL_RESOURCE_ATTRIBUTES
620+
- OTEL_SERVICE_NAME=flagd-ui
621+
ports:
622+
- "${FLAGD_UI_PORT}"
623+
depends_on:
624+
otelcol:
625+
condition: service_started
626+
flagd:
627+
condition: service_started
628+
volumes:
629+
- ./src/flagd:/app/data
630+
600631
# Kafka used by Checkout, Accounting, and Fraud Detection services
601632
kafka:
602633
image: ${IMAGE_NAME}:${DEMO_VERSION}-kafka

src/flagd-ui/.dockerignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Dependency directories
2+
node_modules
3+
/.pnp
4+
.pnp.js
5+
6+
# Next.js build output
7+
.next
8+
out
9+
10+
# Testing
11+
/coverage
12+
13+
# Production
14+
/build
15+
16+
# Misc
17+
.DS_Store
18+
*.pem
19+
20+
# Debug
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
25+
# Local env files
26+
.env*.local
27+
28+
# Vercel
29+
.vercel
30+
31+
# TypeScript
32+
*.tsbuildinfo
33+
next-env.d.ts
34+
35+
# IDE/Editor folders
36+
.idea
37+
.vscode
38+
39+
# OS generated files
40+
Thumbs.db
41+
42+
# Temporary files
43+
*.swp
44+
*.swo
45+
46+
# Git related
47+
.git
48+
.gitignore
49+
50+
# Docker related
51+
Dockerfile
52+
.dockerignore
53+
54+
# Other
55+
README.md
56+
*.log

src/flagd-ui/.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["prettier-plugin-tailwindcss"]
3+
}

src/flagd-ui/Dockerfile

+32-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
1-
FROM node:20.15.1-slim
2-
WORKDIR /data
3-
COPY . .
4-
RUN npm install
5-
CMD [ "/bin/bash -c 'npm run dev'" ]
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
63

4+
FROM node:20 AS builder
5+
6+
WORKDIR /app
7+
8+
COPY ./src/flagd-ui/package*.json ./
9+
10+
RUN npm ci
11+
12+
COPY ./src/flagd-ui/. ./
13+
14+
RUN npm run build
15+
16+
# -----------------------------------------------------------------------------
17+
18+
FROM node:20-alpine
19+
20+
WORKDIR /app
21+
22+
COPY ./src/flagd-ui/package*.json ./
23+
24+
RUN npm ci --only=production
25+
26+
COPY --from=builder /app/src/instrumentation.ts ./instrumentation.ts
27+
COPY --from=builder /app/next.config.mjs ./next.config.mjs
28+
29+
COPY --from=builder /app/.next ./.next
30+
31+
EXPOSE 4000
32+
33+
CMD ["npm", "start"]

src/flagd-ui/README.md

+17-28
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,25 @@
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+
# Flagd-ui
22

3-
## Getting Started
3+
This application provides a user interface for configuring the feature
4+
flags of the flagd service.
45

5-
First, run the development server:
6+
This is a [Next.js](https://nextjs.org/) project.
67

7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
15-
```
16-
17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18-
19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20-
21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
8+
## Running the application
229

23-
## Learn More
10+
The application can be run with the rest of the demo using the documented
11+
docker compose or make commands.
2412

25-
To learn more about Next.js, take a look at the following resources:
13+
## Local development
2614

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.
15+
To run the app locally for development you must copy
16+
`src/flagd/demo.flagd.json` into `src/flagd-ui/data/demo.flagd.json`
17+
(create the directory and file if they do not exist yet). Make sure you're
18+
in the `src/flagd-ui` directory and run
19+
the following command:
2920

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31-
32-
## Deploy on Vercel
33-
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.
21+
```bash
22+
npm run dev
23+
```
3524

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
25+
Then you must navigate to `localhost:4000/feature`.

src/flagd-ui/data/output.json

-105
This file was deleted.

src/flagd-ui/next.config.mjs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
2+
const nextConfig = {
3+
experimental: {
4+
instrumentationHook: true,
5+
},
6+
basePath: "/feature",
7+
};
38

49
export default nextConfig;

0 commit comments

Comments
 (0)