From 5d984c2491c911443df5cfec1ff8146f994f5550 Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Thu, 12 Jun 2025 11:49:55 +0200 Subject: [PATCH 1/3] Update first release deployment configs --- .env.example | 10 ++++++++++ .env.production | 2 +- .gitignore | 1 + CHANGELOG.md | 3 +++ Dockerfile | 6 +++--- README.md | 20 +++++++++++++++++++- docker-compose.yml | 21 ++++++++++++++++++--- justfile | 23 +++++++++++++++++++++++ 8 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 .env.example create mode 100644 CHANGELOG.md create mode 100644 justfile diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0ecd089 --- /dev/null +++ b/.env.example @@ -0,0 +1,10 @@ +NODE_ENV=production +VITE_MODE=production + +APP_PORT=8181 + +VITE_API_BASE_URL=http://127.0.0.1:4242 + +VITE_KEYCLOAK_URL=http://localhost:8080/ +VITE_KEYCLOAK_REALM=dev +VITE_KEYCLOAK_CLIENT_ID=bff-dashboard diff --git a/.env.production b/.env.production index 16afe7a..8b13789 100644 --- a/.env.production +++ b/.env.production @@ -1 +1 @@ -VITE_API_BASE_URL=http://127.0.0.1:3338 + diff --git a/.gitignore b/.gitignore index 7f74190..f3d27ec 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ coverage/ tsconfig.app.tsbuildinfo tsconfig.node.tsbuildinfo *storybook.log +.env diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..02b7f99 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# 0.1.0 + +* Initial version diff --git a/Dockerfile b/Dockerfile index ce6a806..76d6038 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG NODE_ENV ARG VITE_MODE -FROM node:22.11.0-slim@sha256:f035ba7ffee18f67200e2eb8018e0f13c954ec16338f264940f701997e3c12da AS builder +FROM node:24.2.0-slim AS builder ARG NODE_ENV ARG VITE_MODE ENV NODE_ENV=${NODE_ENV:-production} @@ -11,13 +11,13 @@ WORKDIR /app COPY package*.json ./ -RUN npm install --no-fund --no-audit +RUN npm install --no-fund --no-audit --include=dev COPY . . RUN npm run build -- --mode=${VITE_MODE} -FROM nginx:1.27.4-alpine@sha256:4ff102c5d78d254a6f0da062b3cf39eaf07f01eec0927fd21e219d0af8bc0591 +FROM nginx:1.27.5-alpine COPY --from=builder /app/dist /usr/share/nginx/html diff --git a/README.md b/README.md index 1bfe6b4..497b774 100644 --- a/README.md +++ b/README.md @@ -7,17 +7,35 @@ npm install ``` -### Run +### Run Development ``` npm run dev ``` +### Run Docker +Copy `.env.example` to `.env` and adjust +``` +just build +just run +``` + ### shadcn Add a shadcn component: ```shell npx shadcn@canary add button ``` +## Configuration +`VITE_API_BASE_URL="http://localhost:4242"` needs to point to the Wildcat BFF Dashboard Envoy Service + +``` +VITE_KEYCLOAK_URL=http://localhost:8080/ +VITE_KEYCLOAK_REALM=dev +VITE_KEYCLOAK_CLIENT_ID=bff-dashboard +``` + +These are the keycloak url and realm settings for the JWT tokens authenticated by the Wildcat Dashboard Envoy service. + ## Resources - React: https://react.dev/ diff --git a/docker-compose.yml b/docker-compose.yml index 1f6cccf..ca25048 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,21 @@ - services: app: - build: . + build: + context: . + args: + NODE_ENV: ${NODE_ENV} + VITE_MODE: ${VITE_MODE} ports: - - "8080:80" + - "${APP_PORT}:80" + restart: unless-stopped + environment: + - VITE_API_BASE_URL=${VITE_API_BASE_URL} + - VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL} + - VITE_KEYCLOAK_REALM=${VITE_KEYCLOAK_REALM} + - VITE_KEYCLOAK_CLIENT_ID=${VITE_KEYCLOAK_CLIENT_ID} + healthcheck: + test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s diff --git a/justfile b/justfile new file mode 100644 index 0000000..5c9fcc3 --- /dev/null +++ b/justfile @@ -0,0 +1,23 @@ + +# print available targets +[group("project-agnostic")] +default: + @just --list --justfile {{justfile()}} + +# evaluate and print all just variables +[group("project-agnostic")] +evaluate: + @just --evaluate + +# print system information such as OS and architecture +[group("project-agnostic")] +system-info: + @echo "architecture: {{arch()}}" + @echo "os: {{os()}}" + @echo "os family: {{os_family()}}" + +build: + docker build -t wildcat/dashboard -f Dockerfile . + +run: + docker compose up From d77aa55a2b65045c59cd9cb057740bad92c48eb2 Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Thu, 12 Jun 2025 11:49:55 +0200 Subject: [PATCH 2/3] Pin docker hash --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 76d6038..68ec519 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG NODE_ENV ARG VITE_MODE -FROM node:24.2.0-slim AS builder +FROM node:24.2.0-slim@sha256:b30c143a092c7dced8e17ad67a8783c03234d4844ee84c39090c9780491aaf89 AS builder ARG NODE_ENV ARG VITE_MODE ENV NODE_ENV=${NODE_ENV:-production} @@ -17,7 +17,7 @@ COPY . . RUN npm run build -- --mode=${VITE_MODE} -FROM nginx:1.27.5-alpine +FROM nginx:1.27.5-alpine@sha256:65645c7bb6a0661892a8b03b89d0743208a18dd2f3f17a54ef4b76fb8e2f2a10 COPY --from=builder /app/dist /usr/share/nginx/html From d00f7976ed0fa649e5495416cb8a4f002a3b82b1 Mon Sep 17 00:00:00 2001 From: stefanbitcr Date: Thu, 12 Jun 2025 18:32:30 +0200 Subject: [PATCH 3/3] Change unit to e-IOU --- src/pages/balances/BalancesPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/balances/BalancesPage.tsx b/src/pages/balances/BalancesPage.tsx index a9f2e88..ea97c36 100644 --- a/src/pages/balances/BalancesPage.tsx +++ b/src/pages/balances/BalancesPage.tsx @@ -205,7 +205,7 @@ function useBalances() { : "0", unit: "BTC", }, - eiou: { amount: "0", unit: "eIOU" }, + eiou: { amount: "0", unit: "e-IOU" }, credit: { amount: creditQuery.data && "amount" in creditQuery.data ? String(creditQuery.data.amount) : "0", unit: creditQuery.data && "unit" in creditQuery.data ? String(creditQuery.data.unit) : "credit",