|
| 1 | +--- |
| 2 | +title: Background on Application Installations |
| 3 | +description: >- |
| 4 | + A good unerstanding of an app's journey into your cluster will go a long way if you want to contribute your own application to the marketplace. |
| 5 | +--- |
| 6 | + |
| 7 | +In this guide we will lay out how your user provided values tie in with the deployment process as it relates to the configuration and templating of the app. |
| 8 | + |
| 9 | +When a user sets up a new Plural workspace in a git repository (we'll call that a *deployment repository* going forward) a `workspace.yaml` file is created that stores global values for that cluster such as the cloud account and region, the cluster and VPC name and what subdomain all the applications will be hosted under. |
| 10 | +Next, the user can install an application bundle using the `plural bundle install <app_name> <bundle>` CLI command. |
| 11 | + |
| 12 | +> Most applications come with more than one bundle, one for each targeted cloud provider. |
| 13 | +
|
| 14 | +The CLI will then prompt the user for inputs needed to setup that application, along with any dependencies of the application. |
| 15 | +These inputs are saved in the `context.yaml` file. |
| 16 | + |
| 17 | +For example, let's have a look how the `tree` of a deployment repository, where we installed Dagster with `plural bundle install dagster dagster-aws` (among others), might look like: |
| 18 | + |
| 19 | +```console |
| 20 | +$ pwd |
| 21 | +~/Repos/deployment-repository |
| 22 | +$ tree -L 1 . |
| 23 | +. |
| 24 | +├── bootstrap |
| 25 | +├── cert-manager |
| 26 | +├── console |
| 27 | +├── dagster |
| 28 | +├── postgres |
| 29 | +├── terraform.tfstate |
| 30 | +├── workspace.yaml |
| 31 | +└── context.yaml |
| 32 | +``` |
| 33 | + |
| 34 | +The `workspace.yaml` would look like this: |
| 35 | +```yaml |
| 36 | +apiVersion: plural.sh/v1alpha1 |
| 37 | +kind: ProjectManifest |
| 38 | +metadata: |
| 39 | + name: pluraldev |
| 40 | +spec: |
| 41 | + cluster: pluraldev |
| 42 | + bucket: pluraldevsh-tf-state |
| 43 | + project: "123456765432" |
| 44 | + provider: aws |
| 45 | + region: us-east-2 |
| 46 | + owner: |
| 47 | + email: plural-dev@pluraldev.sh |
| 48 | + network: |
| 49 | + subdomain: dev.plural.sh |
| 50 | + pluraldns: false |
| 51 | + bucketPrefix: pluraldev |
| 52 | + context: {} |
| 53 | +``` |
| 54 | +
|
| 55 | +And the `context.yaml` like this. In the `spec.configuration` section you can see the recorded user input for each artifact. |
| 56 | +```yaml |
| 57 | +apiVersion: plural.sh/v1alpha1 |
| 58 | +kind: Context |
| 59 | +spec: |
| 60 | + bundles: |
| 61 | + - repository: dagster |
| 62 | + name: dagster-aws |
| 63 | + - repository: plural |
| 64 | + name: plural-aws |
| 65 | + - repository: console |
| 66 | + name: console-aws |
| 67 | + - repository: bootstrap |
| 68 | + name: aws-efs |
| 69 | + - repository: cert-manager |
| 70 | + name: cert-manager-aws |
| 71 | + - repository: ingress-nginx |
| 72 | + name: ingress-nginx-aws |
| 73 | + buckets: |
| 74 | + - pluraldev-pluraldev-dagster |
| 75 | + domains: |
| 76 | + - console.dev.plural.sh |
| 77 | + - dagster.dev.plural.sh |
| 78 | + configuration: |
| 79 | + bootstrap: |
| 80 | + vpc_name: pluraldev |
| 81 | + cert-manager: {} |
| 82 | + console: |
| 83 | + admin_name: admin |
| 84 | + console_dns: console.dev.plural.sh |
| 85 | + ... |
| 86 | + repo_url: git@github.com:pluralsh/deployment-repo.git |
| 87 | + dagster: |
| 88 | + dagsterBucket: pluraldev-pluraldev-dagster |
| 89 | + hostname: dagster.dev.plural.sh |
| 90 | + ingress-nginx: {} |
| 91 | + postgres: |
| 92 | + wal_bucket: pluraldev-pluraldev-postgres-wal |
| 93 | +``` |
| 94 | + |
| 95 | +Next, the user would run `plural build` or `plural build --only <app name>` which will create a wrapper Helm chart and Terraform module for that app under a dedicated directory in the deployment repository. |
| 96 | +The wrapper Helm chart and Terraform module depend on the application Helm chart(s) and Terraform module(s) it gets from the application's artifact repository via the Plural API. |
| 97 | +During this step the CLI will generate the `default-values.yaml` for the wrapper helm chart and `main.tf` for the wrapper Terraform module using its templating engine. |
| 98 | +More precisely, `default-values.yaml` will contain the interpolated templated values from its `values.yaml.tpl` (see [Templating](/adding-new-application/templating)) that are derived by injecting the values saved in the `context.yaml` at `spec.configuration`. |
| 99 | + |
| 100 | +For example, after the `plural build --only dagster` command, the `tree` of the built Dagster application in your deployment repository would look like this: |
| 101 | + |
| 102 | +```console |
| 103 | +$ pwd |
| 104 | +~/Repos/deployment-repository/dagster |
| 105 | +$ tree . |
| 106 | +. |
| 107 | +├── build.hcl |
| 108 | +├── deploy.hcl |
| 109 | +├── diff.hcl |
| 110 | +├── helm |
| 111 | +│ └── dagster |
| 112 | +│ ├── Chart.lock |
| 113 | +│ ├── Chart.yaml |
| 114 | +│ ├── charts |
| 115 | +│ │ └── dagster-0.1.44.tgz |
| 116 | +│ ├── default-values.yaml |
| 117 | +│ ├── templates |
| 118 | +│ │ ├── NOTES.txt |
| 119 | +│ │ ├── application.yaml |
| 120 | +│ │ ├── license.yaml |
| 121 | +│ │ └── secret.yaml |
| 122 | +│ └── values.yaml |
| 123 | +├── manifest.yaml |
| 124 | +├── output.yaml |
| 125 | +└── terraform |
| 126 | + ├── aws |
| 127 | + │ ├── deps.yaml |
| 128 | + │ ├── iam.tf |
| 129 | + │ ├── main.tf |
| 130 | + │ ├── outputs.tf |
| 131 | + │ ├── postgres.tf |
| 132 | + │ └── variables.tf |
| 133 | + ├── main.tf |
| 134 | + └── outputs.tf |
| 135 | +``` |
| 136 | + |
| 137 | +Here you can see the wrapper Helm chart in `./helm/dagster` around the `./helm/dagster/charts/dagster-0.1.44.tgz`, i.e. the artifact's Helm chart that the Plural CLI downloads for you. |
| 138 | +Similarly the wrapper Terraform module in `./terraform` will contain a local copy of the artifact's Terraform module inside `./terraform/aws`. |
0 commit comments