Skip to content

Commit 1ee06c1

Browse files
committed
Merge from main
2 parents 511502a + e794913 commit 1ee06c1

File tree

348 files changed

+39474
-6935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

348 files changed

+39474
-6935
lines changed

.env.example

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Tanzu GenAI Showcase - Environment Variables
2+
# This file serves as a template for setting up GitHub repository secrets
3+
# Use the create-gh-secrets.sh script to create GitHub secrets from your .env file
4+
5+
# ===== Cloud Foundry Authentication =====
6+
# Required for authenticating with Cloud Foundry during deployment
7+
CF_PASSWORD=your_cf_password_here # Used by all projects for CF authentication with username/password
8+
CF_SSO_REFRESH_TOKEN=your_sso_refresh_token_here # Alternative to CF_PASSWORD when using SSO authentication
9+
10+
# ===== Project-Specific API Keys =====
11+
12+
# ----- dotnet-extensions-ai -----
13+
# Travel Advisor application using .NET and AI extensions
14+
GOOGLEMAPS_API_KEY=your_key_here # Required for location services
15+
# Obtain from: https://developers.google.com/maps/documentation/javascript/get-api-key
16+
17+
# ----- go-fiber-langchaingo -----
18+
# Congress chatbot using Go Fiber and LangChain
19+
CONGRESS_API_KEY=your_key_here # Required for accessing Congress API
20+
# Obtain from: https://api.congress.gov/sign-up/
21+
22+
# ----- java-spring-ai-mcp -----
23+
# Flight tracker application using Spring AI and MCP
24+
AVIATION_STACK_ACCESS_KEY=your_key_here # Used by java-spring-ai-mcp/server for flight data
25+
# Obtain from: https://aviationstack.com/signup/free
26+
OPENAI_API_KEY=your_key_here # Used by java-spring-ai-mcp/client and other projects
27+
# Obtain from: https://platform.openai.com/api-keys
28+
29+
# ----- java-spring-langgraph-mcp-angular -----
30+
# Event finder application using Spring, LangGraph, and Angular
31+
TICKETMASTER_API_KEY=your_key_here # Required for event data
32+
# Obtain from: https://developer.ticketmaster.com/products-and-docs/apis/getting-started/
33+
CITIES_API_KEY=your_key_here # Required for city data
34+
# Obtain from: https://api.api-ninjas.com/v1/city
35+
36+
# ----- js-langchain-react -----
37+
# News aggregator using LangChain and React
38+
NEWS_API_KEY=your_key_here # Required for news data (also used by php-symfony-neuron)
39+
# Obtain from: https://newsapi.org/register
40+
LLM_API_KEY=your_key_here # Maps to API_KEY in the application
41+
# Use your OpenAI API key or other LLM provider key
42+
43+
# ----- php-symfony-neuron -----
44+
# Financial advisor using PHP Symfony and Neuron
45+
STOCK_API_KEY=your_key_here # Required for stock market data
46+
# Obtain from: https://www.alphavantage.co/support/#api-key
47+
EDGAR_API_KEY=your_key_here # Required for SEC EDGAR database access
48+
# Obtain from: https://www.sec.gov/edgar/sec-api-documentation
49+
LINKEDIN_CLIENT_ID=your_id_here # Required for LinkedIn integration
50+
LINKEDIN_CLIENT_SECRET=your_secret_here # Required for LinkedIn integration
51+
# Obtain both from: https://www.linkedin.com/developers/apps/new
52+
53+
# ----- py-django-crewai -----
54+
# Movie recommendation chatbot using Django and CrewAI
55+
DJANGO_SECRET_KEY=your_secret_key_here # Required for Django security
56+
# Generate with: python -c "import secrets; print(secrets.token_urlsafe(50))"
57+
TMDB_API_KEY=your_key_here # Required for movie database access
58+
# Obtain from: https://www.themoviedb.org/signup
59+
SERPAPI_API_KEY=your_key_here # Required for web search capabilities
60+
# Obtain from: https://serpapi.com/users/sign_up
61+
62+
# ----- ruby-sinatra-fastmcp -----
63+
# Flight tracking bot using Ruby Sinatra and FastMCP
64+
AVIATIONSTACK_API_KEY=your_key_here # Required for flight data
65+
# Obtain from: https://aviationstack.com/signup/free

