diff --git a/content/en/docs/How to/github.md b/content/en/docs/How to/github.md index 51e398eb..4e6d3f60 100644 --- a/content/en/docs/How to/github.md +++ b/content/en/docs/How to/github.md @@ -2,7 +2,7 @@ title: "Setup GitHub Actions" subtitle: "Setup GitHub Actions for Continuous Integration" linkTitle: GitHub Actions -weight: 5 +weight: 1 draft: false description: > How to set up Score with GitHub Actions diff --git a/content/en/docs/How to/overrides.md b/content/en/docs/How to/overrides.md index 5cdbca3d..278362df 100644 --- a/content/en/docs/How to/overrides.md +++ b/content/en/docs/How to/overrides.md @@ -1,33 +1,28 @@ --- title: "Specify configuration overrides" linkTitle: "Overrides" -weight: 5 +weight: 2 description: > - How to define overrides for your Score specification + How to define overrides for your Score specification with score-compose aliases: - /docs/override/ - /docs/override/override-parameters/ --- -An override is a way for you to customize or modify certain aspects of the `score.yaml` file. This can be achieved using either: +An override is a way for you to customize or modify certain aspects of the `score.yaml` file. With score-compose can be achieved using either: - [Overrides file](#overrides-file) - [Overrides CLI flag](#overrides-property) -Currently, these options are supported by the following Score implementation CLIs: - -- `score-compose` -- `score-helm` - ## Overrides file -If an `overrides.score.yaml` file is found, the Score implementation (CLI) applies overrides on the output. This occurs whether a flag is provided or not. +If an `overrides.score.yaml` file is found, the score-compose CLI applies overrides on the output. This occurs whether a flag is provided or not. -### Example: How to override a command +### How to override a command To override the defaults declared in your `score.yaml` file, create a `overrides.score.yaml` file and declare your overrides. -1. Create a `score.yaml` file. +**1.** Create a `score.yaml` file. ```yaml apiVersion: score.dev/v1b1 @@ -42,7 +37,7 @@ containers: - --version ``` -2. Create an `overrides.score.yaml` file and declare an override. +**2.** Create an `overrides.score.yaml` file and declare an override. ```yaml containers: @@ -52,51 +47,34 @@ containers: - --help ``` -3. Run the following command to override the default arguments by the `overrides.score.yaml` file. +**3.** Run the following command to override the default arguments with the contents of the `overrides.score.yaml` file. ```bash -score-compose run -f ./score.yaml \ - -o ./compose.yaml \ - --overrides ./overrides.score.yaml +score-compose generate score.yaml --overrides-file overrides.score.yaml ``` -The following is an example output of the previous command. - -```yaml -services: - run-python-app: - entrypoint: - - python - - --help - image: python3 -``` - -**Result:** You've successfully overridden the default configuration file with a command described in your `overrides.score.yaml` file. +For more information please refer to the score-compose [examples library](https://github.com/score-spec/score-compose/tree/main/examples/07-overrides#overriding-the-score-file-with---overrides-file). ## Overrides CLI flag -With Score, you can override the declared values in your command line arguments with the `--property` flag. This is an alternative approach to using a `overrides.score.yaml` file. For details, please refer to the documentation of the implementation CLI you are using. +You can override the declared values in your command line arguments with the `--override-property` flag. This is an alternative approach to using a `overrides.score.yaml` file. -### Example: How to override a property +### How to override a property -Use the `--property` flag and specify the path to the property and the new value. +Use the `--override-property` flag and specify the path to the property and the new value. For example, the following looks for the `containers.my-service.image` property and overrides the default image name with a value of `python3`. ```bash -score-compose run -f score.yaml --property containers.my-service.image=python3 +score-compose run -f score.yaml --override-property containers.my-service.image=python3 ``` -### Example: How to remove a property +### How to remove a property Set the path of the property to an empty value to remove the property. ```bash -score-compose run -f score.yaml --property metadata.my-service= +score-compose run -f score.yaml --override-property metadata.my-service= ``` -For more information, see the [Score CLI reference]({{< relref "docs/score-implementation" >}}). - -### Example: How to substitute a property - -Use the `--property` flag to specify a placeholder substitution in resource references section. +For more information, please refer to the score-compose [examples library](https://github.com/score-spec/score-compose/tree/main/examples/07-overrides#overriding-individual-properties-in-the-score-file). \ No newline at end of file diff --git a/content/en/docs/How to/score-compose.md b/content/en/docs/How to/score-compose.md deleted file mode 100644 index ca13580d..00000000 --- a/content/en/docs/How to/score-compose.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: "Quick Start: Resources with score-compose" -subtitle: "score-compose" -date: 2017-01-05 -weight: 5 -draft: true -description: > - A quick start for score-compose. ---- - -## Local Setup with Docker Compose - -Sample `compose.yaml` configuration for the backend microservice that uses PostgreSQL database: - -```yaml -services: - - backend: - build: . - depends_on: - - db - ports: - - "8080:8080" - environment: - PORT: 8080 - CONNECTION_STRING: postgresql://root:PassW0rd@db:5432/pipelines - - db: - image: postgres:11 - ports: - - "5432:5432" - volumes: - - /var/lib/postgresql/data - environment: - POSTGRES_DB: pipelines - POSTGRES_USER: root - POSTGRES_PASSWORD: PassW0rd -``` - -## Score configuration - -The following `Score.yaml` configuration can be used to define the service and its dependencies: - - - -```yaml -name: backend - -container: - image: busybox - command: - - /bin/sh - - -c - - while true; do printenv; echo ...sleeping 10 sec...; sleep 10; done - variables: - PORT: 8080 - CONNECTION_STRING: postgresql://${resources.db.username}:${resources.db.password}@${resources.db.host}:${resources.db.port}/${resources.db.name} - -resources: - db: - type: postgres -``` - -## Executing `score-compose` - -The user can now produce a `backend.compose.yaml` override file for Docker Compose with `score-compose` CLI tool: - - - -```bash -score-compose run -f /tmp/Score.yaml -o /tmp/backend.compose.yaml \ - --env-file /tmp/backend.env -``` - -The tool should produce `/tmp/backend.compose.yaml` file: - -```bash -services: - backend: - image: busybox - command: - - /bin/sh - - -c - - while true; do printenv; echo ...sleeping 10 sec...; sleep 10; done - environment: - PORT: 8080 - CONNECTION_STRING: postgresql://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME -``` - -In addition, `/tmp/backend.env` should be written: - -```bash -DB_HOST=localhost -DB_PORT=5432 -DB_NAME= -DB_USERNAME= -DB_PASSWORD= -``` - -## Final Docker Compose configuration - -The user can now update `compose.yaml` file to accommodate for service overrides, produced from `Score.yaml`, and to use the environment variables listed in the `backend.env`: - - - -```bash -services: - - backend: - build: . - depends_on: - - db - ports: - - "8080:8080" - environment: - PORT: 8080 - CONNECTION_STRING: postgresql://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT/$DB_NAME - - db: - image: postgres:11 - ports: - - "5432:$DB_PORT" - volumes: - - /var/lib/postgresql/data - environment: - POSTGRES_DB: $DB_NAME - POSTGRES_USER: $DB_USER - POSTGRES_PASSWORD: $DB_PASSWORD -``` - -## Working with multiple environments - -If the team uses Docker Compose to deploy services in multiple environments, they may now use different `.env` files to apply settings specific to each environment. They may also leverage profiles in their `compose.yaml` to alter overall application and infrastructure layout in each environment. - -At scale, teams may also choose to use Helm (Kubernetes) or Humanitec to deploy into remote environments. - -In all these cases using `Score.yaml` would ensure, that the service itself is configured in the same way across all environments.