Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/job_test_dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
DATABASE_NAME: unkey
UNKEY_WORKSPACE_ID: "not-empty"
UNKEY_API_ID: "not-empty"
AGENT_URL: "http://localhost:8080"
AGENT_TOKEN: "not-empty"
VAULT_URL: "http://localhost:8060"
VAULT_TOKEN: "not-empty"
AUTH_PROVIDER: "workos"
WORKOS_CLIENT_ID: "client_"
WORKOS_API_KEY: "sk_test_"
Expand Down
156 changes: 78 additions & 78 deletions dev/k8s/manifests/dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,88 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: dashboard
namespace: unkey
labels:
app: dashboard
spec:
replicas: 1
selector:
matchLabels:
app: dashboard
template:
metadata:
labels:
name: dashboard
namespace: unkey
labels:
app: dashboard
spec:
initContainers:
- name: wait-for-dependencies
image: busybox:1.36
command:
- sh
- -c
- |
until nc -z planetscale 3900 && nc -z agent 8080; do
echo waiting for dependencies
sleep 2
done
containers:
- name: dashboard
image: unkey/dashboard:latest
imagePullPolicy: Never
ports:
- containerPort: 3000
env:
# Database configuration
- name: DATABASE_HOST
value: "planetscale:3900"
# ClickHouse configuration
- name: CLICKHOUSE_URL
value: "http://default:password@clickhouse:8123"
# Environment
- name: NODE_ENV
value: "production"
# Instance identification
- name: UNKEY_PLATFORM
value: "kubernetes"
- name: UNKEY_REGION
value: "local"
- name: CTRL_URL
value: "http://ctrl-api:7091"
- name: CTRL_API_KEY
value: "your-local-dev-key"
# Agent configuration
- name: AGENT_URL
value: "http://agent:8080"
- name: AGENT_TOKEN
value: "agent-auth-secret"
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 30
periodSeconds: 10
spec:
replicas: 1
selector:
matchLabels:
app: dashboard
template:
metadata:
labels:
app: dashboard
spec:
initContainers:
- name: wait-for-dependencies
image: busybox:1.36
command:
- sh
- -c
- |
until nc -z planetscale 3900 && nc -z agent 8080; do
echo waiting for dependencies
sleep 2
done
Comment thread
Flo4604 marked this conversation as resolved.
containers:
- name: dashboard
image: unkey/dashboard:latest
imagePullPolicy: Never
ports:
- containerPort: 3000
env:
# Database configuration
- name: DATABASE_HOST
value: "planetscale:3900"
# ClickHouse configuration
- name: CLICKHOUSE_URL
value: "http://default:password@clickhouse:8123"
# Environment
- name: NODE_ENV
value: "production"
# Instance identification
- name: UNKEY_PLATFORM
value: "kubernetes"
- name: UNKEY_REGION
value: "local"
- name: CTRL_URL
value: "http://ctrl-api:7091"
- name: CTRL_API_KEY
value: "your-local-dev-key"
# Agent configuration
- name: VAULT_URL
value: "http://vault:8060"
- name: VAULT_TOKEN
value: "vault-test-token-123"
Comment thread
Flo4604 marked this conversation as resolved.
readinessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 10
periodSeconds: 5
livenessProbe:
httpGet:
path: /
port: 3000
initialDelaySeconds: 30
periodSeconds: 10

---
apiVersion: v1
kind: Service
metadata:
name: dashboard
namespace: unkey
labels:
app: dashboard
name: dashboard
namespace: unkey
labels:
app: dashboard
spec:
selector:
app: dashboard
ports:
- name: http
port: 3000
targetPort: 3000
protocol: TCP
type: LoadBalancer
selector:
app: dashboard
ports:
- name: http
port: 3000
targetPort: 3000
protocol: TCP
type: LoadBalancer
4 changes: 4 additions & 0 deletions web/apps/dashboard/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ UNKEY_API_ID=
CTRL_URL=http://127.0.0.1:7091
CTRL_API_KEY="your-local-dev-key"

# Vault
VAULT_URL=http://localhost:8060
VAULT_TOKEN=vault-test-token-123

# ClickHouse
CLICKHOUSE_URL=