.github/workflows/cf-auth.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Cloud Foundry Authentication
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cf_api:
7+
required: true
8+
type: string
9+
description: 'Cloud Foundry API Endpoint'
10+
cf_username:
11+
required: false
12+
type: string
13+
description: 'Cloud Foundry Username (not required if using SSO)'
14+
use_sso:
15+
required: false
16+
type: boolean
17+
default: false
18+
description: 'Whether to use SSO authentication instead of username/password'
19+
secrets:
20+
CF_PASSWORD:
21+
required: false
22+
description: 'Cloud Foundry Password (not required if using SSO)'
23+
CF_SSO_REFRESH_TOKEN:
24+
required: false
25+
description: 'Cloud Foundry SSO Refresh Token (not required if using username/password)'
26+
27+
jobs:
28+
authenticate:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Install CF CLI v8
32+
run: |
33+
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
34+
echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
35+
sudo apt-get update
36+
sudo apt-get install cf8-cli
37+
38+
- name: Authenticate to Cloud Foundry
39+
run: |
40+
cf api "${{ inputs.cf_api }}"
41+
42+
# Determine authentication method
43+
if [[ "${{ inputs.use_sso }}" == "true" ]]; then
44+
echo "Using SSO authentication with refresh token"
45+
cf auth --sso-passcode "${{ secrets.CF_SSO_REFRESH_TOKEN }}"
46+
else
47+
echo "Using username/password authentication"
48+
cf auth "${{ inputs.cf_username }}" "${{ secrets.CF_PASSWORD }}"
49+
fi
50+
51+
# Verify authentication was successful
52+
cf target || { echo "Authentication failed"; exit 1; }
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Cloud Foundry Service Creation
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
genai_service_name:
7+
required: false
8+
type: string
9+
description: 'Name of the GenAI service to create'
10+
genai_plan:
11+
required: false
12+
type: string
13+
description: 'GenAI Service Plan Name'
14+
db_service_name:
15+
required: false
16+
type: string
17+
description: 'Name of the database service to create'
18+
db_service_type:
19+
required: false
20+
type: string
21+
default: 'postgresql'
22+
description: 'Database Service Type (e.g., postgresql, mysql)'
23+
db_plan:
24+
required: false
25+
type: string
26+
description: 'Database Service Plan Name'
27+
ups_name:
28+
required: false
29+
type: string
30+
description: 'Name of the user-provided service to create'
31+
ups_credentials:
32+
required: false
33+
type: string
34+
description: 'JSON string of credentials for the user-provided service'
35+
secrets:
36+
UPS_CREDENTIALS:
37+
required: false
38+
description: 'Secret credentials for user-provided service'
39+
40+
jobs:
41+
create_services:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: Create GenAI Service
45+
if: inputs.genai_service_name != '' && inputs.genai_plan != ''
46+
run: |
47+
if ! cf service "${{ inputs.genai_service_name }}"; then
48+
echo "Creating GenAI service: ${{ inputs.genai_service_name }}"
49+
cf create-service genai "${{ inputs.genai_plan }}" "${{ inputs.genai_service_name }}" -t genai,llm || echo "Service creation might have failed or already exists"
50+
else
51+
echo "GenAI service ${{ inputs.genai_service_name }} already exists."
52+
fi
53+
continue-on-error: true
54+
55+
- name: Create Database Service
56+
if: inputs.db_service_name != '' && inputs.db_plan != ''
57+
run: |
58+
if ! cf service "${{ inputs.db_service_name }}"; then
59+
echo "Creating DB service: ${{ inputs.db_service_name }}"
60+
cf create-service "${{ inputs.db_service_type }}" "${{ inputs.db_plan }}" "${{ inputs.db_service_name }}" || echo "DB Service creation might have failed or already exists"
61+
else
62+
echo "DB service ${{ inputs.db_service_name }} already exists."
63+
fi
64+
continue-on-error: true
65+
66+
- name: Create User-Provided Service
67+
if: inputs.ups_name != ''
68+
run: |
69+
if ! cf service "${{ inputs.ups_name }}"; then
70+
echo "Creating user-provided service: ${{ inputs.ups_name }}"
71+
72+
# Use provided credentials JSON if available, otherwise use secret
73+
if [[ -n "${{ inputs.ups_credentials }}" ]]; then
74+
cf create-user-provided-service "${{ inputs.ups_name }}" -p '${{ inputs.ups_credentials }}' || echo "UPS creation might have failed or already exists"
75+
elif [[ -n "${{ secrets.UPS_CREDENTIALS }}" ]]; then
76+
cf create-user-provided-service "${{ inputs.ups_name }}" -p '${{ secrets.UPS_CREDENTIALS }}' || echo "UPS creation might have failed or already exists"
77+
else
78+
echo "No credentials provided for user-provided service"
79+
exit 1
80+
fi
81+
else
82+
echo "UPS ${{ inputs.ups_name }} already exists."
83+
fi
84+
continue-on-error: true

