|
| 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 |
0 commit comments