Skip to content

Commit d953c81

Browse files
Merge pull request open-telemetry#1725 from maindotmarcell/add-flagd-ui
Add flagd UI
2 parents 39f5e47 + d6f2639 commit d953c81

34 files changed

+6327
-1
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/.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

src/flagd-ui/.gitignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts

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

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
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

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Flagd-ui
2+
3+
This application provides a user interface for configuring the feature
4+
flags of the flagd service.
5+
6+
This is a [Next.js](https://nextjs.org/) project.
7+
8+
## Running the application
9+
10+
The application can be run with the rest of the demo using the documented
11+
docker compose or make commands.
12+
13+
## Local development
14+
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:
20+
21+
```bash
22+
npm run dev
23+
```
24+
25+
Then you must navigate to `localhost:4000/feature`.

src/flagd-ui/next.config.mjs

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

0 commit comments

Comments
 (0)