Skip to content

Commit b38638e

Browse files
[flagd-ui] improved flagd-ui
1 parent 55cb083 commit b38638e

39 files changed

+2425
-1030
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}

CHANGELOG.md

+406-404
Large diffs are not rendered by default.

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ start:
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."
137137
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
138+
@echo "Go to http://localhost:8080/feature/ to to change feature flags."
138139

139140
.PHONY: start-minimal
140141
start-minimal:
@@ -146,6 +147,7 @@ start-minimal:
146147
@echo "Go to http://localhost:8080/grafana/ for the Grafana UI."
147148
@echo "Go to http://localhost:8080/loadgen/ for the Load Generator UI."
148149
@echo "Go to https://opentelemetry.io/docs/demo/feature-flags/ to learn how to change feature flags."
150+
@echo "Go to http://localhost:8080/feature/ to to change feature flags."
149151

150152
.PHONY: stop
151153
stop:

docker-compose.yml

+41-12
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ services:
182182
- CURRENCY_SERVICE_PORT
183183
- VERSION=${IMAGE_VERSION}
184184
- OTEL_EXPORTER_OTLP_ENDPOINT
185-
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.name=currencyservice # The C++ SDK does not support OTEL_SERVICE_NAME
185+
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.name=currencyservice # The C++ SDK does not support OTEL_SERVICE_NAME
186186
depends_on:
187187
otelcol:
188188
condition: service_started
@@ -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:
@@ -517,7 +521,7 @@ services:
517521
deploy:
518522
resources:
519523
limits:
520-
memory: 500M # This is high to enable supporting the recommendationCache feature flag use case
524+
memory: 500M # This is high to enable supporting the recommendationCache feature flag use case
521525
restart: unless-stopped
522526
ports:
523527
- "${RECOMMENDATION_SERVICE_PORT}"
@@ -585,17 +589,39 @@ services:
585589
- FLAGD_METRICS_EXPORTER=otel
586590
- OTEL_RESOURCE_ATTRIBUTES
587591
- OTEL_SERVICE_NAME=flagd
588-
command: [
589-
"start",
590-
"--uri",
591-
"file:./etc/flagd/demo.flagd.json"
592-
]
592+
command: ["start", "--uri", "file:./etc/flagd/demo.flagd.json"]
593593
ports:
594594
- 8013
595595
volumes:
596596
- ./src/flagd:/etc/flagd
597-
logging:
598-
*logging
597+
logging: *logging
598+
599+
#Flagd-ui, UI for configuring the feature flagging service
600+
flagd-ui:
601+
image: ${IMAGE_NAME}:${DEMO_VERSION}-flagd-ui
602+
container_name: flagd-ui
603+
build:
604+
context: ./
605+
dockerfile: ${FLAGD_UI_DOCKERFILE}
606+
deploy:
607+
resources:
608+
limits:
609+
memory: 150M
610+
restart: unless-stopped
611+
environment:
612+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
613+
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
614+
- OTEL_RESOURCE_ATTRIBUTES
615+
- OTEL_SERVICE_NAME=flagd-ui
616+
ports:
617+
- "${FLAGD_UI_PORT}"
618+
depends_on:
619+
otelcol:
620+
condition: service_started
621+
flagd:
622+
condition: service_started
623+
volumes:
624+
- ./src/flagd:/app/data
599625

600626
# Kafka used by Checkout, Accounting, and Fraud Detection services
601627
kafka:
@@ -640,7 +666,6 @@ services:
640666
- "${VALKEY_PORT}"
641667
logging: *logging
642668

643-
644669
# ********************
645670
# Telemetry Components
646671
# ********************
@@ -660,7 +685,7 @@ services:
660685
memory: 400M
661686
restart: unless-stopped
662687
ports:
663-
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
688+
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
664689
- "${OTEL_COLLECTOR_PORT_GRPC}"
665690
environment:
666691
- METRICS_STORAGE_TYPE=prometheus
@@ -693,7 +718,11 @@ services:
693718
limits:
694719
memory: 200M
695720
restart: unless-stopped
696-
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
721+
command:
722+
[
723+
"--config=/etc/otelcol-config.yml",
724+
"--config=/etc/otelcol-config-extras.yml",
725+
]
697726
user: 0:0
698727
volumes:
699728
- ${HOST_FILESYSTEM}:/hostfs:ro

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

+2-21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Flagd-ui
2+
13
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).
24

35
## Getting Started
@@ -13,24 +15,3 @@ pnpm dev
1315
# or
1416
bun dev
1517
```
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.
22-
23-
## Learn More
24-
25-
To learn more about Next.js, take a look at the following resources:
26-
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-
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.
35-
36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

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)