|
1 | 1 | # Terraform module for Sourcegraph executors (AWS) |
2 | 2 |
|
3 | | -This repository provides a [Terraform module](https://learn.hashicorp.com/tutorials/terraform/module-use?in=terraform/modules) to provision Sourcegraph executor compute resources on AWS. |
| 3 | +This repository provides a [Terraform module](https://learn.hashicorp.com/tutorials/terraform/module-use?in=terraform/modules) to provision [Sourcegraph executor](https://docs.sourcegraph.com/admin/executors) compute resources on AWS. If you are installing executors for the first time, [follow our complete setup guide](https://docs.sourcegraph.com/admin/deploy_executors). |
4 | 4 |
|
5 | 5 |  |
6 | 6 |
|
7 | | -## Usage examples |
| 7 | +This repository provides four submodules: |
8 | 8 |
|
9 | | -There are several examples in the [`examples`](./examples) directory. |
| 9 | +1. The [executors module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/executors) provisions compute resources for executors. |
| 10 | +1. The [docker-mirror module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/docker-mirror) provisions a Docker registry pull-through cache. |
| 11 | +1. The [networking module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/networking) provisions a network to be shared by the executor and Docker registry resources. |
| 12 | +1. The [credentials module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/credentials) provisions credentials required by the Sourcegraph instance to enable observability and auto-scaling of executors. |
10 | 13 |
|
11 | | -#### [`examples/single-executor`](./examples/single-executor) |
| 14 | +The [multiple-executors example](https://github.com/sourcegraph/terraform-aws-executors/blob/master/examples/multiple-executors) uses the submodule directly to provision multiple executor resource groups performing different types of work. Follow this example if you are: |
12 | 15 |
|
13 | | -This example uses the [root module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest) that provisions a network, a Docker registry mirror, and a set of resources to run _one_ type of executor. To provision more than one type of executor (multiple queues or multiple environments), see the following `multiple-executors` example. |
| 16 | +1. Provisioning executors for use with multiple features (e.g., both [auto-indexing](https://docs.sourcegraph.com/code_intelligence/explanations/auto_indexing) and [server-side batch changes](https://docs.sourcegraph.com/batch_changes/explanations/server_side)), or |
| 17 | +1. Provisioning resources for multiple Sourcegraph instances (e.g., test, prod) |
14 | 18 |
|
15 | | -The following variables must be supplied: |
| 19 | +This repository also provides a [root module](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest) combining the executors, network, and docker-mirror resources into an easier to use package. |
16 | 20 |
|
17 | | -**Note**: these variables must be set in tandem with changes to the target [Sourcegraph deployment](https://docs.sourcegraph.com/admin/deploy_executors). |
18 | | - |
19 | | -- `executor_sourcegraph_external_url`: The URL from which the target Sourcegraph instance is accessible from the executor instances. |
20 | | -- `executor_sourcegraph_executor_proxy_password`: The shared executor password defined in Sourcegraph. The value must be the same as the `executors.accessToken` site setting described in [Configuring executors and instance communication](https://docs.sourcegraph.com/admin/deploy_executors#configuring-executors-and-instance-communication). |
21 | | -- `executor_queue_name`: The name of the target queue to process (e.g., `codeintel`, `batches`). |
22 | | -- `executor_metrics_environment_label`: The name of the target environment (e.g., `staging`, `prod`). This value must be the same as the `EXECUTOR_METRIC_ENVIRONMENT_LABEL` environment variable as described in [Configuring auto scaling](https://docs.sourcegraph.com/admin/deploy_executors#aws). |
23 | | -- `executor_instance_tag`: Compute instances are tagged by this value by the key `executor_tag`. We recommend this value take the form `{executor_queue_name}-{executor_metrics_environment_label}`. This value must be the same as `INSTANCE_TAG` as described in [Configuring observability](https://docs.sourcegraph.com/admin/deploy_executors#aws-1). |
24 | | - |
25 | | -All of this module's variables are defined in [variables.tf](./variables.tf). |
26 | | - |
27 | | -#### [`examples/multiple-executors`](./examples/multiple-executors) |
28 | | - |
29 | | -This example uses [networking](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/networking), [docker-mirror](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/docker-mirror), and [executors](https://registry.terraform.io/modules/sourcegraph/executors/aws/latest/submodules/executors) submodules that provision a network, a Docker registry mirror, and sets of resources running one or more types of executors. |
30 | | - |
31 | | -The following variables must be supplied: |
32 | | - |
33 | | -- `sourcegraph_external_url`, `sourcegraph_executor_proxy_password`, `queue_name`, `metrics_environment_label`, and `instance_tag`: Analogous to the `executor_*` variables in the `single-executor` example. |
34 | | -- `resource_prefix`: A prefix unique to each set of compute resources. This prevents collisions between two uses of the `executors` module. We recommend this value be constructed the same way `instance_tag` is constructed. |
35 | | -- `docker_registry_mirror`: This variable is given the value `"http://${module.docker-mirror.ip_address}:5000"`, which converts the raw external IP address to an address resolvable by the executor instances. |
36 | | - |
37 | | -If your deployment environment already has a Docker registry that can be used, only the `executor` submodule must be used (and references to the `networking` and `docker-mirror` modules can be dropped). The Docker registry mirror address can be supplied along with its containing vcp and subnet as pre-existing identifier literals. |
38 | | - |
39 | | -All of these module's variables are defined in [modules/networking/variables.tf](./modules/networking/variables.tf), [modules/docker-mirror/variables.tf](./modules/docker-mirror/variables.tf), and [modules/executors/variables.tf](./modules/executors/variables.tf). |
| 21 | +The [single-executor example](https://github.com/sourcegraph/terraform-aws-executors/blob/master/examples/single-executor) uses the root module to provision a single executor type. Follow this example if you are deploying to a single Sourcegraph instance and using a single executors-backed feature. |
40 | 22 |
|
41 | 23 | ## Requirements |
42 | 24 |
|
|
0 commit comments