.github/workflows/cf-deploy.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Cloud Foundry Application Deployment
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
project_path:
7+
required: true
8+
type: string
9+
description: 'Path to the project directory'
10+
env_vars:
11+
required: false
12+
type: string
13+
description: 'JSON string of environment variables to set'
14+
random_route:
15+
required: false
16+
type: boolean
17+
default: false
18+
description: 'Whether to use a random route for the application'
19+
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Download environment variables artifact
25+
uses: actions/download-artifact@v4
26+
with:
27+
name: env-vars
28+
path: ./
29+
continue-on-error: true
30+
- name: Push Application to Cloud Foundry
31+
working-directory: ${{ inputs.project_path }}
32+
run: |
33+
# Determine app name from manifest or project name
34+
APP_NAME=$(grep 'name:' manifest.yml | head -n 1 | awk '{print $2}')
35+
if [ -z "$APP_NAME" ]; then
36+
APP_NAME=$(basename "${{ inputs.project_path }}") # Fallback to directory name
37+
fi
38+
echo "Deploying application: $APP_NAME from project: ${{ inputs.project_path }}"
39+
40+
# Push the application without starting it
41+
if [ "${{ inputs.random_route }}" == "true" ]; then
42+
echo "Pushing with random route..."
43+
cf push "$APP_NAME" -f manifest.yml --no-start --random-route || echo "cf push failed, check logs."
44+
else
45+
echo "Pushing with route from manifest..."
46+
cf push "$APP_NAME" -f manifest.yml --no-start || echo "cf push failed, check logs."
47+
fi
48+
49+
- name: Set Input Environment Variables
50+
working-directory: ${{ inputs.project_path }}
51+
if: inputs.env_vars != ''
52+
run: |
53+
APP_NAME=$(grep 'name:' manifest.yml | head -n 1 | awk '{print $2}')
54+
if [ -z "$APP_NAME" ]; then
55+
APP_NAME=$(basename "${{ inputs.project_path }}")
56+
fi
57+
58+
echo "Setting input environment variables..."
59+
ENV_VARS_JSON='${{ inputs.env_vars }}'
60+
for key in $(echo "$ENV_VARS_JSON" | jq -r 'keys[]'); do
61+
value=$(echo "$ENV_VARS_JSON" | jq -r --arg key "$key" '.[$key]')
62+
echo "Setting $key from inputs"
63+
cf set-env "$APP_NAME" "$key" "$value"
64+
done
65+
66+
- name: Set Environment Variables from Artifact
67+
working-directory: ${{ inputs.project_path }}
68+
run: |
69+
if [ -f "../env_vars.json" ]; then
70+
APP_NAME=$(grep 'name:' manifest.yml | head -n 1 | awk '{print $2}')
71+
if [ -z "$APP_NAME" ]; then
72+
APP_NAME=$(basename "${{ inputs.project_path }}")
73+
fi
74+
75+
echo "Setting environment variables from artifact..."
76+
ENV_VARS_JSON=$(cat ../env_vars.json)
77+
for key in $(echo "$ENV_VARS_JSON" | jq -r 'keys[]'); do
78+
value=$(echo "$ENV_VARS_JSON" | jq -r --arg key "$key" '.[$key]')
79+
echo "Setting $key from artifact"
80+
cf set-env "$APP_NAME" "$key" "$value"
81+
done
82+
else
83+
echo "No environment variables artifact found, skipping this step"
84+
fi
85+
86+
- name: Start Application
87+
working-directory: ${{ inputs.project_path }}
88+
run: |
89+
APP_NAME=$(grep 'name:' manifest.yml | head -n 1 | awk '{print $2}')
90+
if [ -z "$APP_NAME" ]; then
91+
APP_NAME=$(basename "${{ inputs.project_path }}")
92+
fi
93+
94+
echo "Starting application..."
95+
cf start "$APP_NAME"
96+
env:
97+
CF_STAGING_TIMEOUT: 15
98+
CF_STARTUP_TIMEOUT: 5

.github/workflows/cf-org-space.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Cloud Foundry Org and Space Setup
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
cf_org:
7+
required: true
8+
type: string
9+
description: 'Cloud Foundry Target Organization'
10+
cf_space:
11+
required: true
12+
type: string
13+
description: 'Cloud Foundry Target Space'
14+
15+
jobs:
16+
setup_org_space:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Check/Create Organization
20+
run: |
21+
if ! cf org --guid "${{ inputs.cf_org }}"; then
22+
echo "Organization '${{ inputs.cf_org }}' not found. Creating..."
23+
cf create-org "${{ inputs.cf_org }}"
24+
else
25+
echo "Organization '${{ inputs.cf_org }}' found."
26+
fi
27+
28+
- name: Check/Create Space
29+
run: |
30+
if ! cf space --guid "${{ inputs.cf_space }}" -o "${{ inputs.cf_org }}"; then
31+
echo "Space '${{ inputs.cf_space }}' not found in org '${{ inputs.cf_org }}'. Creating..."
32+
cf create-space "${{ inputs.cf_space }}" -o "${{ inputs.cf_org }}"
33+
else
34+
echo "Space '${{ inputs.cf_space }}' found."
35+
fi
36+
37+
- name: Target Org and Space
38+
run: |
39+
cf target -o "${{ inputs.cf_org }}" -s "${{ inputs.cf_space }}"

0 commit comments

Comments
 (0)