Skip to content

Commit 9453a77

Browse files
kaviththirangaKavith Lokuhewage
authored andcommitted
Add app-config.local.yaml template for simplified local development
Introduces a pre-configured app-config.local.yaml.example file to simplify local Backstage development with Kind cluster. Developers can now start developing with a single copy command instead of managing multiple environment variables. Key changes: - Add app-config.local.yaml.example with hardcoded Kind cluster values - Frontend: http://localhost:3000 - Backend: http://localhost:7007 - OpenChoreo API: http://api.openchoreo.localhost - Thunder IDP: http://sts.openchoreo.localhost - OAuth credentials from Kind cluster helm values - Update README.md with simplified Quick Start guide - Add developer-friendly comments to app-config.yaml Benefits: - Zero configuration needed for local development - No manual environment variable management - Works out-of-box with Kind cluster (make -f make/kind.mk install) - Gitignored, won't affect Docker builds or production Usage: cp app-config.local.yaml.example app-config.local.yaml && yarn start
1 parent c4483ca commit 9453a77

File tree

3 files changed

+133
-151
lines changed

3 files changed

+133
-151
lines changed

README.md

Lines changed: 53 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -31,181 +31,84 @@ Follow the setup [guide](https://openchoreo.dev/docs/getting-started/single-clus
3131
yarn install
3232
```
3333

34-
### 2. Environment Variables
34+
### 2. Local Development Setup with Kind Cluster
3535

36-
The application requires several environment variables for configuration. These can be set in your shell or via a `.env` file.
36+
**Quick Start (Recommended):**
3737

38-
#### Required Variables
38+
If you're running the OpenChoreo Kind cluster locally and want to connect Backstage (running at localhost:3000/7007) to it:
3939

4040
```bash
41-
# Backstage Base URL (used for both frontend and backend in production)
42-
# For local development, see "Local Development Considerations" below
43-
export BACKSTAGE_BASE_URL=http://localhost:3000
44-
45-
# Backend session secret (required for authentication cookies)
46-
export BACKEND_SECRET=your-secret-key-here
47-
48-
# OpenChoreo API configuration
49-
export OPENCHOREO_API_URL=http://localhost:8080/api/v1
50-
export OPENCHOREO_TOKEN=your-openchoreo-token # Optional
51-
52-
# Thunder IDP configuration (for authentication)
53-
export THUNDER_BASE_URL=http://localhost:8090
54-
# export THUNDER_TOKEN=your-thunder-token # Optional: uncomment if needed
55-
56-
# OAuth authentication credentials
57-
export OPENCHOREO_AUTH_CLIENT_ID=openchoreo-backstage-client
58-
export OPENCHOREO_AUTH_CLIENT_SECRET=your-client-secret
59-
export OPENCHOREO_AUTH_AUTHORIZATION_URL=http://localhost:8090/oauth2/authorize
60-
export OPENCHOREO_AUTH_TOKEN_URL=http://localhost:8090/oauth2/token
61-
```
62-
63-
#### Optional Variables
41+
# Copy the pre-configured local development template
42+
cp app-config.local.yaml.example app-config.local.yaml
6443

65-
```bash
66-
# GitHub integration (for catalog and templates)
67-
export GITHUB_TOKEN=your-github-personal-access-token
68-
```
69-
70-
#### Complete .env.example
71-
72-
Here's a complete example you can copy to create a `.env` file:
44+
# Start Backstage
45+
yarn start
7346

74-
```bash
75-
# Backstage Configuration
76-
BACKSTAGE_BASE_URL=http://localhost:3000
77-
BACKEND_SECRET=change-me-in-production
78-
79-
# OpenChoreo API
80-
OPENCHOREO_API_URL=http://localhost:8080/api/v1
81-
OPENCHOREO_TOKEN=
82-
83-
# Thunder IDP
84-
THUNDER_BASE_URL=http://localhost:8090
85-
# THUNDER_TOKEN=
86-
87-
# OAuth Authentication
88-
OPENCHOREO_AUTH_CLIENT_ID=openchoreo-backstage-client
89-
OPENCHOREO_AUTH_CLIENT_SECRET=backstage-portal-secret
90-
OPENCHOREO_AUTH_AUTHORIZATION_URL=http://localhost:8090/oauth2/authorize
91-
OPENCHOREO_AUTH_TOKEN_URL=http://localhost:8090/oauth2/token
92-
93-
# GitHub Integration (Optional)
94-
GITHUB_TOKEN=
47+
# Access at http://localhost:3000
9548
```
9649

97-
#### Local Development Considerations
98-
99-
**IMPORTANT:** The `BACKSTAGE_BASE_URL` variable is used for both `app.baseUrl` and `backend.baseUrl` in the configuration. This works well in production with ingress routing but requires special handling for local development:
100-
101-
**Development Mode (`yarn start`):**
102-
103-
- Frontend runs on **http://localhost:3000** (webpack dev server with hot reloading)
104-
- Backend runs on **http://localhost:7007** (API only)
105-
- These run as **separate processes on different ports**
106-
- The `@backstage/plugin-app-backend` is loaded but inactive (no built assets to serve)
107-
- Access the application at **http://localhost:3000**
50+
This is the **easiest way** to get started - all values are pre-configured to connect your local Backstage instance to the Kind cluster services (*.openchoreo.localhost).
10851

109-
**Production/Build Mode:**
52+
#### What's in app-config.local.yaml?
11053

111-
- Frontend must be built first: `yarn build:all`
112-
- Backend serves the built static assets via `@backstage/plugin-app-backend`
113-
- Both accessible from the same URL (e.g., **http://localhost:7007** or ingress URL)
54+
The `app-config.local.yaml.example` file contains hardcoded values for:
11455

115-
**Configuration Options for Local Development:**
56+
- **Frontend URL:** `http://localhost:3000`
57+
- **Backend URL:** `http://localhost:7007`
58+
- **OpenChoreo API:** `http://api.openchoreo.localhost` (Kind cluster)
59+
- **Thunder IDP:** `http://sts.openchoreo.localhost` (Kind cluster)
60+
- **OAuth Credentials:** Pre-configured from Kind cluster helm values
61+
- Client ID: `openchoreo-backstage-client`
62+
- Client Secret: `backstage-portal-secret`
11663

117-
Since frontend and backend run on separate ports in development, you need to configure the URLs accordingly:
64+
**Note:** `app-config.local.yaml` is gitignored and won't affect Docker builds or production deployments. The Docker build only uses `app-config.production.yaml`.
11865

119-
- **Option 1 (Recommended):** Manually override in `app-config.yaml`:
66+
#### Optional: GitHub Integration
12067

121-
```yaml
122-
app:
123-
baseUrl: http://localhost:3000 # Frontend URL
68+
If you need GitHub integration for catalog/templates, add your personal access token to `app-config.local.yaml`:
12469

125-
backend:
126-
baseUrl: http://localhost:7007 # Backend API URL
127-
cors:
128-
origin: http://localhost:3000 # Allow frontend to call backend
129-
```
130-
131-
- **Option 2:** Create `app-config.local.yaml` (not tracked in git) with the above overrides.
132-
133-
- **Option 3:** Use environment variables:
134-
```bash
135-
export BACKSTAGE_BASE_URL=http://localhost:3000 # For app.baseUrl
136-
# Note: You'll still need to override backend.baseUrl and cors.origin in config
137-
```
138-
139-
**Production/Kind with Ingress:**
70+
```yaml
71+
integrations:
72+
github:
73+
- host: github.com
74+
token: YOUR_GITHUB_TOKEN_HERE
75+
```
14076
141-
- Set `BACKSTAGE_BASE_URL` to your ingress URL (e.g., `http://openchoreo.localhost`)
142-
- The ingress routes both frontend and backend through the same origin
143-
- Both `app.baseUrl` and `backend.baseUrl` use the same value
77+
### 3. Configuration Files
14478
145-
### 3. Configuration
79+
The application uses three configuration files:
14680
147-
The application uses two primary configuration files:
81+
| File | Purpose | Used When |
82+
|------|---------|-----------|
83+
| `app-config.yaml` | Base configuration with environment variable placeholders | Referenced by both local and Docker builds |
84+
| `app-config.local.yaml` | Local development overrides (gitignored) | Local development with `yarn start` |
85+
| `app-config.production.yaml` | Production configuration | Docker builds, Kind cluster, production Kubernetes |
14886

149-
- `app-config.yaml` - Base configuration for local development (uses environment variables)
150-
- `app-config.production.yaml` - Production configuration
87+
**Configuration Loading Order:**
15188

152-
You can optionally create `app-config.local.yaml` for local overrides (this file is not tracked in git).
89+
Backstage CLI automatically loads configs in this order (later files override earlier ones):
90+
1. `app-config.yaml`
91+
2. `app-config.local.yaml` (if it exists)
15392

154-
#### Environment-Driven Configuration
93+
#### Advanced: Using Environment Variables
15594

156-
All configuration now uses environment variables for flexibility across deployment environments. Key configuration sections in `app-config.yaml`:
95+
If you prefer to use environment variables instead of `app-config.local.yaml`, you can set these in your shell:
15796

158-
```yaml
159-
# Backstage base URLs (from commit 5d84dd7)
160-
app:
161-
title: OpenChoreo Portal
162-
baseUrl: ${BACKSTAGE_BASE_URL} # Frontend URL
163-
164-
backend:
165-
baseUrl: ${BACKSTAGE_BASE_URL} # Backend API URL
166-
session:
167-
secret: ${BACKEND_SECRET} # Required for authentication cookies
168-
cors:
169-
origin: ${BACKSTAGE_BASE_URL} # CORS origin (should match frontend URL)
170-
171-
# OpenChoreo integration
172-
openchoreo:
173-
baseUrl: ${OPENCHOREO_API_URL}
174-
token: ${OPENCHOREO_TOKEN} # optional
175-
defaultOwner: 'platformengineer'
176-
schedule:
177-
frequency: 30 # seconds between catalog syncs
178-
timeout: 120 # request timeout
179-
180-
# Thunder IDP integration
181-
thunder:
182-
baseUrl: ${THUNDER_BASE_URL} # e.g., http://localhost:8090
183-
# token: ${THUNDER_TOKEN} # Optional: uncomment if needed
184-
defaultNamespace: 'default'
185-
schedule:
186-
frequency: 600 # seconds between runs (10 minutes)
187-
timeout: 300 # seconds for timeout (5 minutes)
188-
189-
# OAuth authentication provider
190-
auth:
191-
environment: development
192-
providers:
193-
default-idp:
194-
development:
195-
clientId: ${OPENCHOREO_AUTH_CLIENT_ID}
196-
clientSecret: ${OPENCHOREO_AUTH_CLIENT_SECRET}
197-
authorizationUrl: ${OPENCHOREO_AUTH_AUTHORIZATION_URL}
198-
tokenUrl: ${OPENCHOREO_AUTH_TOKEN_URL}
199-
scope: 'openid profile email'
200-
201-
# GitHub integration (optional)
202-
integrations:
203-
github:
204-
- host: github.com
205-
token: ${GITHUB_TOKEN}
97+
```bash
98+
export BACKSTAGE_BASE_URL=http://localhost:3000
99+
export BACKEND_SECRET=your-secret-key-here
100+
export OPENCHOREO_API_URL=http://api.openchoreo.localhost
101+
export THUNDER_BASE_URL=http://sts.openchoreo.localhost
102+
export OPENCHOREO_AUTH_CLIENT_ID=openchoreo-backstage-client
103+
export OPENCHOREO_AUTH_CLIENT_SECRET=backstage-portal-secret
104+
export OPENCHOREO_AUTH_AUTHORIZATION_URL=http://sts.openchoreo.localhost/oauth2/authorize
105+
export OPENCHOREO_AUTH_TOKEN_URL=http://sts.openchoreo.localhost/oauth2/token
106+
export GITHUB_TOKEN=your-github-token # Optional
206107
```
207108

208-
**Note:** In production deployments (Kubernetes/Helm), these environment variables are automatically injected by the Helm chart. See the [openchoreo/openchoreo repository](https://github.com/openchoreo/openchoreo) deployment configuration at `install/helm/openchoreo/templates/backstage/deployment.yaml` for details.
109+
Then run: `yarn start`
110+
111+
**Note:** In production deployments (Kubernetes/Helm), environment variables are automatically injected by the Helm chart. See the [openchoreo/openchoreo repository](https://github.com/openchoreo/openchoreo) at `install/helm/openchoreo/templates/backstage/deployment.yaml` for details.
209112

210113
### 4. Start the Application
211114

app-config.local.yaml.example

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Local Development Configuration for Backstage with Kind Cluster
2+
#
3+
# This file contains pre-configured values for running Backstage locally
4+
# (at localhost:3000 and localhost:7007) while connecting to services
5+
# running in a Kind cluster (*.openchoreo.localhost).
6+
#
7+
# Quick Start:
8+
# 1. Copy this file: cp app-config.local.yaml.example app-config.local.yaml
9+
# 2. Start Backstage: yarn start
10+
# 3. Access at: http://localhost:3000
11+
#
12+
# Note: app-config.local.yaml is gitignored and won't affect production builds.
13+
# The Docker build only uses app-config.production.yaml.
14+
15+
app:
16+
# Backstage frontend URL (local development)
17+
baseUrl: http://localhost:3000
18+
19+
backend:
20+
# Backstage backend URL (local development)
21+
baseUrl: http://localhost:7007
22+
23+
# CORS configuration for local development
24+
cors:
25+
origin: http://localhost:3000
26+
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
27+
credentials: true
28+
29+
# Session secret for authentication cookies (development only)
30+
session:
31+
secret: dev-secret-change-in-production
32+
cookie:
33+
secure: false
34+
sameSite: 'lax'
35+
httpOnly: true
36+
path: /
37+
maxAge: 86400000 # 24 hours
38+
39+
# OpenChoreo API configuration (Kind cluster)
40+
openchoreo:
41+
baseUrl: http://api.openchoreo.localhost
42+
# token: "" # Optional: uncomment if you need API authentication
43+
44+
# Thunder IDP configuration (Kind cluster)
45+
thunder:
46+
baseUrl: http://sts.openchoreo.localhost
47+
48+
# OAuth authentication configuration (Kind cluster)
49+
auth:
50+
environment: development
51+
providers:
52+
default-idp:
53+
development:
54+
# OAuth credentials from Kind cluster helm values
55+
# (see openchoreo/install/dev/openchoreo-values.yaml)
56+
clientId: openchoreo-backstage-client
57+
clientSecret: backstage-portal-secret
58+
authorizationUrl: http://sts.openchoreo.localhost/oauth2/authorize
59+
tokenUrl: http://sts.openchoreo.localhost/oauth2/token
60+
scope: 'openid profile email'
61+
62+
# GitHub integration (optional)
63+
# Uncomment and add your personal access token if you need GitHub integration
64+
# integrations:
65+
# github:
66+
# - host: github.com
67+
# token: YOUR_GITHUB_TOKEN_HERE

app-config.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Base Backstage Configuration
2+
#
3+
# This file contains the base configuration with environment variable placeholders.
4+
# Environment variables are used in Docker builds and production deployments.
5+
#
6+
# For local development with Kind cluster:
7+
# 1. Copy the example file: cp app-config.local.yaml.example app-config.local.yaml
8+
# 2. Run: yarn start
9+
# 3. The app-config.local.yaml will automatically override values from this file
10+
#
11+
# Note: app-config.local.yaml is gitignored and won't affect Docker builds.
12+
# Docker builds only use app-config.production.yaml.
13+
114
app:
215
title: OpenChoreo Portal
316
# Environment variable is injected by Helm chart (see https://github.com/openchoreo/openchoreo install/helm/openchoreo/templates/backstage/deployment.yaml)
@@ -9,7 +22,6 @@ organization:
922
name: OpenChoreo
1023

1124
backend:
12-
https: true
1325
# Used for enabling authentication, secret is shared by all backend plugins
1426
# See https://backstage.io/docs/auth/service-to-service-auth for
1527
# information on the format

0 commit comments

Comments
 (0)