Skip to content

Commit 57831b8

Browse files
committed
feat: adding multiple sap modules
1 parent cb88147 commit 57831b8

Some content is hidden

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

60 files changed

+2451
-1051
lines changed
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# SAP BTP Cloud Foundry - User Guide
2+
3+
## 🎯 What This Building Block Does
4+
5+
Enables Cloud Foundry - a platform for deploying and running cloud-native applications. Think of it as your application runtime with built-in services like databases and message queues.
6+
7+
## 🚀 Quick Start
8+
9+
### Enable Cloud Foundry Environment
10+
```
11+
cloudfoundry_plan = "standard"
12+
```
13+
14+
### Add Services Your App Needs
15+
```
16+
cf_services = "postgresql.small,redis.medium,xsuaa.application"
17+
```
18+
19+
## 📋 What is Cloud Foundry?
20+
21+
Cloud Foundry is a **Platform as a Service (PaaS)** that:
22+
- Runs your applications (Node.js, Java, Python, Go, etc.)
23+
- Automatically handles scaling, health checks, and restarts
24+
- Provides built-in services (databases, caching, authentication)
25+
- Simplifies deployment with `cf push`
26+
27+
## 🗄️ Available Services
28+
29+
### Databases
30+
- **PostgreSQL**: Relational database
31+
- `postgresql.small` - 5GB storage, good for development
32+
- `postgresql.medium` - 20GB storage, good for production
33+
- `postgresql.large` - 100GB storage, high-performance
34+
35+
- **Redis**: In-memory cache
36+
- `redis.small` - 250MB, session storage
37+
- `redis.medium` - 1GB, general caching
38+
- `redis.large` - 5GB, high-traffic apps
39+
40+
### Authentication & Authorization
41+
- **XSUAA**: User authentication and authorization
42+
- `xsuaa.application` - Most common, for app security
43+
- `xsuaa.broker` - For service brokers
44+
45+
### Connectivity
46+
- **Destination**: Connect to remote systems
47+
- `destination.lite` - Free tier, destination management
48+
49+
- **Connectivity**: Connect to on-premise systems
50+
- `connectivity.lite` - Cloud Connector integration
51+
52+
### Developer Tools
53+
- **Application Logs**: Centralized logging
54+
- `application-logs.lite` - Free tier
55+
- `application-logs.standard` - Production tier
56+
57+
- **Job Scheduler**: Run scheduled background jobs
58+
- `jobscheduler.lite` - Free tier
59+
- `jobscheduler.standard` - Production tier
60+
61+
### Storage & Secrets
62+
- **Credential Store**: Secure secret management
63+
- `credstore.free` - Free tier
64+
- `credstore.standard` - Production tier
65+
66+
- **Object Store**: S3-compatible storage
67+
- `objectstore.s3-standard` - File storage
68+
69+
### UI Services
70+
- **HTML5 Application Repository**: Host HTML5 apps
71+
- `html5-apps-repo.app-host` - Host apps
72+
- `html5-apps-repo.app-runtime` - Serve apps
73+
74+
## 🔄 Shared Responsibility Matrix
75+
76+
| Responsibility | meshStack/Platform | App Team |
77+
|---------------|-------------------|----------|
78+
| Provision CF environment || |
79+
| Create service instances || |
80+
| Deploy applications | ||
81+
| Bind services to apps | ||
82+
| Monitor applications | ||
83+
| Scale applications | ||
84+
| CF runtime updates | SAP BTP | |
85+
| Service instance backups | SAP BTP | |
86+
87+
## 💡 Best Practices
88+
89+
### Start Small, Scale Up
90+
```
91+
# Development
92+
cf_services = "postgresql.small,redis.small"
93+
94+
# Production (upgrade later)
95+
cf_services = "postgresql.medium,redis.medium"
96+
```
97+
98+
### Include Essential Services
99+
Most apps need at least:
100+
```
101+
cf_services = "postgresql.small,xsuaa.application,destination.lite"
102+
```
103+
104+
### Understand Service Plans
105+
- **Free/Lite**: Limited, good for development, may have usage caps
106+
- **Small**: Low traffic production apps
107+
- **Medium**: Standard production apps
108+
- **Large**: High-traffic or data-intensive apps
109+
110+
### Check Entitlements First
111+
Each CF service needs a matching entitlement. Add via **entitlements building block**.
112+
113+
## 🚢 Deploying Your First App
114+
115+
After CF is provisioned:
116+
117+
1. **Install CF CLI**:
118+
```bash
119+
# Download from https://github.com/cloudfoundry/cli
120+
```
121+
122+
2. **Login to Cloud Foundry**:
123+
```bash
124+
cf login -a https://api.cf.eu10.hana.ondemand.com
125+
# Enter your BTP credentials
126+
```
127+
128+
3. **Target Your Org and Space**:
129+
```bash
130+
cf orgs # List available orgs
131+
cf target -o "your-org-name" -s "dev"
132+
```
133+
134+
4. **Deploy Your App**:
135+
```bash
136+
cf push my-app
137+
```
138+
139+
5. **Bind Services**:
140+
```bash
141+
cf bind-service my-app postgresql-small
142+
cf restage my-app
143+
```
144+
145+
## 🔍 Checking Service Status
146+
147+
```bash
148+
# List service instances
149+
cf services
150+
151+
# Get service credentials
152+
cf service-key postgresql-small my-key
153+
154+
# View service details
155+
cf service postgresql-small
156+
```
157+
158+
## ⚠️ Common Issues
159+
160+
### "CF environment not ready"
161+
CF provisioning takes 10-20 minutes. Check status in BTP Cockpit.
162+
163+
### "Service not found"
164+
1. Ensure entitlement exists (use entitlements building block)
165+
2. Wait a few minutes after creating service instance
166+
3. Check service marketplace: `cf marketplace`
167+
168+
### "Out of memory"
169+
Your app needs more memory. Update manifest.yml:
170+
```yaml
171+
memory: 1G # Increase from default 256M
172+
```
173+
174+
### "Can't connect to service"
175+
1. Verify service is bound: `cf services`
176+
2. Check `VCAP_SERVICES` environment variable: `cf env my-app`
177+
3. Restage app after binding: `cf restage my-app`
178+
179+
## 🎓 Next Steps
180+
181+
1. **Deploy an App**: Use `cf push` to deploy your application
182+
2. **Bind Services**: Connect your app to databases and services
183+
3. **Monitor**: Use `cf logs` and Application Logs service
184+
4. **Scale**: Use `cf scale` to adjust instances and memory
185+
5. **Automate**: Set up CI/CD with manifest.yml
186+
187+
## 📚 Learn More
188+
189+
- **CF CLI Cheatsheet**: https://docs.cloudfoundry.org/cf-cli/
190+
- **SAP BTP CF Docs**: https://help.sap.com/docs/btp/sap-business-technology-platform/cloud-foundry-environment
191+
- **Manifest.yml Guide**: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html
192+
193+
## 📞 Getting Help
194+
195+
- Check CF logs: `cf logs my-app --recent`
196+
- View app health: `cf apps`
197+
- Contact platform team for infrastructure issues
198+
- Use `cf help` for CLI command reference
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
name: SAP BTP Cloud Foundry
3+
supportedPlatforms:
4+
- btp
5+
description: Enables Cloud Foundry environment in an SAP BTP subaccount and manages Cloud Foundry service instances like PostgreSQL, Redis, XSUAA, and more.
6+
---
7+
8+
# SAP BTP Cloud Foundry Building Block
9+
10+
This building block enables the Cloud Foundry environment in an SAP BTP subaccount and manages Cloud Foundry service instances.
11+
12+
## What This Module Does
13+
14+
1. **Provisions Cloud Foundry Environment**: Creates a Cloud Foundry org and space
15+
2. **Manages CF Service Instances**: Creates service instances (databases, messaging, etc.) within Cloud Foundry
16+
17+
## Prerequisites
18+
19+
- An existing SAP BTP subaccount
20+
- Required entitlements:
21+
- `cloudfoundry.standard` or `cloudfoundry.free`
22+
- `APPLICATION_RUNTIME.MEMORY` (for running apps)
23+
- Entitlements for any CF services you want to use
24+
- SAP BTP authentication configured via environment variables
25+
26+
## Usage
27+
28+
### Enable Cloud Foundry Only
29+
30+
```hcl
31+
globalaccount = "my-global-account"
32+
subaccount_id = "ab5dcd3d-c824-4470-a2f6-758d37da52ea"
33+
project_identifier = "my-project"
34+
cloudfoundry_plan = "standard"
35+
```
36+
37+
### Enable Cloud Foundry with Services
38+
39+
```hcl
40+
globalaccount = "my-global-account"
41+
subaccount_id = "ab5dcd3d-c824-4470-a2f6-758d37da52ea"
42+
project_identifier = "my-project"
43+
cloudfoundry_plan = "standard"
44+
cf_services = "postgresql.small,redis.medium,xsuaa.application,destination.lite"
45+
```
46+
47+
### Importing Existing CF Environment
48+
49+
1. Create a `terraform.tfvars` file with your configuration
50+
2. Run the import script:
51+
```bash
52+
./import-resources.sh
53+
```
54+
3. Verify with `tofu plan`
55+
56+
## Available Cloud Foundry Services
57+
58+
### Databases
59+
- `postgresql.small`, `postgresql.medium`, `postgresql.large` - PostgreSQL databases
60+
- `redis.small`, `redis.medium`, `redis.large` - Redis cache
61+
62+
### Platform Services
63+
- `xsuaa.application` - Authentication and authorization
64+
- `xsuaa.broker` - Service broker authentication
65+
- `destination.lite` - Destination service
66+
- `connectivity.lite` - Connectivity to on-premise systems
67+
68+
### Application Services
69+
- `application-logs.lite`, `application-logs.standard` - Application logging
70+
- `html5-apps-repo.app-host`, `html5-apps-repo.app-runtime` - HTML5 application repository
71+
- `jobscheduler.lite`, `jobscheduler.standard` - Job scheduling
72+
- `credstore.free`, `credstore.standard` - Credential storage
73+
- `objectstore.s3-standard` - Object storage (S3-compatible)
74+
75+
## Variables
76+
77+
| Name | Description | Required |
78+
|------|-------------|----------|
79+
| `globalaccount` | Global account subdomain | Yes |
80+
| `subaccount_id` | Target subaccount ID | Yes |
81+
| `project_identifier` | Project identifier for naming | Yes |
82+
| `cloudfoundry_plan` | CF plan (standard, free, trial) | No (default: standard) |
83+
| `cf_services` | Comma-separated CF service instances | No |
84+
85+
## Outputs
86+
87+
| Name | Description |
88+
|------|-------------|
89+
| `cloudfoundry_instance_id` | CF environment instance ID |
90+
| `cloudfoundry_instance_state` | CF environment state (OK, CREATING, etc.) |
91+
| `cloudfoundry_services` | Map of created CF service instances |
92+
| `subaccount_id` | Passthrough of subaccount ID |
93+
94+
## Service Instance Naming
95+
96+
Service instances are automatically named: `{service}-{plan}`
97+
98+
Examples:
99+
- `postgresql.small` → instance name: `postgresql-small`
100+
- `redis.medium` → instance name: `redis-medium`
101+
- `xsuaa.application` → instance name: `xsuaa-application`
102+
103+
## Lifecycle Management
104+
105+
The `parameters` attribute for CF service instances is ignored after creation. This allows:
106+
- Importing existing service instances
107+
- Manual parameter updates via CF CLI
108+
- Flexible service configuration
109+
110+
## Dependency Chain
111+
112+
This building block depends on:
113+
- **subaccount** - Must have a subaccount ID
114+
- **entitlements** - CF and service entitlements required
115+
116+
## Common Scenarios
117+
118+
### Basic Web Application Stack
119+
```
120+
cf_services = "postgresql.small,xsuaa.application,destination.lite"
121+
```
122+
123+
### Microservices Platform
124+
```
125+
cf_services = "postgresql.medium,redis.medium,xsuaa.application,application-logs.standard,jobscheduler.standard"
126+
```
127+
128+
### Enterprise Application
129+
```
130+
cf_services = "postgresql.large,redis.large,xsuaa.application,connectivity.lite,destination.lite,credstore.standard"
131+
```
132+
133+
## Important Notes
134+
135+
### Provisioning Time
136+
- CF environment: 10-20 minutes
137+
- Service instances: 2-10 minutes each
138+
139+
### Entitlement Requirements
140+
Each CF service requires a corresponding entitlement. Use the **entitlements building block** first.
141+
142+
### Service Binding
143+
After creating service instances:
144+
1. Use CF CLI to bind services to your apps
145+
2. Or use manifest.yml `services:` section
146+
3. Service credentials are injected via `VCAP_SERVICES`
147+
148+
## Accessing Cloud Foundry
149+
150+
After provisioning, access CF via:
151+
```bash
152+
cf login -a https://api.cf.{region}.hana.ondemand.com
153+
cf target -o {org-name} -s {space-name}
154+
```
155+
156+
Find your org name in BTP Cockpit → Cloud Foundry → Organizations

0 commit comments

Comments
 (0)