Files
shields/tutorial-production-hosting.html
2024-12-07 11:29:23 +00:00

221 lines
15 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Tutorial: production-hosting</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Tutorial: production-hosting</h1>
<section>
<header>
<h2>production-hosting</h2>
</header>
<article>
<h1>Production hosting</h1>
<p>Production hosting is managed by the Shields ops team:</p>
<ul>
<li><a href="https://github.com/calebcartwright">calebcartwright</a></li>
<li><a href="https://github.com/chris48s">chris48s</a></li>
<li><a href="https://github.com/paulmelnikow">paulmelnikow</a></li>
<li><a href="https://github.com/PyvesB">PyvesB</a></li>
</ul>
<p><a href="https://github.com/badges/shields/issues?q=is%3Aissue+is%3Aopen+label%3Aoperations"><img src="https://img.shields.io/github/issues/badges/shields/operations.svg?label=open%20operations%20issues" alt="operations issues"></a></p>
<p><a href="https://discordapp.com/channels/308323056592486420/480747695879749633">#ops chat room</a></p>
<table>
<thead>
<tr>
<th>Component</th>
<th>Subcomponent</th>
<th>People with access</th>
</tr>
</thead>
<tbody>
<tr>
<td>shields-io-production</td>
<td>Full access</td>
<td>@calebcartwright, @chris48s, @paulmelnikow</td>
</tr>
<tr>
<td>shields-io-production</td>
<td>Access management</td>
<td>@calebcartwright, @chris48s, @paulmelnikow</td>
</tr>
<tr>
<td>Raster server</td>
<td>Full access as team members</td>
<td>@paulmelnikow, @chris48s, @calebcartwright, @platan</td>
</tr>
<tr>
<td>shields-server.com redirector</td>
<td>Full access as team members</td>
<td>@paulmelnikow, @chris48s, @calebcartwright, @platan</td>
</tr>
<tr>
<td>Cloudflare (CDN)</td>
<td>Account owner</td>
<td>@espadrine</td>
</tr>
<tr>
<td>Cloudflare (CDN)</td>
<td>Access management</td>
<td>@espadrine</td>
</tr>
<tr>
<td>Cloudflare (CDN)</td>
<td>Admin access</td>
<td>@calebcartwright, @chris48s, @espadrine, @paulmelnikow, @PyvesB</td>
</tr>
<tr>
<td>Twitch</td>
<td>OAuth app</td>
<td>@PyvesB</td>
</tr>
<tr>
<td>Discord</td>
<td>OAuth app</td>
<td>@PyvesB</td>
</tr>
<tr>
<td>YouTube</td>
<td>Account owner</td>
<td>@PyvesB</td>
</tr>
<tr>
<td>GitLab</td>
<td>Account owner</td>
<td>@calebcartwright</td>
</tr>
<tr>
<td>GitLab</td>
<td>Account access</td>
<td>@calebcartwright, @chris48s, @paulmelnikow, @PyvesB</td>
</tr>
<tr>
<td>DNS</td>
<td>Account owner</td>
<td>@olivierlacan</td>
</tr>
<tr>
<td>DNS</td>
<td>Read-only account access</td>
<td>@espadrine, @paulmelnikow, @chris48s</td>
</tr>
<tr>
<td>Sentry</td>
<td>Error reports</td>
<td>@espadrine, @paulmelnikow</td>
</tr>
<tr>
<td>Metrics server</td>
<td>Owner</td>
<td>@platan</td>
</tr>
<tr>
<td>UptimeRobot</td>
<td>Account owner</td>
<td>@paulmelnikow</td>
</tr>
<tr>
<td>More metrics</td>
<td>Owner</td>
<td>@RedSparr0w</td>
</tr>
</tbody>
</table>
<h2>Attached state</h2>
<p>Shields has mercifully little persistent state:</p>
<ol>
<li>The GitHub tokens we collect are stored in a fly.io postgres database</li>
<li>The server keeps the <a href="https://github.com/badges/shields/blob/master/core/base-service/resource-cache.js">resource cache</a> in memory. It is neither
persisted nor inspectable.</li>
</ol>
<h2>Configuration</h2>
<p>To bootstrap the configuration of non-secret settings, we set a single environment variable:</p>
<pre class="prettyprint source"><code>NODE_CONFIG_ENV=shields-io-production
</code></pre>
<p>With that variable set, the server (<a href="https://github.com/lorenwest/node-config/wiki/Configuration-Files">using <code>config</code></a>) reads these
files:</p>
<ul>
<li><a href="../config/local-shields-io-production.template.yml"><code>local-shields-io-production.yml</code></a>.
This file contains secrets which are checked in with a deploy commit.</li>
<li><a href="../config/shields-io-production.yml"><code>shields-io-production.yml</code></a>. This file
contains non-secrets which are checked in to the main repo.</li>
<li><a href="../config/default.yml"><code>default.yml</code></a>. This file contains defaults.</li>
</ul>
<p>Secrets are supplied directly as environment vars.</p>
<h2>Badge CDN</h2>
<p>Sitting in front of the three servers is a Cloudflare Free account which
provides several services:</p>
<ul>
<li>Global CDN, caching, and SSL gateway for <code>img.shields.io</code> and <code>shields.io</code></li>
<li>Analytics through the Cloudflare dashboard</li>
<li>DNS resolution for <code>shields.io</code> (and subdomains)</li>
</ul>
<p>Cloudflare is configured to respect the servers' cache headers.</p>
<h2>Raster server</h2>
<p>The raster server <code>raster.shields.io</code> (a.k.a. the rasterizing proxy) is
hosted on Heroku. It's managed in the
<a href="https://github.com/badges/squint/">squint</a> repo.</p>
<h3>Fly.io Deployment</h3>
<p>Both the badge server and frontend are served from Fly.io. Deployments are
triggered using GitHub actions in a private repo.</p>
<h2>DNS</h2>
<p>DNS is registered with <a href="https://dnsimple.com/">DNSimple</a>.</p>
<h2>Error reporting</h2>
<p><a href="https://sentry.io/shields/">Error reporting</a> is one of the most useful tools we have for monitoring
the server. It's generously donated by <a href="https://sentry.io/shields/">Sentry</a>. We bundle
<a href="https://www.npmjs.com/package/@sentry/node"><code>@sentry/node</code></a> into the application, and the Sentry DSN is configured
via <code>local-shields-io-production.yml</code> (see <a href="https://github.com/badges/shields/blob/master/doc/self-hosting.md#sentry">documentation</a>).</p>
<h2>URLs</h2>
<p>The canonical and only recommended domain for badge URLs is <code>img.shields.io</code>. Currently it is possible to request badges on both <code>img.shields.io</code> and <code>shields.io</code> i.e: https://img.shields.io/badge/build-passing-brightgreen and https://shields.io/badge/build-passing-brightgreen will both work. However:</p>
<ul>
<li>We never show or generate the <code>img.</code>-less URL format on https://shields.io/</li>
<li>We make no guarantees about the <code>img.</code>-less URL format. At some future point we may remove the ability to serve badges on <code>shields.io</code> (without <code>img.</code>) without any warning. <code>img.shields.io</code> should always be used for badge urls.</li>
</ul>
<h2>Monitoring</h2>
<p>Overall server performance and requests by service are monitored using
<a href="https://metrics.shields.io/">Prometheus and Grafana</a>.</p>
<p>Request performance is monitored in two places:</p>
<ul>
<li><a href="https://stats.uptimerobot.com/PjXogHB5p">Status</a> (using <a href="https://uptimerobot.com/">UptimeRobot</a>)</li>
<li><a href="https://metrics.shields.io/">Server metrics</a> using Prometheus and Grafana</li>
<li><a href="https://shields.redsparr0w.com/1568/">@RedSparr0w's monitor</a> which posts <a href="http://shields.redsparr0w.com/discord_notification">notifications</a> to a private
<a href="https://discordapp.com/channels/308323056592486420/470700909182320646">#monitor chat room</a></li>
</ul>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-badge-maker.html">badge-maker</a></li><li><a href="module-badge-maker_lib_xml.html">badge-maker/lib/xml</a></li><li><a href="module-core_base-service_base.html">core/base-service/base</a></li><li><a href="module-core_base-service_base-graphql.html">core/base-service/base-graphql</a></li><li><a href="module-core_base-service_base-json.html">core/base-service/base-json</a></li><li><a href="module-core_base-service_base-svg-scraping.html">core/base-service/base-svg-scraping</a></li><li><a href="module-core_base-service_base-toml.html">core/base-service/base-toml</a></li><li><a href="module-core_base-service_base-xml.html">core/base-service/base-xml</a></li><li><a href="module-core_base-service_base-yaml.html">core/base-service/base-yaml</a></li><li><a href="module-core_base-service_errors.html">core/base-service/errors</a></li><li><a href="module-core_base-service_graphql.html">core/base-service/graphql</a></li><li><a href="module-core_base-service_openapi.html">core/base-service/openapi</a></li><li><a href="module-core_base-service_resource-cache.html">core/base-service/resource-cache</a></li><li><a href="module-core_base-service_service-definitions.html">core/base-service/service-definitions</a></li><li><a href="module-core_server_server.html">core/server/server</a></li><li><a href="module-core_service-test-runner_create-service-tester.html">core/service-test-runner/create-service-tester</a></li><li><a href="module-core_service-test-runner_icedfrisby-shields.html">core/service-test-runner/icedfrisby-shields</a></li><li><a href="module-core_service-test-runner_runner.html">core/service-test-runner/runner</a></li><li><a href="module-core_service-test-runner_service-tester.html">core/service-test-runner/service-tester</a></li><li><a href="module-core_service-test-runner_services-for-title.html">core/service-test-runner/services-for-title</a></li><li><a href="module-core_token-pooling_token-pool.html">core/token-pooling/token-pool</a></li><li><a href="module-services_build-status.html">services/build-status</a></li><li><a href="module-services_color-formatters.html">services/color-formatters</a></li><li><a href="module-services_contributor-count.html">services/contributor-count</a></li><li><a href="module-services_date.html">services/date</a></li><li><a href="module-services_downloads.html">services/downloads</a></li><li><a href="module-services_dynamic-common.html">services/dynamic-common</a></li><li><a href="module-services_dynamic_json-path.html">services/dynamic/json-path</a></li><li><a href="module-services_endpoint-common.html">services/endpoint-common</a></li><li><a href="module-services_licenses.html">services/licenses</a></li><li><a href="module-services_package-json-helpers.html">services/package-json-helpers</a></li><li><a href="module-services_php-version.html">services/php-version</a></li><li><a href="module-services_pipenv-helpers.html">services/pipenv-helpers</a></li><li><a href="module-services_route-builder.html">services/route-builder</a></li><li><a href="module-services_size.html">services/size</a></li><li><a href="module-services_steam_steam-base.html">services/steam/steam-base</a></li><li><a href="module-services_text-formatters.html">services/text-formatters</a></li><li><a href="module-services_validators.html">services/validators</a></li><li><a href="module-services_version.html">services/version</a></li><li><a href="module-services_website-status.html">services/website-status</a></li><li><a href="module-services_winget_version.html">services/winget/version</a></li></ul><h3>Classes</h3><ul><li><a href="BaseThunderstoreService.html">BaseThunderstoreService</a></li><li><a href="module-badge-maker_lib_xml-ElementList.html">ElementList</a></li><li><a href="module-badge-maker_lib_xml-XmlElement.html">XmlElement</a></li><li><a href="module-core_base-service_base-graphql-BaseGraphqlService.html">BaseGraphqlService</a></li><li><a href="module-core_base-service_base-json-BaseJsonService.html">BaseJsonService</a></li><li><a href="module-core_base-service_base-svg-scraping-BaseSvgScrapingService.html">BaseSvgScrapingService</a></li><li><a href="module-core_base-service_base-toml-BaseTomlService.html">BaseTomlService</a></li><li><a href="module-core_base-service_base-xml-BaseXmlService.html">BaseXmlService</a></li><li><a href="module-core_base-service_base-yaml-BaseYamlService.html">BaseYamlService</a></li><li><a href="module-core_base-service_base-BaseService.html">BaseService</a></li><li><a href="module-core_base-service_errors-Deprecated.html">Deprecated</a></li><li><a href="module-core_base-service_errors-ImproperlyConfigured.html">ImproperlyConfigured</a></li><li><a href="module-core_base-service_errors-Inaccessible.html">Inaccessible</a></li><li><a href="module-core_base-service_errors-InvalidParameter.html">InvalidParameter</a></li><li><a href="module-core_base-service_errors-InvalidResponse.html">InvalidResponse</a></li><li><a href="module-core_base-service_errors-NotFound.html">NotFound</a></li><li><a href="module-core_base-service_errors-ShieldsRuntimeError.html">ShieldsRuntimeError</a></li><li><a href="module-core_server_server-Server.html">Server</a></li><li><a href="module-core_service-test-runner_runner-Runner.html">Runner</a></li><li><a href="module-core_service-test-runner_service-tester-ServiceTester.html">ServiceTester</a></li><li><a href="module-core_token-pooling_token-pool-Token.html">Token</a></li><li><a href="module-core_token-pooling_token-pool-TokenPool.html">TokenPool</a></li><li><a href="module-services_route-builder.html">services/route-builder</a></li><li><a href="module-services_steam_steam-base-BaseSteamAPI.html">BaseSteamAPI</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-TUTORIAL.html">TUTORIAL</a></li><li><a href="tutorial-adding-new-config-values.html">adding-new-config-values</a></li><li><a href="tutorial-authentication.html">authentication</a></li><li><a href="tutorial-badge-urls.html">badge-urls</a></li><li><a href="tutorial-code-walkthrough.html">code-walkthrough</a></li><li><a href="tutorial-deprecating-badges.html">deprecating-badges</a></li><li><a href="tutorial-input-validation.html">input-validation</a></li><li><a href="tutorial-json-format.html">json-format</a></li><li><a href="tutorial-performance-testing.html">performance-testing</a></li><li><a href="tutorial-production-hosting.html">production-hosting</a></li><li><a href="tutorial-releases.html">releases</a></li><li><a href="tutorial-self-hosting.html">self-hosting</a></li><li><a href="tutorial-server-secrets.html">server-secrets</a></li><li><a href="tutorial-service-tests.html">service-tests</a></li><li><a href="tutorial-static-badges.html">static-badges</a></li></ul><h3>Global</h3><ul><li><a href="global.html#createNumRequestCounter">createNumRequestCounter</a></li><li><a href="global.html#fakeJwtToken">fakeJwtToken</a></li><li><a href="global.html#generateFakeConfig">generateFakeConfig</a></li><li><a href="global.html#getBadgeExampleCall">getBadgeExampleCall</a></li><li><a href="global.html#getServiceClassAuthOrigin">getServiceClassAuthOrigin</a></li><li><a href="global.html#isMetricWithPattern">isMetricWithPattern</a></li><li><a href="global.html#testAuth">testAuth</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Sat Dec 07 2024 11:29:22 GMT+0000 (Coordinated Universal Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>