Expand Down
4 changes: 2 additions & 2 deletions web/apps/dashboard/lib/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const env = () =>

RATELIMIT_DEMO_ROOT_KEY: z.string().optional(),

AGENT_URL: z.url(),
AGENT_TOKEN: z.string(),
VAULT_URL: z.url(),
VAULT_TOKEN: z.string(),

CTRL_URL: z.url().optional(),
CTRL_API_KEY: z.string().optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { z } from "zod";
import { workspaceProcedure } from "../../../trpc";

const vault = new Vault({
baseUrl: env().AGENT_URL,
token: env().AGENT_TOKEN,
baseUrl: env().VAULT_URL,
token: env().VAULT_TOKEN,
});

const envVarInputSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { z } from "zod";
import { workspaceProcedure } from "../../../trpc";

const vault = new Vault({
baseUrl: env().AGENT_URL,
token: env().AGENT_TOKEN,
baseUrl: env().VAULT_URL,
token: env().VAULT_TOKEN,
});

export const decryptEnvVar = workspaceProcedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { z } from "zod";
import { workspaceProcedure } from "../../../trpc";

const vault = new Vault({
baseUrl: env().AGENT_URL,
token: env().AGENT_TOKEN,
baseUrl: env().VAULT_URL,
token: env().VAULT_TOKEN,
});

export const updateEnvVar = workspaceProcedure
Expand Down
4 changes: 2 additions & 2 deletions web/apps/dashboard/lib/trpc/routers/key/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { newKey } from "@unkey/keys";
import { ratelimit, withRatelimit, workspaceProcedure } from "../../trpc";

const vault = new Vault({
baseUrl: env().AGENT_URL,
token: env().AGENT_TOKEN,
baseUrl: env().VAULT_URL,
token: env().VAULT_TOKEN,
});

export const createKey = workspaceProcedure
Expand Down
6 changes: 3 additions & 3 deletions web/apps/dashboard/local.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pnpm install --frozen-lockfile

docker compose -f ../../../dev/docker-compose.yaml up -d planetscale agent clickhouse apiv2_lb
docker compose -f ../../../dev/docker-compose.yaml up -d planetscale vault clickhouse apiv2_lb

# Write environment variables to .env if it doesn't exist
if [ ! -f .env ]; then
Expand All @@ -18,8 +18,8 @@ UNKEY_API_ID="api_local_root_keys"

AUTH_PROVIDER="local"

AGENT_URL="http://localhost:8080"
AGENT_TOKEN="agent-auth-secret"
VAULT_URL="http://localhost:8060"
VAULT_TOKEN="vault-test-token-123"

CLICKHOUSE_URL="http://default:password@localhost:8123"

Expand Down
6 changes: 3 additions & 3 deletions web/tools/local/src/cmd/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export async function bootstrapApi(resources: {
UNKEY_WORKSPACE_ID: resources.workspace.id,
UNKEY_API_ID: resources.api.id,
},
Agent: {
AGENT_URL: "http://localhost:8080",
AGENT_TOKEN: "agent-auth-secret",
Vault: {
VAULT_URL: "http://localhost:8060",
VAULT_TOKEN: "vault-test-token-123",
},
Logging: {
EMIT_METRICS_LOGS: "false",
Expand Down
6 changes: 3 additions & 3 deletions web/tools/local/src/cmd/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export async function bootstrapDashboard(resources: {
Auth: {
AUTH_PROVIDER: "local",
},
Agent: {
AGENT_URL: "http://localhost:8080",
AGENT_TOKEN: "agent-auth-secret",
Vault: {
VAULT_URL: "http://localhost:8060",
VAULT_TOKEN: "vault-test-token-123",
},
Clickhouse: {
CLICKHOUSE_URL: "http://default:password@localhost:8123",
Expand Down
4 changes: 2 additions & 2 deletions web/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"env": [
"NEXT_PUBLIC_\\*",
"\\!NEXT_PUBLIC_VERCEL_\\*",
"AGENT_URL",
"AGENT_TOKEN",
"VAULT_URL",
"VAULT_TOKEN",
"DATABASE_PASSWORD",
"DATABASE_USERNAME",
"DATABASE_HOST",
Expand Down
Loading