home / content / repos

repos: 506026919

This data as json

id node_id name full_name private owner html_url description fork created_at updated_at pushed_at homepage size stargazers_count watchers_count language has_issues has_projects has_downloads has_wiki has_pages forks_count archived disabled open_issues_count license topics forks open_issues watchers default_branch permissions temp_clone_token organization network_count subscribers_count readme readme_html allow_forking visibility is_template template_repository web_commit_signoff_required has_discussions
506026919 R_kgDOHilbpw datasette-scale-to-zero simonw/datasette-scale-to-zero 0 9599 https://github.com/simonw/datasette-scale-to-zero Quit Datasette if it has not received traffic for a specified time period 0 2022-06-21T22:49:04Z 2022-07-13T14:02:31Z 2022-08-05T22:29:17Z https://datasette.io/plugins/datasette-scale-to-zero 22 8 8 Python 1 1 1 1 0 0 0 0 0 apache-2.0 ["datasette", "datasette-plugin"] 0 0 8 main {"admin": false, "maintain": false, "push": false, "triage": false, "pull": false}     0 1 # datasette-scale-to-zero [![PyPI](https://img.shields.io/pypi/v/datasette-scale-to-zero.svg)](https://pypi.org/project/datasette-scale-to-zero/) [![Changelog](https://img.shields.io/github/v/release/simonw/datasette-scale-to-zero?include_prereleases&label=changelog)](https://github.com/simonw/datasette-scale-to-zero/releases) [![Tests](https://github.com/simonw/datasette-scale-to-zero/workflows/Test/badge.svg)](https://github.com/simonw/datasette-scale-to-zero/actions?query=workflow%3ATest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-scale-to-zero/blob/main/LICENSE) Quit Datasette if it has not received traffic for a specified time period Some hosting providers such as [Fly](https://fly.io/) offer a scale to zero mechanism, where servers can shut down and will be automatically started when new traffic arrives. This plugin can be used to configure Datasette to quit X minutes (or seconds, or hours) after the last request it received. It can also cause the Datasette server to exit after a configured maximum time whether or not it is receiving traffic. ## Installation Install this plugin in the same environment as Datasette. datasette install datasette-scale-to-zero ## Configuration This plugin will only take effect if it has been configured. Add the following to your ``metadata.json`` or ``metadata.yml`` configuration file: ```json { "plugins": { "datasette-scale-to-zero": { "duration": "10m" } } } ``` This will cause Datasette to quit if it has not received any HTTP traffic for 10 minutes. You can set this value using a suffix of `m` for minutes, `h` for hours or `s` for seconds. To cause Datasette to exit if the server has been running for longer than a specific time, use `"max-age"`: ```json { "plugins": { "datasette-scale-to-zero": { "max-age": "10h" } } } ``` This example will exit the Datasette server if it has been running for more than ten hours. You can use `"duration"` and `"max-age"` together in the same configuration file: ```json { "plugins": { "datasette-scale-to-zero": { "max-age": "10h", "duration": "5m" } } } ``` This example will quit if no traffic has been received in five minutes, or if the server has been running for ten hours. ## Development To set up this plugin locally, first checkout the code. Then create a new virtual environment: cd datasette-scale-to-zero python3 -m venv venv source venv/bin/activate Now install the dependencies and test dependencies: pip install -e '.[test]' To run the tests: pytest <div id="readme" class="md" data-path="README.md"><article class="markdown-body entry-content container-lg" itemprop="text"><h1 dir="auto"><a id="user-content-datasette-scale-to-zero" class="anchor" href="#user-content-datasette-scale-to-zero" aria-hidden="true"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>datasette-scale-to-zero</h1> <p dir="auto"><a href="https://pypi.org/project/datasette-scale-to-zero/" rel="nofollow"><img src="https://camo.githubusercontent.com/ca2386dea8d6d4b851a3603de67aefac24923128b004780fa51d9c4b8d0ff1c6/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6461746173657474652d7363616c652d746f2d7a65726f2e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/datasette-scale-to-zero.svg" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-scale-to-zero/releases"><img src="https://camo.githubusercontent.com/096b12a9ae4fda1fae3c316e4b4625210e2a51100ed34dd764c7baf7f15fd266/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73696d6f6e772f6461746173657474652d7363616c652d746f2d7a65726f3f696e636c7564655f70726572656c6561736573266c6162656c3d6368616e67656c6f67" alt="Changelog" data-canonical-src="https://img.shields.io/github/v/release/simonw/datasette-scale-to-zero?include_prereleases&amp;label=changelog" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-scale-to-zero/actions?query=workflow%3ATest"><img src="https://github.com/simonw/datasette-scale-to-zero/workflows/Test/badge.svg" alt="Tests" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-scale-to-zero/blob/main/LICENSE"><img src="https://camo.githubusercontent.com/1698104e976c681143eb0841f9675c6f802bb7aa832afc0c7a4e719b1f3cf955/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865253230322e302d626c75652e737667" alt="License" data-canonical-src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" style="max-width: 100%;"></a></p> <p dir="auto">Quit Datasette if it has not received traffic for a specified time period</p> <p dir="auto">Some hosting providers such as <a href="https://fly.io/" rel="nofollow">Fly</a> offer a scale to zero mechanism, where servers can shut down and will be automatically started when new traffic arrives.</p> <p dir="auto">This plugin can be used to configure Datasette to quit X minutes (or seconds, or hours) after the last request it received. It can also cause the Datasette server to exit after a configured maximum time whether or not it is receiving traffic.</p> <h2 dir="auto"><a id="user-content-installation" class="anchor" href="#user-content-installation" aria-hidden="true"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Installation</h2> <p dir="auto">Install this plugin in the same environment as Datasette.</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="datasette install datasette-scale-to-zero"><pre class="notranslate"><code>datasette install datasette-scale-to-zero </code></pre></div> <h2 dir="auto"><a id="user-content-configuration" class="anchor" href="#user-content-configuration" aria-hidden="true"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Configuration</h2> <p dir="auto">This plugin will only take effect if it has been configured.</p> <p dir="auto">Add the following to your <code>metadata.json</code> or <code>metadata.yml</code> configuration file:</p> <div class="highlight highlight-source-json notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ &quot;plugins&quot;: { &quot;datasette-scale-to-zero&quot;: { &quot;duration&quot;: &quot;10m&quot; } } }"><pre>{ <span class="pl-ent">"plugins"</span>: { <span class="pl-ent">"datasette-scale-to-zero"</span>: { <span class="pl-ent">"duration"</span>: <span class="pl-s"><span class="pl-pds">"</span>10m<span class="pl-pds">"</span></span> } } }</pre></div> <p dir="auto">This will cause Datasette to quit if it has not received any HTTP traffic for 10 minutes.</p> <p dir="auto">You can set this value using a suffix of <code>m</code> for minutes, <code>h</code> for hours or <code>s</code> for seconds.</p> <p dir="auto">To cause Datasette to exit if the server has been running for longer than a specific time, use <code>"max-age"</code>:</p> <div class="highlight highlight-source-json notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ &quot;plugins&quot;: { &quot;datasette-scale-to-zero&quot;: { &quot;max-age&quot;: &quot;10h&quot; } } }"><pre>{ <span class="pl-ent">"plugins"</span>: { <span class="pl-ent">"datasette-scale-to-zero"</span>: { <span class="pl-ent">"max-age"</span>: <span class="pl-s"><span class="pl-pds">"</span>10h<span class="pl-pds">"</span></span> } } }</pre></div> <p dir="auto">This example will exit the Datasette server if it has been running for more than ten hours.</p> <p dir="auto">You can use <code>"duration"</code> and <code>"max-age"</code> together in the same configuration file:</p> <div class="highlight highlight-source-json notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="{ &quot;plugins&quot;: { &quot;datasette-scale-to-zero&quot;: { &quot;max-age&quot;: &quot;10h&quot;, &quot;duration&quot;: &quot;5m&quot; } } }"><pre>{ <span class="pl-ent">"plugins"</span>: { <span class="pl-ent">"datasette-scale-to-zero"</span>: { <span class="pl-ent">"max-age"</span>: <span class="pl-s"><span class="pl-pds">"</span>10h<span class="pl-pds">"</span></span>, <span class="pl-ent">"duration"</span>: <span class="pl-s"><span class="pl-pds">"</span>5m<span class="pl-pds">"</span></span> } } }</pre></div> <p dir="auto">This example will quit if no traffic has been received in five minutes, or if the server has been running for ten hours.</p> <h2 dir="auto"><a id="user-content-development" class="anchor" href="#user-content-development" aria-hidden="true"><svg class="octicon octicon-link" viewBox="0 0 16 16" version="1.1" width="16" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a>Development</h2> <p dir="auto">To set up this plugin locally, first checkout the code. Then create a new virtual environment:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cd datasette-scale-to-zero python3 -m venv venv source venv/bin/activate"><pre class="notranslate"><code>cd datasette-scale-to-zero python3 -m venv venv source venv/bin/activate </code></pre></div> <p dir="auto">Now install the dependencies and test dependencies:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pip install -e '.[test]'"><pre class="notranslate"><code>pip install -e '.[test]' </code></pre></div> <p dir="auto">To run the tests:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pytest"><pre class="notranslate"><code>pytest </code></pre></div> </article></div> 1 public 0   0  

Links from other tables

  • 4 rows from repo in releases
Powered by Datasette · Queries took 4.155ms