Skip to content

Commit

Permalink
[flagd-ui] improved flagd-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
maindotmarcell committed Sep 25, 2024
1 parent 55cb083 commit e33d518
Show file tree
Hide file tree
Showing 37 changed files with 2,389 additions and 1,009 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ SHIPPING_SERVICE_DOCKERFILE=./src/shippingservice/Dockerfile
FLAGD_HOST=flagd
FLAGD_PORT=8013

#flagd-ui
FLAGD_UI_HOST=flagd-ui
FLAGD_UI_PORT=4000
FLAGD_UI_DOCKERFILE=./src/flagd-ui/Dockerfile

# Kafka
KAFKA_SERVICE_PORT=9092
KAFKA_SERVICE_ADDR=kafka:${KAFKA_SERVICE_PORT}
Expand Down
810 changes: 406 additions & 404 deletions CHANGELOG.md

Large diffs are not rendered by default.

53 changes: 41 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ services:
- CURRENCY_SERVICE_PORT
- VERSION=${IMAGE_VERSION}
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.name=currencyservice # The C++ SDK does not support OTEL_SERVICE_NAME
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.name=currencyservice # The C++ SDK does not support OTEL_SERVICE_NAME

Check warning on line 185 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

185:91 [comments] too few spaces before comment
depends_on:
otelcol:
condition: service_started
Expand Down Expand Up @@ -340,6 +340,8 @@ services:
- ENVOY_PORT
- FLAGD_HOST
- FLAGD_PORT
- FLAGD_UI_HOST
- FLAGD_UI_PORT
depends_on:
frontend:
condition: service_started
Expand All @@ -349,6 +351,8 @@ services:
condition: service_started
grafana:
condition: service_started
flagd-ui:
condition: service_started

# Imageprovider
imageprovider:
Expand Down Expand Up @@ -517,7 +521,7 @@ services:
deploy:
resources:
limits:
memory: 500M # This is high to enable supporting the recommendationCache feature flag use case
memory: 500M # This is high to enable supporting the recommendationCache feature flag use case

Check warning on line 524 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

524:24 [comments] too few spaces before comment
restart: unless-stopped
ports:
- "${RECOMMENDATION_SERVICE_PORT}"
Expand Down Expand Up @@ -585,17 +589,39 @@ services:
- FLAGD_METRICS_EXPORTER=otel
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=flagd
command: [
"start",
"--uri",
"file:./etc/flagd/demo.flagd.json"
]
command: ["start", "--uri", "file:./etc/flagd/demo.flagd.json"]
ports:
- 8013
volumes:
- ./src/flagd:/etc/flagd
logging:
*logging
logging: *logging

#Flagd-ui, UI for configuring the feature flagging service

Check warning on line 599 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

599:4 [comments] missing starting space in comment
flagd-ui:
image: ${IMAGE_NAME}:${DEMO_VERSION}-flagd-ui
container_name: flagd-ui
build:
context: ./
dockerfile: ${FLAGD_UI_DOCKERFILE}
deploy:
resources:
limits:
memory: 150M
restart: unless-stopped
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=flagd-ui
ports:
- "${FLAGD_UI_PORT}"
depends_on:
otelcol:
condition: service_started
flagd:
condition: service_started
volumes:
- ./src/flagd:/app/data

# Kafka used by Checkout, Accounting, and Fraud Detection services
kafka:
Expand Down Expand Up @@ -640,7 +666,6 @@ services:
- "${VALKEY_PORT}"
logging: *logging


# ********************
# Telemetry Components
# ********************
Expand All @@ -660,7 +685,7 @@ services:
memory: 400M
restart: unless-stopped
ports:
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
- "${JAEGER_SERVICE_PORT}" # Jaeger UI

Check warning on line 688 in docker-compose.yml

View workflow job for this annotation

GitHub Actions / yamllint

688:34 [comments] too few spaces before comment
- "${OTEL_COLLECTOR_PORT_GRPC}"
environment:
- METRICS_STORAGE_TYPE=prometheus
Expand Down Expand Up @@ -693,7 +718,11 @@ services:
limits:
memory: 200M
restart: unless-stopped
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
command:
[
"--config=/etc/otelcol-config.yml",
"--config=/etc/otelcol-config-extras.yml",
]
user: 0:0
volumes:
- ${HOST_FILESYSTEM}:/hostfs:ro
Expand Down
56 changes: 56 additions & 0 deletions src/flagd-ui/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Dependency directories
node_modules
/.pnp
.pnp.js

# Next.js build output
.next
out

# Testing
/coverage

# Production
/build

# Misc
.DS_Store
*.pem

# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Local env files
.env*.local

# Vercel
.vercel

# TypeScript
*.tsbuildinfo
next-env.d.ts

# IDE/Editor folders
.idea
.vscode

# OS generated files
Thumbs.db

# Temporary files
*.swp
*.swo

# Git related
.git
.gitignore

# Docker related
Dockerfile
.dockerignore

# Other
README.md
*.log
3 changes: 3 additions & 0 deletions src/flagd-ui/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["prettier-plugin-tailwindcss"]
}
37 changes: 32 additions & 5 deletions src/flagd-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
FROM node:20.15.1-slim
WORKDIR /data
COPY . .
RUN npm install
CMD [ "/bin/bash -c 'npm run dev'" ]
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

FROM node:20 AS builder

WORKDIR /app

COPY ./src/flagd-ui/package*.json ./

RUN npm ci

COPY ./src/flagd-ui/. ./

RUN npm run build

# -----------------------------------------------------------------------------

FROM node:20-alpine

WORKDIR /app

COPY ./src/flagd-ui/package*.json ./

RUN npm ci --only=production

COPY --from=builder /app/src/instrumentation.ts ./instrumentation.ts
COPY --from=builder /app/next.config.mjs ./next.config.mjs

COPY --from=builder /app/.next ./.next

EXPOSE 4000

CMD ["npm", "start"]
105 changes: 0 additions & 105 deletions src/flagd-ui/data/output.json

This file was deleted.

7 changes: 6 additions & 1 deletion src/flagd-ui/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
experimental: {
instrumentationHook: true,
},
basePath: "/feature",
};

export default nextConfig;
Loading

0 comments on commit e33d518

Please sign in to comment.