From 69b95599ace386e5b8e817e2ff8b8df98bdf2433 Mon Sep 17 00:00:00 2001 From: Michael Lin Date: Wed, 4 May 2022 14:55:50 -0700 Subject: [PATCH 1/2] Update dns related processes --- .../engineering/cloud/devops/dns.md | 33 ++++++++++++++++--- .../process/deployments/playbooks.md | 26 +++++++-------- 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/content/departments/product-engineering/engineering/cloud/devops/dns.md b/content/departments/product-engineering/engineering/cloud/devops/dns.md index f32148691561..6c72d605cad5 100644 --- a/content/departments/product-engineering/engineering/cloud/devops/dns.md +++ b/content/departments/product-engineering/engineering/cloud/devops/dns.md @@ -1,17 +1,42 @@ # Add or modify DNS records to Sourcegraph owned domains Sourcegraph follows an Infrastructure as Code (IaC) model. To make changes to Sourcegraph -owned DNS records you should make the change to the code in Terraform in our infrastructure repo. +owned DNS records you should make the change to the code in Terraform in our [sourcegraph/infrastructure] repo. +1. Clone [sourcegraph/infrastructure] 1. Navigate to the `dns` folder 1. Create a file, add the record near the most relevant DNS entries, or modify the existing record - 1. For domains with a large number of TXT records like + 1. For domains with a large number of TXT records like Sourcegraph.com, we typically create a file `sourcegraph.$TXT_PROVIDER.tf` -1. Create a pull request in the infra repo with your changes +1. Create a pull request in the repo with your changes +1. Open [Buildkite](https://buildkite.com/sourcegraph/infrastructure) + + 1. Check status of `ci/terraform.sh dns` job and it should pass without error. + 1. If there is any error, you should consult the logs or reach out to `#cloud-devops` + +1. Wait for Buildkite to finish your build 1. Get approve from the cloud-devops team 1. `terraform apply` the PR or ask a member of the devops team to do this 1. Merge the PR **after** the apply succeeds -For other +## FAQ + +### Are you adding a DNS record for a Netlify site? + +You should create a CNAME record pointing to `sourcegraph.netlifyglobalcdn.com`. In terraform, it looks something like + +[example](https://github.com/sourcegraph/infrastructure/blob/621b30a24f448f78509b75600d4338491a7ec127/dns/sourcegraph.tf#L48-L54) + +```tf +resource "cloudflare_record" "about-sourcegraph-com" { + zone_id = data.cloudflare_zones.sourcegraph_com.zones[0].id + name = "about" + type = "CNAME" + value = var.netlify-enterprise-cdn-cname + proxied = false +} +``` + +[sourcegraph/infrastructure]: https://github.com/sourcegraph/infrastructure diff --git a/content/departments/product-engineering/engineering/process/deployments/playbooks.md b/content/departments/product-engineering/engineering/process/deployments/playbooks.md index 94c98e21c38f..86f8290b13f5 100644 --- a/content/departments/product-engineering/engineering/process/deployments/playbooks.md +++ b/content/departments/product-engineering/engineering/process/deployments/playbooks.md @@ -167,27 +167,23 @@ See an [example query](https://console.cloud.google.com/bigquery?sq=527047051561 **Note**: This method only permits read-only access -### Restarting about.sourcegraph.com and docs.sourcegraph.com +### Restarting docs.sourcegraph.com -To restart the services powering about.sourcegraph.com and docs.sourcegraph.com: +To restart the services powering docs.sourcegraph.com: -1. List the active pods with `kubectl get pods`. This should produce a list that includes items like the following: +Configure kubectl context to the dotcom cluster - ``` - NAME READY STATUS RESTARTS AGE - about-sourcegraph-com-74f96c659b-t6lqp 1/1 Running 0 7m49s - docs-sourcegraph-com-5f97dd5db-7wrxm 1/1 Running 0 7m49s - ``` - - The exact names will differ, but the general format will be the same. +```sh +gcloud container clusters get-credentials cloud --zone us-central1-f --project sourcegraph-dev +``` -1. Delete the pods, being careful to copy the exact names from the output in the previous step. For example, with that output, you would run: +Rollout a restart - ``` - kubectl delete pod about-sourcegraph-com-74f96c659b-t6lqp docs-sourcegraph-com-5f97dd5db-7wrxm - ``` +```sh +kubectl -n default rollout restart deploy docs-sourcegraph-com +``` -1. Wait a moment, and check https://about.sourcegraph.com/ and https://docs.sourcegraph.com/. +Wait a moment, and check https://docs.sourcegraph.com/. ### Creating banners for maintenance tasks From 4f283c8d0cd674a142e6ec95c6a93861bdab5354 Mon Sep 17 00:00:00 2001 From: michaellzc Date: Wed, 4 May 2022 22:13:28 +0000 Subject: [PATCH 2/2] squash! Prettier --- .../product-engineering/engineering/cloud/devops/dns.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/departments/product-engineering/engineering/cloud/devops/dns.md b/content/departments/product-engineering/engineering/cloud/devops/dns.md index 6c72d605cad5..a027c9374398 100644 --- a/content/departments/product-engineering/engineering/cloud/devops/dns.md +++ b/content/departments/product-engineering/engineering/cloud/devops/dns.md @@ -7,14 +7,14 @@ owned DNS records you should make the change to the code in Terraform in our [so 1. Navigate to the `dns` folder 1. Create a file, add the record near the most relevant DNS entries, or modify the existing record - 1. For domains with a large number of TXT records like + 1. For domains with a large number of TXT records like Sourcegraph.com, we typically create a file `sourcegraph.$TXT_PROVIDER.tf` 1. Create a pull request in the repo with your changes 1. Open [Buildkite](https://buildkite.com/sourcegraph/infrastructure) - 1. Check status of `ci/terraform.sh dns` job and it should pass without error. - 1. If there is any error, you should consult the logs or reach out to `#cloud-devops` + 1. Check status of `ci/terraform.sh dns` job and it should pass without error. + 1. If there is any error, you should consult the logs or reach out to `#cloud-devops` 1. Wait for Buildkite to finish your build 1. Get approve from the cloud-devops team