Skip to content

Commit

Permalink
Remove unused things, mostly Azure-related (#54192)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Heis <[email protected]>
Co-authored-by: Evan Bonsignori <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2025
1 parent 7a16634 commit 2897713
Show file tree
Hide file tree
Showing 18 changed files with 11 additions and 409 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ jobs:
- uses: github/codeql-action/init@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
languages: javascript # comma separated list of values from {go, python, javascript, java, cpp, csharp, ruby}
config: |
paths-ignore:
- 'src/open-source/scripts/add-pr-links.js'
- uses: github/codeql-action/analyze@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
continue-on-error: true

Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
data/release-notes/
src/bookmarklets/
src/open-source/scripts/add-pr-links.js
/.next/

/.coverage
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@
"!/.*",
"/.next/",
"src/bookmarklets/*",
"src/open-source/scripts/add-pr-links.js",
"src/open-source/scripts/pr-link-source.js",
"rest-api-description/",
"docs-internal-data/",
"src/code-scanning/scripts/generate-code-scanning-query-list.ts"
Expand Down
8 changes: 0 additions & 8 deletions src/bookmarklets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,3 @@ The installation requires a few steps:
1. Paste the path in place of where it says `REPLACE_ME` in line 1 (make sure to leave the single quotes around it).
1. Change the title to something like `Open in VSC`.
1. Drag the generated link onto your bookmarks bar.

## Add preview links to PRs

[`src/bookmarklets/add-pr-links.js`](./add-pr-links.js)

This bookmarklet modifies the `Files changed` page of a GitHub pull request that has a current staging deployment. For each Markdown file in the diff view, it adds links to the preview deployment of the file for each version: `FPT / GHEC / GHES / AE`. (Some of these may redirect to another version or 404 if that version of the page doesn't exist.)

Note: readable JavaScript source lives in `src/bookmarklets/pr-link-source.js`. The bookmarklet code was generated via https://chriszarate.github.io/bookmarkleter.
2 changes: 1 addition & 1 deletion src/frame/middleware/healthcheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const router = express.Router()

/**
* Returns the healthiness of the service.
* This may be used by azure app service (forthcoming) to determine whether this
* This may be used by Moda to determine whether this
* instance remains in the pool to handle requests
* For example: if we have a failing database connection we may return a 500 status here.
*/
Expand Down
5 changes: 2 additions & 3 deletions src/frame/middleware/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ export default function (app: Express) {
app.use(datadog)
}

// Put this early to make it as fast as possible because it's used,
// and used very often, by the Azure load balancer to check the
// health of each node.
// Put this early to make it as fast as possible because it's used
// to check the health of each cluster.
app.use('/healthcheck', healthcheck)

// Must appear before static assets and all other requests
Expand Down
4 changes: 2 additions & 2 deletions src/frame/tests/robots-txt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ describe('robots.txt', () => {
).toBe(true)
})

test('disallows indexing of azurecontainer.io domains', async () => {
test('disallows indexing of internal domains', async () => {
const res = await get('/robots.txt', {
headers: {
host: 'docs-internal-preview-12345-asdfz.azurecontainer.io',
host: 'docs-internal.github.com',
},
})
expect(res.body).toEqual('User-agent: *\nDisallow: /')
Expand Down
2 changes: 1 addition & 1 deletion src/languages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Periodically, translators read the `content/**` and `data/**` directories from `

## Deployment of translated content

In the deployment workflow, we [checkout](https://github.com/github/docs-internal/blob/a8e52aad1a6b67f41da92d314bd7fd8cd84193a4/.github/workflows/azure-prod-build-deploy.yml#L90-L92) each and every translation repo and put their contents into the `translations/` directory.
During the build step of our deployment, we checkout every translation repo into the `translations/` directory.

The enabled languages and their source directories are interpreted in [`src/languages/lib/languages.js`](https://github.com/github/docs-internal/blob/a8e52aad1a6b67f41da92d314bd7fd8cd84193a4/src/languages/lib/languages.js), which ensures English and translated content are in the same Docker image we deploy.

Expand Down
74 changes: 0 additions & 74 deletions src/links/scripts/update-developer-site-links.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/observability/lib/statsd.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default new StatsD({
// DD_AGENT_HOST and DD_DOGSTATSD_PORT environment variables.
// If undefined, the host will default to 'localhost' and the port
// will default to 8125.
// Azure docker templates configure DD_AGENT_HOST but not DD_DOGSTATSD_PORT.
// Moda configuration defines DD_DOGSTATSD_PORT but not DD_AGENT_HOST.
// For Moda, the host must be set to the Kubernetes node name, which is
// set in KUBE_NODE_HOSTNAME.
Expand Down
3 changes: 0 additions & 3 deletions src/open-source/README.md

This file was deleted.

1 change: 0 additions & 1 deletion src/open-source/scripts/add-pr-links.js

This file was deleted.

87 changes: 0 additions & 87 deletions src/open-source/scripts/find-unicorn-action-shas.js

This file was deleted.

92 changes: 0 additions & 92 deletions src/open-source/scripts/pr-link-source.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/shielding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ At its root, the `src/shielding/frame/middleware/index.js` is injected into our
Express server. From there, it loads all its individual middleware handlers.

Each middleware is one file that focuses on a single use-case. The
use-cases are borne from studying log files (CDN and Azure App Service) to
use-cases are borne from studying log files to
spot patterns of request abuse.

## Notes

- The best place to do shielding is as close to the client(s) as possible,
i.e. in the CDN or in Azure Frontdoor. Having the code in our own backend
i.e. in the CDN. Having the code in our own backend
has the advantage that it's easier to write custom business logic
along with end-to-end tests.
- Some shielding "tricks" appear in other places throughout the code
Expand Down
6 changes: 3 additions & 3 deletions src/shielding/middleware/rate-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function createRateLimiter(max = MAX) {
// 1 minute
windowMs: EXPIRES_IN_AS_SECONDS * 1000,
// limit each IP to X requests per windowMs
// We currently have about 25 instances in production. That's routed
// in Azure to spread the requests to each healthy instance.
// We currently have about 12 instances in production. That's routed
// in Moda to spread the requests to each healthy instance.
// So, the true rate limit, per `windowMs`, is this number multiplied
// by the current number of instances.
max: max,
Expand All @@ -32,7 +32,7 @@ export function createRateLimiter(max = MAX) {

keyGenerator: (req) => {
let { ip } = req
// In our Azure preview environment, with the way the proxying works,
// In our previous environments, with the way the proxying works,
// the `x-forwarded-for` is always the origin IP with a port number
// attached. E.g. `75.40.90.27:56675, 169.254.129.1`
// This port number portion changes with every request, so we strip it.
Expand Down
Loading

0 comments on commit 2897713

Please sign in to comment.