From a9c00d1519969cc47688fe66ea261b65fa3f002c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Susa=20T=C3=BCnker?= Date: Tue, 16 Apr 2024 11:33:27 +0200 Subject: [PATCH 1/2] Updated get started guides with score-compose --- content/en/docs/get started/_index.md | 73 +++++++- .../get started/score-compose-hello-world.md | 110 ------------ .../get started/score-helm-hello-world.md | 170 ------------------ 3 files changed, 72 insertions(+), 281 deletions(-) delete mode 100644 content/en/docs/get started/score-compose-hello-world.md delete mode 100644 content/en/docs/get started/score-helm-hello-world.md diff --git a/content/en/docs/get started/_index.md b/content/en/docs/get started/_index.md index 57996a6a..d82ea32a 100644 --- a/content/en/docs/get started/_index.md +++ b/content/en/docs/get started/_index.md @@ -6,4 +6,75 @@ weight: 2 ## Overview -The primary goal of the Score file is to quickly and easily describe a Workloads's runtime requirements. The following covers what you need to know to compose a Score file and run a Workload via a Score Implementation CLI. +If you're new to Score, we recommend starting with the [score-compose](https://github.com/score-spec/score-compose) reference implementation. It provides a helpful blueprint for using Score and allows you to become familiar with the [Score specification](/docs/score-specification/score-spec-reference) before exploring further implementation options. + +## Hello world with score-compose + +**1.** To begin, follow the [installation instructions](/docs/score-implementation/score-compose#installation) to install the latest version of score-compose. + +**2.** Open your IDE and paste in the following `score.yaml` file, which describes a simple service based on a `busybox` Docker image: + +```yaml +apiVersion: score.dev/v1b1 + +metadata: + name: hello-world + +containers: + hello: + image: busybox + command: ["/bin/sh"] + args: ["-c", "while true; do echo Hello World!; sleep 5; done"] +``` + +**3.** To convert the `score.yaml` file into runnable `compose.yaml`, run the following commands in your terminal: + +```console +$ score-compose init +$ score-compose generate score.yaml +``` + +The `init` will create the `.score-compose` directory. The `generate` command will add the input `score.yaml` workload to the `.score-compose/state.yaml` state file and regenerate the output `compose.yaml`. + +```console +$ cat compose.yaml +name: 01-hello +services: + hello-world-hello: + command: + - -c + - while true; do echo Hello World!; sleep 5; done + entrypoint: + - /bin/sh + image: busybox +``` + +If you make any modifications to the `score.yaml` file, run `score-compose generate score.yaml` to regenerate the output. + +**4.** Run `docker compose up` to execute the newly generated `compose.yaml` file: + +```console +$ docker compose up -d +[+] Running 1/2 + ⠼ Network 01-hello_default Created + ✔ Container 01-hello-hello-world-hello-1 Started +$ docker logs -f 01-hello-hello-world-hello-1 +Hello World! +Hello World! +Hello World! +Hello World! +^C% +$ docker compose down +``` + +Congrats! You’ve successfully run your first Score Implementation with a Hello World workload and provisioned it through Docker. + +## Next steps + +* **Explore more examples**: Check out the [examples folder](https://github.com/score-spec/score-compose/tree/main/examples) for score-compose to dive into further use cases and experiment with different configurations. + +* **Learn more about score-compose**: Investigate the inner workings of the score-compose reference implementation by exploring its CLI reference [here](/docs/score-implementation/score-compose#cli-reference). + +* **Explore other implementations**: Play around with [other available open-source Score implementation CLIs](/docs/score-implementation/other). For example, you could continue by running the same Score file used in the example above via the score-helm CLI to generate a Helm values file. + +* **Join the Score community Slack**: If you encounter any issues or have questions, feel free to reach out to us in the [Score community Slack](https://join.slack.com/t/scorecommunity/shared_invite/zt-2a0x563j7-i1vZOK2Yg2o4TwCM1irIuA). \ No newline at end of file diff --git a/content/en/docs/get started/score-compose-hello-world.md b/content/en/docs/get started/score-compose-hello-world.md deleted file mode 100644 index 7b12ca00..00000000 --- a/content/en/docs/get started/score-compose-hello-world.md +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: "Hello World with score-compose" -linkTitle: "score-compose" -weight: 4 ---- - -## Overview - -The primary goal of the Score Specification is to quickly and easily describe how to run a Workload. The following covers what you need to know to compose your first `score.yaml` file and run it with score-compose. - -{{% alert %}} - -> If at any point you need help, run `score-compose --help` from your terminal. - -{{% /alert %}} - -## Building blocks - -At it's core, the Score file needs a `name` and a `container` to run. - -In the following example, the Score tab shows the minimum configuration needed to run a Workload and the Docker Compose tab shows the output of the `score-compose run` command. - -The `score.yaml` file contains a Workload named `hello-world` and specifies a container image as `busybox`. - -{{< tabs >}} -{{% tab name="Score" %}} - -The following is the minimum configuration needed to run a Workload. - -```yaml -apiVersion: score.dev/v1b1 -metadata: - name: hello-world - -containers: - container-id: - image: busybox -``` - -{{% /tab %}} -{{% tab name="Docker Compose" %}} - -The output of `score-compose run -f ./score.yaml -o ./compose.yaml`. - -```yaml -services: - hello-world: - image: busybox -``` - -{{% /tab %}} -{{< /tabs >}} - -## Containers - -In the following example, we'll create a simple service based on `busybox` using the `containers` definition. - -{{< tabs >}} -{{% tab name="Score" %}} - -```yaml -apiVersion: score.dev/v1b1 - -metadata: - name: hello-world - -containers: - hello: - image: busybox - command: ["/bin/sh"] - args: ["-c", "while true; do echo Hello World!; sleep 5; done"] -``` - -{{% /tab %}} -{{% tab name="Docker Compose" %}} - -The output of `score-compose run -f ./score.yaml -o ./compose.yaml`. - -```yaml -services: - hello-world: - command: - - -c - - while true; do echo Hello World!; sleep 5; done - entrypoint: - - /bin/sh - image: busybox -``` - -The following is a description of the previous command. - -- `run` tells the CLI to translate the Score file to a Docker Compose file. -- `-f` is the path to the Score file. -- `-o` specifies the path to the output file. - -{{% /tab %}} -{{< /tabs >}} - -Now, you can run `docker compose up` to run the Workload as usual. - -The following is the output of the previous command. - -```bash -[+] Running 1/0 -⠿ Container score-compose-hello-world-1 Rec... 0.1s -Attaching to score-compose-hello-world-1 -score-compose-hello-world-1 | Hello World! -``` - -**Results** You've successfully run your first Score Implementation with a Hello World Workload and provisioned it through Docker. diff --git a/content/en/docs/get started/score-helm-hello-world.md b/content/en/docs/get started/score-helm-hello-world.md deleted file mode 100644 index d91b81db..00000000 --- a/content/en/docs/get started/score-helm-hello-world.md +++ /dev/null @@ -1,170 +0,0 @@ ---- -title: "Hello World with score-helm" -linkTitle: "score-helm" -weight: 4 ---- - -## Overview - -The primary goal of the Score Specification is to quickly and easily describe how to run a Workload. The following covers what you need to know to compose your first `score.yaml` file and run it with score-helm. - -{{% alert %}} - -> If at any point you need help, run `score-helm --help` from your terminal. - -{{% /alert %}} - -## Building blocks - -At it's core, the Score file needs a `name` and a `container` to run. - -In the following example, the Score tab shows the minimum configuration needed to run a Workload and the Docker Compose tab shows the output of the `score-helm run` command. - -The `score.yaml` file contains a Workload named `hello-world` and specifies a container image as `busybox`. - -{{< tabs >}} -{{% tab name="Score" %}} - -The following is the minimum configuration needed to run a Workload. - -```yaml -apiVersion: score.dev/v1b1 -metadata: - name: hello-world - -containers: - container-id: - image: busybox -``` - -{{% /tab %}} -{{% tab name="Helm file" %}} - -The output of `score-helm run -f ./score.yaml -o ./values.yaml`. - -```yaml -containers: - container-id: - image: - name: busybox -``` - -The following is a description of the previous command. - -- `run` tells the CLI to translate the Score file to a Helm `values.yaml` file. -- `-f` is the path to the Score file. -- `-o` specifies the path to the `values.yaml` file. - -{{% /tab %}} -{{< /tabs >}} - -## Containers - -In the following example, we'll create a simple service based on `busybox` using the `containers` definition. - -{{< tabs >}} -{{% tab name="Score" %}} - -```yaml -apiVersion: score.dev/v1b1 - -metadata: - name: hello-world - -containers: - hello: - image: busybox - command: ["/bin/sh"] - args: ["-c", "while true; do echo Hello World!; sleep 5; done"] -``` - -{{% /tab %}} -{{% tab name="Helm file" %}} - -The output of `score-helm run -f ./score.yaml -o ./values.yaml`. - -```yaml -containers: - hello: - args: - - -c - - while true; do echo Hello World!; sleep 5; done - command: - - /bin/sh - image: - name: busybox -``` - -{{% /tab %}} -{{< /tabs >}} - -## Deploy to Helm - -The following steps are specific to deploying via Helm. - -### Initialize the Workload Helm Chart Repository - -Run the following command to initialize the Workload Helm chart repository. - -```bash -helm repo add score-helm-charts https://score-spec.github.io/score-helm-charts -``` - -Once this is installed, you will be able to use the default `score-helm-charts/workload` Helm chart (you can adapt it for your own use case, find the source code [here](https://github.com/score-spec/score-helm-charts)). - -### Install Helm `values.yaml` - -Run the following command to deploy the `score-helm-charts/workload` Helm chart with the Helm `values.yaml` file generated previously. - -```bash -helm install hello score-helm-charts/workload --values ./values.yaml -``` - -The following are the outputs of the previous command. - -```bash -NAME: hello -LAST DEPLOYED: Thu Nov 01 00:00:00 2022 -NAMESPACE: default -STATUS: deployed -REVISION: 1 -TEST SUITE: None -``` - -The following is the generated Kubernetes deployment object. - -```bash ---- -# Source: workload/templates/deployment.yaml -apiVersion: apps/v1 -kind: Deployment -metadata: - name: hello - labels: - helm.sh/chart: workload-0.3.0 - app.kubernetes.io/name: hello - app.kubernetes.io/instance: hello - app.kubernetes.io/version: "0.3.0" - app.kubernetes.io/managed-by: Helm -spec: - selector: - matchLabels: - app.kubernetes.io/name: hello - app.kubernetes.io/instance: hello - template: - metadata: - labels: - app.kubernetes.io/name: hello - app.kubernetes.io/instance: hello - spec: - containers: - - name: hello - image: "busybox" - command: - - /bin/sh - args: - - -c - - while true; do echo Hello World!; sleep 5; done -``` - -**Results** You've successfully defined a Hello World Workload in `score.yaml` and created a `deployment.yaml` file for Kubernetes through the score-helm Implementation. From 4cea8b7b464b0fffa4383387d469360b09e13f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Susa=20T=C3=BCnker?= Date: Tue, 16 Apr 2024 13:04:50 +0200 Subject: [PATCH 2/2] Added missing alias references for removed get started pages --- content/en/docs/get started/_index.md | 5 +++++ .../en/docs/score implementation/Other/score-humanitec.md | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/content/en/docs/get started/_index.md b/content/en/docs/get started/_index.md index d82ea32a..fc15ddae 100644 --- a/content/en/docs/get started/_index.md +++ b/content/en/docs/get started/_index.md @@ -2,6 +2,11 @@ title: "Get started with Score" linkTitle: "Get started" weight: 2 +aliases: +- /docs/get-started/install/ +- /docs/get-started/score-compose-hello-world/ +- /docs/get-started/score-helm-hello-world/ +- /docs/get-started/score-humanitec-hello-world/ --- ## Overview diff --git a/content/en/docs/score implementation/Other/score-humanitec.md b/content/en/docs/score implementation/Other/score-humanitec.md index a719ea33..c687df87 100644 --- a/content/en/docs/score implementation/Other/score-humanitec.md +++ b/content/en/docs/score implementation/Other/score-humanitec.md @@ -4,7 +4,6 @@ linkTitle: "score-humanitec" description: "Get started with the score-humanitec CLI" weight: 4 aliases: -- /docs/get-started/score-humanitec-hello-world/ - /docs/environment-variables/environment-variables-humanitec/ - /docs/reference/humanitec-extension/ - /docs/reference/score-cli/score-humanitec-run/