You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/examples/backstage.md
+7-331Lines changed: 7 additions & 331 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ flowchart TD
18
18
backstage-workload-->postgres[(PostgreSQL)]
19
19
```
20
20
21
-
## 1. `score.yaml`
21
+
## Score file
22
22
23
23
Open your IDE and paste in the following `score.yaml` file, which describes a simple web server exposed via a DNS that queries a PostgreSQL database on each request. The demo code can be found [here](https://github.com/mathieu-benoit/deploy-backstage-with-score).
24
24
@@ -64,338 +64,14 @@ resources:
64
64
port: 7007
65
65
```
66
66
67
-
From here, we will now see how you can deploy this exact same Score file:
67
+
## Deployment with `score-compose` and `score-k8s`
68
68
69
-
- Either with [`score-compose`](#2-score-compose)
70
-
- Or with [`score-k8s`](#3-score-k8s)
69
+
From here, we will now see how to deploy this exact same Score file with either with `score-compose` or with `score-k8s`:
71
70
72
-
## 2. `score-compose`
73
-
74
-
To begin, follow the [installation instructions](/docs/score-implementation/score-compose/installation) to install the latest version of `score-compose`.
75
-
76
-
### `init`
77
-
78
-
Initialize your current `score-compose` workspace, run the following command in your terminal:
The `init` command will create the `.score-compose` directory with the [default resource provisioners]({{< relref "/docs/score-implementation/score-compose/resources-provisioners/" >}}) available. We are also importing one external file to support the `dns` dependencies: [`dns` provisioner](https://github.com/score-spec/community-provisioners/blob/main/service/score-compose/10-dns-with-url.provisioners.yaml).
86
-
87
-
You can see the resource provisioners available by running this command:
88
-
89
-
```bash
90
-
score-compose provisioners list
91
-
```
92
-
93
-
The Score file example illustrated uses three resource types: `postgres-instance`, `dns` and `route`.
The `generate` command will add the input `score.yaml` workload with a particular container image to the `.score-compose/state.yaml` state file and generate the output `compose.yaml`.
120
-
121
-
If you want to build the container image when this `compose.yaml` will be deployed, you can run this `generate` command with the `--build` parameter instead:
Congrats! You’ve successfully deploy, with the `score-compose` implementation, a sample containerized Backstage workload talking to PostgreSQL and exposed via a DNS. You provisioned them through Docker, without writing the Docker Compose file by yourself.
229
-
230
-
## 3. `score-k8s`
231
-
232
-
To begin, follow the [installation instructions](/docs/score-implementation/score-k8s/installation) to install the latest version of `score-k8s`.
233
-
234
-
### `init`
235
-
236
-
Initialize your current `score-k8s` workspace, run the following command in your terminal:
The `init` command will create the `.score-k8s` directory with the [default resource provisioners]({{< relref "/docs/score-implementation/score-k8s/resources-provisioners/" >}}) available. We are also importing one external file to support the `dns` dependencies: [`dns` provisioner](https://github.com/score-spec/community-provisioners/blob/main/service/score-k8s/10-dns-with-url.provisioners.yaml).
244
-
245
-
You can see the resource provisioners available by running this command:
246
-
247
-
```bash
248
-
score-k8s provisioners list
249
-
```
250
-
251
-
The Score file example illustrated uses three resource types: `postgres-instance`, `dns` and `route`.
The `generate` command will add the input `score.yaml` workload with a particular container image to the `.score-k8s/state.yaml` state file and generate the output `manifests.yaml`.
278
-
279
-
See the generated `manifests.yaml` by running this command:
280
-
281
-
```bash
282
-
cat manifests.yaml
283
-
```
284
-
285
-
If you make any modifications to the `score.yaml` file, run `score-k8s generate score.yaml` to regenerate the output `manifests.yaml`.
286
-
287
-
### `resources`
288
-
289
-
Get the information of the resources dependencies of the workload, run the following command:
_Here you will need to have access to a Kubernetes cluster to execute the following commands. You can follow [these instructions](/docs/how-to/score-k8s/kind-cluster/) if you want to set up a Kind cluster._
338
-
339
-
Run `kubectl apply` to execute the generated `manifests.yaml` file:
340
-
341
-
```bash
342
-
kubectl apply -f manifests.yaml
343
-
```
344
-
345
-
```none
346
-
secret/pg-backstage-d7058793 created
347
-
statefulset.apps/pg-backstage-d7058793 created
348
-
service/pg-backstage-d7058793 created
349
-
httproute.gateway.networking.k8s.io/route-backstage-76d19d47 created
Test the running container, run the following command:
387
-
388
-
```bash
389
-
curl localhost -H "Host: dnsnocrke.localhost"
390
-
```
391
-
392
-
```none
393
-
...
394
-
<title>Scaffolded Backstage App</title>
395
-
...
396
-
```
397
-
398
-
Congrats! You’ve successfully deploy, with the `score-k8s` implementation, a sample containerized Backstage workload talking to PostgreSQL and exposed via a DNS. You provisioned them through `kubectl`, without writing the Kubernetes manifests file by yourself.
0 commit comments