-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpresentation.capnb
415 lines (415 loc) · 29.4 KB
/
presentation.capnb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
[
{
"kind": 1,
"language": "markdown",
"value": "<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <style>\n #banner-wrapper {\n background: url(https://www.btpcon.org/wp-content/themes/exhibz/assets/images/banner/about-banner.jpg);\n height: 200px;\n width: 100%;\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 1rem;\n }\n #banner-title {\n font-size: 48px;\n font-weight: 800;\n color: #fff;\n }\n #banner-image {\n height: 60%;\n margin-right: 2rem;\n }\n </style>\n</head>\n<body>\n\n <div id=\"banner-wrapper\">\n <span id=\"banner-title\">BTPcon 2023</span>\n <img id=\"banner-image\" src=\"https://www.cloudfoundry.org/wp-content/uploads/2017/01/CloudFoundaryCorp_vertical_white.png\" />\n </div>\n\n</body>\n</html>",
"outputs": [
{
"mime": "text/html",
"value": "<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<style>\n.alert {\n padding: 20px;\n color: var(--theme-error-foreground);\n background-color: var(--theme-error-background);\n max-width: 70em;\n width: 95%;\n}\n.alert.info {\n color: var(--theme-info-foreground);\n background-color: var(--theme-info-background);\n}\n.alert.warning {\n color: var(--theme-warning-foreground);\n background-color: var(--theme-warning-background);\n}\n.closebtn {\n margin-left: 15px;\n color: white;\n font-weight: bold;\n float: right;\n font-size: 22px;\n line-height: 20px;\n cursor: pointer;\n transition: 0.3s;\n}\n.closebtn:hover {\n color: black;\n}\n</style>\n</head>\n<h1 style=\"font-size:50px\">CAP Notebook <img style=\"vertical-align:middle\" src=\"https://cap.cloud.sap/docs/assets/logos/sap.svg\" alt=\"drawing\" width=\"70\"/><img style=\"vertical-align:middle\" src=\"https://cap.cloud.sap/docs/assets/logos/cap.svg\" alt=\"drawing\" width=\"60\"/></h1>\n<body>\n<div class=\"alert info\">\n <span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">×</span>\n <strong>Info:</strong> Notebook code cells work just like your native environments. However, predefined *Magic commands* exist\n to make notebook workflows even simpler.\n They all start with <code>%</code> or <code>%%</code> for line or cell magic commands. Type <code>%quickref</code> in any cell for a full list.\n</div>\n<p>\n<div class=\"alert\">\n <span class=\"closebtn\" onclick=\"this.parentElement.style.display='none';\">×</span>\n <strong>Attention:</strong> The cell types <i>Shell Script</i> and <i>Terminal</i> are executed in your native shell environment. Check the code <b>before</b> running the cell.\n</div>\n<p>\n</body>\n</html>"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "# From Your First App Deployment to CI/CD with Cloud Foundry\n\n*How does Cloud Foundry actually work? <br>\nIn this talk we will explore the structure of apps and services on the SAP BTP, Cloud Foundry environment and learn how to administer them. We will start with the simple deployment of an app, then increase the complexity step by step and finally set up a CI/CD pipeline. Suitable for developers and technically interested people.*",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "Before we talk about abstract concepts, let's use Cloud Foundry and get a feel for it first.",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "## Simple App Deployment",
"outputs": []
},
{
"kind": 2,
"language": "html",
"value": "%%writefile \"html5/index.html\"\nHello BTPcon!",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/index.html\">html5/index.html</a>.\n"
}
]
},
{
"kind": 2,
"language": "terminal",
"value": "%%writefile \"html5/manifest.yaml\"\n---\napplications:\n- name: btpcon-cf-static\n random-route: true\n path: .\n memory: 256M\n disk_quota: 256M\n buildpacks:\n - https://github.com/cloudfoundry/staticfile-buildpack",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/manifest.yaml\">html5/manifest.yaml</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "➡️ More about [Cloud Foundry buildpacks](https://docs.cloudfoundry.org/buildpacks/).",
"outputs": []
},
{
"kind": 2,
"language": "terminal",
"value": "cf login -a https://api.cf.us10-001.hana.ondemand.com",
"outputs": [
{
"mime": "text/html",
"value": "Running in terminal <b>presentation.capnb - /Users/i533499/github/nicoschoenteich/btpcon-cf7</b>"
}
]
},
{
"kind": 2,
"language": "terminal",
"value": "cd html5 && cf push",
"outputs": [
{
"mime": "text/html",
"value": "Running in terminal <b>presentation.capnb - /Users/i533499/github/nicoschoenteich/btpcon-cf8</b>"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "![SAP BTP Cockpit](images/btp-static.png)\n![Webapp](images/static-webapp.png)",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "## How Cloud Foundry Stages Apps",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "- CF is an open source application development platform as a service (PaaS)\n- It focuses on developer experience ➡️ developers can focus on developing solutions instead of how to run those solutions\n- \"Here is my code, just run it\"\n- Polyglot environment (running multiple programming languages)\n\nA ***simplified*** flow of how apps are staged:\n\n```text\n┌───────────────────────────────────────┐\n│ ┌─────────┐ │\n│ │ cf CLI │ │\n│ └─────────┘ │\n│ │\n│ > command line tool for developers │\n│ │\n└───────────────────────────────────────┘\n\n ⬇️\n\n┌───────────────────────────────────────┐\n│ ┌───────────────────┐ │\n│ │ Cloud Controller │ │\n│ └───────────────────┘ │\n│ │\n│ > maintains database with │\n│ orgs, spaces, services, roles, ... │\n│ │\n└───────────────────────────────────────┘\n\n ⬇️ \n\n┌───────────────────────────────────────┐\n│ ┌─────────┐ │\n│ │ Diego │ │\n│ └─────────┘ │\n│ │\n│ > self-healing container management │\n│ system │\n│ │\n└───────────────────────────────────────┘\n```\n\n1. cf CLI sends request to Cloud Controller\n1. Cloud Controller passes requests to run apps to Diego\n1. Auctioneer (Diego) finds available Diego Cell\n - max. 250 Diego Cells per Cloud Foundry deployment\n - Diego Cells run on virtual machines\n1. Executor (Diego) creates Garden container in the Diego Cell\n1. Route is being created\n1. Logging\n\n### High Level Comparison to Kyma\n\n- SAP BTP, Kyma runtime is a fully managed k8s runtime based on the open-source project \"Kyma\"\n- K8s itself is an infrastructure abstraction - an open-source system for automating deployment, scaling, and management of containerized applications\n- Kyma focuses on control, Cloud Foundry on developer experience\n- Although Cloud Foundry supports Docker containers, Kyma is the way to go for containerized apps\n- Interestingly, standalone Cloud Foundry (outside the SAP scope) can be deployed on k8s (instead of using BOSH to deploy on VMs)\n",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "## Apps vs. Services",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "From an application developer perspective, there are two similar (but also very different) concepts you need to understand to build solutions in Cloud Foundry - apps and services.\n\n### Apps\n\n- Are deployed into a Cloud Foundry space\n- Consume Cloud Foundry Runtime ($$$)\n- Can be scaled vertically and horizontally\n- Many different programming languages possible (polyglot environment)\n- Multi-tenancy is possible, which allows to expose them via the Cloud Foundry Marketplace so they can be subscribed to by other subaccounts\n\n### Services\n\n- Services are also available via the Cloud Foundry Marketplace\n- Most commonly used: Destination Service, Authorization and Trust Management Service, ...\n- To use a service means to create an instance of a service\n- Service instances also live in a Cloud Foundry space\n- Don't consume Cloud Foundry Runtime ($$$)\n- Different services plans come with different price points\n\n### Application Bindings\n\n- An app can be bound to a service instance by storing the service instance credentials in the app's environment variables (`{ \"VCAP_SERVICES\": {...} }`), which Cloud Foundry can automatically do for you",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "## Multi-Target Applications",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "Multi-Target applications make it possible to describe more complex solutions, including multiple apps and services instances, with a single file (`mta.yaml`) and deploy them with a single command (`cf deploy`).\n\n➡️ More about `mta.yaml` vs. `manifest.yaml` based deployments in this [YouTube video](https://www.youtube.com/watch?v=kt7XW6n_3xY).\n\nLet's build an app with the following architecture:\n\n![MTA architecture](images/architecture.png)",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "### HTML5 App",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "Let's turn our static HTML5 site into a Node.js based app.\n\n- The `@sap/html5-app-deployer` package will deploy the app into the html5-apps-repo\n- `vite` will bundle the html5 content (in a later step)",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"html5/package.json\"\n{\n \"name\": \"btpcon-cf-html5\",\n \"dependencies\": {\n \"@sap/html5-app-deployer\": \"2.0.1\"\n },\n \"scripts\": {\n \"start\": \"node node_modules/@sap/html5-app-deployer/index.js\",\n \"dev\": \"vite\",\n \"build\": \"vite build --outDir=resources/dist\"\n },\n \"devDependencies\": {\n \"vite\": \"^4.2.1\"\n }\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/package.json\">html5/package.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "Every app deployed into the html5-apps-repo needs a `manifest.json`. We create it in `public/` so that `vite` includes it in the build.",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"html5/public/manifest.json\"\n{\n\t\"_version\": \"1.12.0\",\n\t\"sap.app\": {\n\t\t\"id\": \"btpcon-cf-html5\",\n\t\t\"type\": \"application\",\n\t\t\"applicationVersion\": {\n\t\t\t\"version\": \"1.0.0\"\n\t\t}\n\t},\n\t\"sap.cloud\": {\n\t\t\"service\": \"basic.service\"\n\t}\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/public/manifest.json\">html5/public/manifest.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "Every app deployed into the html5-apps-repo also needs an `xs-app.json`, that more or less points to itself.",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"html5/public/xs-app.json\"\n{\n \"welcomeFile\": \"/index.html\",\n \"authenticationMethod\": \"none\",\n \"routes\": [\n {\n \"source\": \"^(.*)$\",\n \"target\": \"$1\",\n \"service\": \"html5-apps-repo-rt\",\n \"authenticationType\": \"none\"\n }\n ]\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/public/xs-app.json\">html5/public/xs-app.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "### Approuter",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "The approuter will redirect all request to the app with the id `btpconcfhtml5` in the html5-apps-repo (see [html5/public/manifest.json](/html5/public/manifest.json) for id configuration) .",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"approuter/package.json\"\n{\n\t\"name\": \"btpcon-cf-approuter\",\n\t\"dependencies\": {\n\t\t\"@sap/approuter\": \"latest\"\n\t},\n\t\"scripts\": {\n\t\t\"start\": \"node node_modules/@sap/approuter/approuter.js\"\n\t}\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"approuter/package.json\">approuter/package.json</a>.\n"
}
]
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"approuter/xs-app.json\"\n{\n\t\"welcomeFile\": \"index.html\",\n\t\"authenticationMethod\": \"none\",\n\t\"routes\": [\n\t\t{\n \"source\": \"^(.*)$\",\n \"target\": \"/btpconcfhtml5/$1\",\n \"service\": \"html5-apps-repo-rt\"\n }\n\t]\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"approuter/xs-app.json\">approuter/xs-app.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "### Building and Deploying the MTA",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "Describing the whole architecture, the `mta.yaml` puts all the pieces together.",
"outputs": []
},
{
"kind": 2,
"language": "terminal",
"value": "%%writefile \"mta.yaml\"\nID: btpcon-cf\n_schema-version: 3.2.0\nversion: 1.0.0\nparameters:\n enable-parallel-deployments: true\nmodules:\n - name: btpcon-cf-html5\n type: nodejs\n path: html5\n parameters:\n no-route: true\n build-parameters:\n builder: custom\n commands:\n - npm install\n - npm run build\n requires:\n - name: btpcon-cf-html5-host\n - name: btpcon-cf-approuter\n type: nodejs\n path: approuter\n parameters:\n disk-quota: 256M\n memory: 256M\n requires:\n - name: btpcon-cf-html5-runtime\nresources:\n - name: btpcon-cf-html5-host\n type: org.cloudfoundry.managed-service\n parameters:\n service: html5-apps-repo\n service-plan: app-host\n - name: btpcon-cf-html5-runtime\n type: org.cloudfoundry.managed-service\n parameters:\n service: html5-apps-repo\n service-plan: app-runtime",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"mta.yaml\">mta.yaml</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "Install the [MTA build tool](https://www.npmjs.com/package/mbt) globally, so no `package.json` is needed on project root level to build it. The build creates the MTA archive (`*.mtar`), which we can deploy to Cloud Foundry.",
"outputs": []
},
{
"kind": 2,
"language": "terminal",
"value": "mbt build",
"outputs": [
{
"mime": "text/html",
"value": "Running in terminal <b>presentation.capnb - /Users/i533499/github/nicoschoenteich/btpcon-cf31</b>"
}
]
},
{
"kind": 2,
"language": "terminal",
"value": "cf deploy mta_archives/btpcon-cf_1.0.0.mtar",
"outputs": [
{
"mime": "text/html",
"value": "Running in terminal <b>presentation.capnb - /Users/i533499/github/nicoschoenteich/btpcon-cf32</b>"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "![SAP BTP Cockpit](images/btp-mta.png)\n![Webapp](images/mta-webapp1.png)",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "From an end-user perspective our app seems to not have changed, but we are now ready to add security and fetch remote data.",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "### Adding Destination and Authorization Instances",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "We add instances of the `destination` and the `xsuaa` service, create their respective configuration files, and make sure the approuter requires the instances (➡️ application binding).",
"outputs": []
},
{
"kind": 2,
"language": "terminal",
"value": "%%writefile \"mta.yaml\"\nID: btpcon-cf\n_schema-version: 3.2.0\nversion: 1.0.0\nparameters:\n enable-parallel-deployments: true\nmodules:\n - name: btpcon-cf-html5\n type: nodejs\n path: html5\n parameters:\n no-route: true\n build-parameters:\n builder: custom\n commands:\n - npm install\n - npm run build\n requires:\n - name: btpcon-cf-html5-host\n - name: btpcon-cf-approuter\n type: nodejs\n path: approuter\n parameters:\n disk-quota: 256M\n memory: 256M\n requires:\n - name: btpcon-cf-html5-runtime\n - name: btpcon-cf-html5-destination\n - name: btpcon-cf-html5-uaa\nresources:\n - name: btpcon-cf-html5-host\n type: org.cloudfoundry.managed-service\n parameters:\n service: html5-apps-repo\n service-plan: app-host\n - name: btpcon-cf-html5-runtime\n type: org.cloudfoundry.managed-service\n parameters:\n service: html5-apps-repo\n service-plan: app-runtime\n - name: btpcon-cf-html5-destination\n type: org.cloudfoundry.managed-service\n parameters:\n service-plan: lite\n service: destination\n path: ./destinations.json\n - name: btpcon-cf-html5-uaa\n type: org.cloudfoundry.managed-service\n parameters:\n service: xsuaa\n service-plan: application\n path: xs-security.json",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"mta.yaml\">mta.yaml</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "The `github-api` destination will allow the approuter to call `https://api.github.com` on a client's behalf, which will avoid [CORS](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) issues. This configuration file will get picked up during the MTA build.",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"destinations.json\"\n{\n\t\"init_data\": {\n\t\t\"instance\": {\n\t\t\t\"existing_destinations_policy\": \"update\",\n\t\t\t\"destinations\": [\n\t\t\t\t{\n\t\t\t\t\t\"Name\": \"github-api\",\n\t\t\t\t\t\"Authentication\": \"NoAuthentication\",\n\t\t\t\t\t\"ProxyType\": \"Internet\",\n\t\t\t\t\t\"Type\": \"HTTP\",\n\t\t\t\t\t\"URL\": \"https://api.github.com\"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t}\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"destinations.json\">destinations.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "The `oauth2-configuration` is required to whitelist our approuter's URL in the xsuaa tenant.",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"xs-security.json\"\n{\n \"xsappname\": \"btpcon-cf-uaa\",\n \"tenant-mode\": \"dedicated\",\n \"oauth2-configuration\": {\n \"redirect-uris\": [\n \"https://*btpcon-cf-approuter.cfapps.us10-001.hana.ondemand.com/login/callback\"\n ]\n }\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"xs-security.json\">xs-security.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "We add the `user-api` route to fetch information about the logged in user (provided by the approuter), and add a route to call the `github-api` and \"turn on\" security by setting `route` as `authenticationMethod`, which will check for `authenticationType`s of individual routes.",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"approuter/xs-app.json\"\n{\n\t\"welcomeFile\": \"index.html\",\n\t\"authenticationMethod\": \"route\",\n\t\"routes\": [\n\t\t{\n\t\t\t\"source\": \"^/user-api(.*)\",\n\t\t\t\"target\": \"$1\",\n\t\t\t\"service\": \"sap-approuter-userapi\"\n\t\t},\n\t\t{\n\t\t\t\"source\": \"^.*/github-api/(.*)$\",\n\t\t\t\"target\": \"$1\",\n\t\t\t\"authenticationType\": \"none\",\n\t\t\t\"destination\": \"github-api\"\n\t\t},\n\t\t{\n \"source\": \"^(.*)$\",\n \"target\": \"/btpconcfhtml5/$1\",\n \"service\": \"html5-apps-repo-rt\"\n }\n\t]\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"approuter/xs-app.json\">approuter/xs-app.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "We set `xsuaa` as `authenticationType` for the html5 app to move it behind the auth wall. ",
"outputs": []
},
{
"kind": 2,
"language": "json",
"value": "%%writefile \"html5/public/xs-app.json\"\n{\n \"welcomeFile\": \"/index.html\",\n \"authenticationMethod\": \"route\",\n \"routes\": [\n {\n \"source\": \"^(.*)$\",\n \"target\": \"$1\",\n \"service\": \"html5-apps-repo-rt\",\n \"authenticationType\": \"xsuaa\"\n }\n ]\n}",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/public/xs-app.json\">html5/public/xs-app.json</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "We call the `github-api` as well as the `user-api` route from our html5 app. The approuter will handle these requests for us.",
"outputs": []
},
{
"kind": 2,
"language": "html",
"value": "%%writefile \"html5/index.html\"\n<h1>Hello BTPcon!</h1>\n\n<p>Why not check out one of these SAP CodeJam repositories?</p>\n\n<ul id=\"myList\"></ul>\n\n<script type=\"module\">\n\n const main = async () => {\n const response = await fetch(\"/github-api/orgs/SAP-Samples/repos?sort=updated&per_page=100\")\n const result = await response.json()\n const repos = result.filter(repo => repo.name.includes(\"codejam\"))\n const myList = document.getElementById(\"myList\")\n for (let i = 0; i < repos.length; i++) {\n const newListItem = document.createElement(\"li\")\n const newLink = document.createElement(\"a\")\n newLink.textContent = repos[i].html_url\n newLink.href = repos[i].html_url\n newListItem.appendChild(newLink)\n myList.appendChild(newListItem)\n }\n }\n main()\n const user = async () => {\n const response = await fetch(\"/user-api/currentUser\")\n const result = await response.json()\n document.getElementsByTagName(\"h1\")[0].textContent = `Hello ${result.firstname}!`\n }\n user()\n</script>",
"outputs": [
{
"mime": "text/html",
"value": "Wrote cell content to file <a href=\"html5/index.html\">html5/index.html</a>.\n"
}
]
},
{
"kind": 1,
"language": "markdown",
"value": "## Continous Integration and Delivery",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "Let's redeploy the project using a CI/CD pipeline.",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "![CICD service on CF](images/cicd-service.png)\n![CICD job](images/cicd-job.png)\n![Webhook on GitHub](images/cicd-github.png)",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "```text\n┌───────────────────────────────────────┐\n│ ┌────────────┐ │\n│ │ git push │ │\n│ └────────────┘ │\n│ │\n│ > developer pushes commit to git │\n│ │\n└───────────────────────────────────────┘\n\n ⬇️\n\n┌───────────────────────────────────────┐\n│ ┌───────────────────┐ │\n│ │ GitHub Webhook │ │\n│ └───────────────────┘ │\n│ │\n│ > gets triggered on git push │\n│ (depending on config) │\n│ │\n└───────────────────────────────────────┘\n\n POST\n ⬇️ \n\n┌───────────────────────────────────────┐\n│ ┌───────────────────┐ │\n│ │ CI/CD Service │ │\n│ └───────────────────┘ │\n│ │\n│ > pulls repo, then builds, tests, │\n│ and releases the project │\n│ │\n└───────────────────────────────────────┘\n\n deployment\n ⬇️ \n\n┌───────────────────────────────────────┐\n│ ┌────────────┐ │\n│ │ CF space │ │\n│ └────────────┘ │\n│ │\n│ > app started and available │\n│ │\n└───────────────────────────────────────┘\n```\n\nThe CI/CD job is set to up to run the `mbt build` and `cf deploy` command (just like we did locally), but offers additional handy features such as:\n- testing, malware scans\n- blue/green deployment out of the box\n- infrastructure as code: the `.pipeline/config.yml` can be exported in the service UI\n- timed triggers",
"outputs": []
},
{
"kind": 1,
"language": "markdown",
"value": "![Webapp](images/mta-webapp2.png)",
"outputs": []
}
]