home / content / repos

repos: 248385299

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
248385299 MDEwOlJlcG9zaXRvcnkyNDgzODUyOTk= datasette-publish-fly simonw/datasette-publish-fly 0 9599 https://github.com/simonw/datasette-publish-fly Datasette plugin for publishing data using Fly 0 2020-03-19T01:47:01Z 2022-09-29T22:28:45Z 2022-09-29T17:25:15Z   50 10 10 Python 1 1 1 1 0 3 0 0 4 apache-2.0 ["datasette", "datasette-io", "datasette-plugin", "fly"] 3 4 10 main {"admin": false, "maintain": false, "push": false, "triage": false, "pull": false}     3 3 # datasette-publish-fly [![PyPI](https://img.shields.io/pypi/v/datasette-publish-fly.svg)](https://pypi.org/project/datasette-publish-fly/) [![Changelog](https://img.shields.io/github/v/release/simonw/datasette-publish-fly?include_prereleases&label=changelog)](https://github.com/simonw/datasette-publish-fly/releases) [![Tests](https://github.com/simonw/datasette-publish-fly/workflows/Test/badge.svg)](https://github.com/simonw/datasette-publish-fly/actions?query=workflow%3ATest) [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-publish-fly/blob/main/LICENSE) [Datasette](https://datasette.io/) plugin for deploying Datasette instances to [Fly.io](https://fly.io/). Project background: [Using SQLite and Datasette with Fly Volumes](https://simonwillison.net/2022/Feb/15/fly-volumes/) ## Installation Install this plugin in the same environment as Datasette. $ datasette install datasette-publish-fly ## Deploying read-only data First, install the `flyctl` command-line tool by [following their instructions](https://fly.io/docs/getting-started/installing-flyctl/). Run `flyctl auth signup` to create an account there, or `flyctl auth login` if you already have one. You can now use `datasette publish fly` to publish one or more SQLite database files: datasette publish fly my-database.db --app="my-data-app" The argument you pass to `--app` will be used for the URL of your application: `my-data-app.fly.dev`. To update an application, run the publish command passing the same application name to the `--app` option. Fly have [a free tier](https://fly.io/docs/about/pricing/#free-allowances), beyond which they will charge you monthly for each application you have live. Details of their pricing can be [found on their site](https://fly.io/docs/pricing/). Your application will be deployed at `https://your-app-name.fly.io/` - be aware that it may take several minutes to start working the first time you deploy it. ## Using Fly volumes for writable databases Fly [Volumes](https://fly.io/docs/reference/volumes/) provide persistant disk storage for Fly applications. Volumes can be 1GB or more in size and the Fly free tier includes 3GB of volume space. Datasette plugins such as [datasette-uploads-csvs](https://datasette.io/plugins/datasette-upload-csvs) and [datasette-tiddlywiki](https://datasette.io/plugins/datasette-tiddlywiki) can be deployed to Fly and store their mutable data in a volume. > :warning: **You should only run a single instance of your application** if your database accepts writes. Fly has excellent support for running multiple instances in different geographical regions, but `datasette-publish-fly` with volumes is not yet compatible with that model. You should probably [use Fly PostgreSQL instead](https://fly.io/blog/globally-distributed-postgres/). Here's how to deploy `datasette-tiddlywiki` with authentication provided by `datasette-auth-passwords`. First, you'll need to create a root password hash to use to sign into the instance. You can do that by installing the plugin and running the `datasette hash-password` command, or by using [this hosted tool](https://datasette-auth-passwords-demo.datasette.io/-/password-tool). The hash should look like `pbkdf2_sha256$...` - you'll need this for the next step. In this example we're also deploying a read-only database called `content.db`. Pick a name for your new application, then run the following: datasette publish fly \ content.db \ --app your-application-name \ --create-volume 1 \ --create-db tiddlywiki \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' This will create the new application, deploy the `content.db` read-only database, create a 1GB volume for that application, create a new database in that volume called `tiddlywiki.db`, then install the two plugins and configure the password you specified. ### Updating applications that use a volume Once you have deployed an application using a volume, you can update that application without needing the `--create-volume` or `--create-db` options. To add the [datasette-graphq](https://datasette.io/plugins/datasette-graphql) plugin to your deployed application you would run the following: datasette publish fly \ content.db \ --app your-application-name \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --install datasette-graphql \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' \ Since the application name is the same you don't need the `--create-volume` or `--create-db` options - these are persisted automatically between deploys. You do need to specify the full list of plugins that you want to have installed, and any plugin secrets. You also need to include any read-only database files that are part of the instance - `content.db` in this example - otherwise the new deployment will not include them. ### Advanced volume usage `datasette publish fly` will add a volume called `datasette` to your Fly application. You can customize the name using the `--volume name custom_name` option. Fly can be used to scale applications to run multiple instances in multiple regions around the world. This works well with read-only Datasette but is not currently recommended using Datasette with volumes, since each Fly replica would need its own volume and data stored in one instance would not be visible in others. If you want to use multiple instances with volumes you will need to switch to using the `flyctl` command directly. The `--generate-dir` option, described below, can help with this. ## Generating without deploying Use the `--generate-dir` option to generate a directory that can be deployed to Fly rather than deploying directly: datasette publish fly my-database.db \ --app="my-generated-app" \ --generate-dir /tmp/deploy-this You can then manually deploy your generated application using the following: cd /tmp/deploy-this flyctl apps create my-generated-app flyctl deploy ## datasette publish fly --help <!-- [[[cog import cog from datasette import cli from click.testing import CliRunner runner = CliRunner() result = runner.invoke(cli.cli, ["publish", "fly", "--help"]) help = result.output.replace("Usage: cli", "Usage: datasette") cog.out( "```\n{}```".format(help) ) ]]] --> ``` Usage: datasette publish fly [OPTIONS] [FILES]... Deploy an application to Fly that runs Datasette against the provided database files. Usage example: datasette publish fly my-database.db --app="my-data-app" Full documentation: https://datasette.io/plugins/datasette-publish-fly Options: -m, --metadata FILENAME Path to JSON/YAML file containing metadata to publish --extra-options TEXT Extra options to pass to datasette serve --branch TEXT Install datasette from a GitHub branch e.g. main --template-dir DIRECTORY Path to directory containing custom templates --plugins-dir DIRECTORY Path to directory containing custom plugins --static MOUNT:DIRECTORY Serve static files from this directory at /MOUNT/... --install TEXT Additional packages (e.g. plugins) to install --plugin-secret <TEXT TEXT TEXT>... Secrets to pass to plugins, e.g. --plugin- secret datasette-auth-github client_id xxx --version-note TEXT Additional note to show on /-/versions --secret TEXT Secret used for signing secure values, such as signed cookies --title TEXT Title for metadata --license TEXT License label for metadata --license_url TEXT License URL for metadata --source TEXT Source label for metadata --source_url TEXT Source URL for metadata --about TEXT About label for metadata --about_url TEXT About URL for metadata --spatialite Enable SpatialLite extension --region TEXT Fly region to deploy to, e.g sjc - see https://fly.io/docs/reference/regions/ --create-volume INTEGER RANGE Create and attach volume of this size in GB [x>=1] --create-db TEXT Names of read-write database files to create --volume-name TEXT Volume name to use -a, --app TEXT Name of Fly app to deploy [required] -o, --org TEXT Name of Fly org to deploy to --generate-dir DIRECTORY Output generated application files and stop without deploying --show-files Output the generated Dockerfile, metadata.json and fly.toml --help Show this message and exit. ``` <!-- [[[end]]] --> ## Development To contribute to this tool, first checkout the code. Then create a new virtual environment: cd datasette-publish-fly python -m venv venv source venv/bin/activate Or if you are using `pipenv`: pipenv shell Now install the dependencies and test dependencies: pip install -e '.[test]' To run the tests: pytest ### Integration tests The tests in `tests/test_integration.py` make actual calls to Fly to deploy a test application. These tests are skipped by default. If you have `flyctl` installed and configured, you can run the integration tests like this: pytest --integration -s The `-s` option here ensures that output from the deploys will be visible to you - otherwise it can look like the tests have hung. The tests will create applications on Fly that start with the prefix `publish-fly-temp-` and then delete them at the end of the run. <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-publish-fly" class="anchor" aria-hidden="true" href="#user-content-datasette-publish-fly"><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-publish-fly</h1> <p dir="auto"><a href="https://pypi.org/project/datasette-publish-fly/" rel="nofollow"><img src="https://camo.githubusercontent.com/e734388aed6f472c37bdfa14e6ddace47ad6e959c87da3b6399a5313f3558110/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f6461746173657474652d7075626c6973682d666c792e737667" alt="PyPI" data-canonical-src="https://img.shields.io/pypi/v/datasette-publish-fly.svg" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-publish-fly/releases"><img src="https://camo.githubusercontent.com/35efe08178a809f72d27ab8954426873c2c94d698c5ebd81d7eb284b421aa967/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73696d6f6e772f6461746173657474652d7075626c6973682d666c793f696e636c7564655f70726572656c6561736573266c6162656c3d6368616e67656c6f67" alt="Changelog" data-canonical-src="https://img.shields.io/github/v/release/simonw/datasette-publish-fly?include_prereleases&amp;label=changelog" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-publish-fly/actions?query=workflow%3ATest"><img src="https://github.com/simonw/datasette-publish-fly/workflows/Test/badge.svg" alt="Tests" style="max-width: 100%;"></a> <a href="https://github.com/simonw/datasette-publish-fly/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"><a href="https://datasette.io/" rel="nofollow">Datasette</a> plugin for deploying Datasette instances to <a href="https://fly.io/" rel="nofollow">Fly.io</a>.</p> <p dir="auto">Project background: <a href="https://simonwillison.net/2022/Feb/15/fly-volumes/" rel="nofollow">Using SQLite and Datasette with Fly Volumes</a></p> <h2 dir="auto"><a id="user-content-installation" class="anchor" aria-hidden="true" href="#user-content-installation"><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-publish-fly"><pre class="notranslate"><code>$ datasette install datasette-publish-fly </code></pre></div> <h2 dir="auto"><a id="user-content-deploying-read-only-data" class="anchor" aria-hidden="true" href="#user-content-deploying-read-only-data"><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>Deploying read-only data</h2> <p dir="auto">First, install the <code>flyctl</code> command-line tool by <a href="https://fly.io/docs/getting-started/installing-flyctl/" rel="nofollow">following their instructions</a>.</p> <p dir="auto">Run <code>flyctl auth signup</code> to create an account there, or <code>flyctl auth login</code> if you already have one.</p> <p dir="auto">You can now use <code>datasette publish fly</code> to publish one or more SQLite database files:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="datasette publish fly my-database.db --app=&quot;my-data-app&quot;"><pre class="notranslate"><code>datasette publish fly my-database.db --app="my-data-app" </code></pre></div> <p dir="auto">The argument you pass to <code>--app</code> will be used for the URL of your application: <code>my-data-app.fly.dev</code>.</p> <p dir="auto">To update an application, run the publish command passing the same application name to the <code>--app</code> option.</p> <p dir="auto">Fly have <a href="https://fly.io/docs/about/pricing/#free-allowances" rel="nofollow">a free tier</a>, beyond which they will charge you monthly for each application you have live. Details of their pricing can be <a href="https://fly.io/docs/pricing/" rel="nofollow">found on their site</a>.</p> <p dir="auto">Your application will be deployed at <code>https://your-app-name.fly.io/</code> - be aware that it may take several minutes to start working the first time you deploy it.</p> <h2 dir="auto"><a id="user-content-using-fly-volumes-for-writable-databases" class="anchor" aria-hidden="true" href="#user-content-using-fly-volumes-for-writable-databases"><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>Using Fly volumes for writable databases</h2> <p dir="auto">Fly <a href="https://fly.io/docs/reference/volumes/" rel="nofollow">Volumes</a> provide persistant disk storage for Fly applications. Volumes can be 1GB or more in size and the Fly free tier includes 3GB of volume space.</p> <p dir="auto">Datasette plugins such as <a href="https://datasette.io/plugins/datasette-upload-csvs" rel="nofollow">datasette-uploads-csvs</a> and <a href="https://datasette.io/plugins/datasette-tiddlywiki" rel="nofollow">datasette-tiddlywiki</a> can be deployed to Fly and store their mutable data in a volume.</p> <blockquote> <p dir="auto"><g-emoji class="g-emoji" alias="warning" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/26a0.png">⚠️</g-emoji> <strong>You should only run a single instance of your application</strong> if your database accepts writes. Fly has excellent support for running multiple instances in different geographical regions, but <code>datasette-publish-fly</code> with volumes is not yet compatible with that model. You should probably <a href="https://fly.io/blog/globally-distributed-postgres/" rel="nofollow">use Fly PostgreSQL instead</a>.</p> </blockquote> <p dir="auto">Here's how to deploy <code>datasette-tiddlywiki</code> with authentication provided by <code>datasette-auth-passwords</code>.</p> <p dir="auto">First, you'll need to create a root password hash to use to sign into the instance.</p> <p dir="auto">You can do that by installing the plugin and running the <code>datasette hash-password</code> command, or by using <a href="https://datasette-auth-passwords-demo.datasette.io/-/password-tool" rel="nofollow">this hosted tool</a>.</p> <p dir="auto">The hash should look like <code>pbkdf2_sha256$...</code> - you'll need this for the next step.</p> <p dir="auto">In this example we're also deploying a read-only database called <code>content.db</code>.</p> <p dir="auto">Pick a name for your new application, then run the following:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="datasette publish fly \ content.db \ --app your-application-name \ --create-volume 1 \ --create-db tiddlywiki \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...'"><pre class="notranslate"><code>datasette publish fly \ content.db \ --app your-application-name \ --create-volume 1 \ --create-db tiddlywiki \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' </code></pre></div> <p dir="auto">This will create the new application, deploy the <code>content.db</code> read-only database, create a 1GB volume for that application, create a new database in that volume called <code>tiddlywiki.db</code>, then install the two plugins and configure the password you specified.</p> <h3 dir="auto"><a id="user-content-updating-applications-that-use-a-volume" class="anchor" aria-hidden="true" href="#user-content-updating-applications-that-use-a-volume"><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>Updating applications that use a volume</h3> <p dir="auto">Once you have deployed an application using a volume, you can update that application without needing the <code>--create-volume</code> or <code>--create-db</code> options. To add the <a href="https://datasette.io/plugins/datasette-graphql" rel="nofollow">datasette-graphq</a> plugin to your deployed application you would run the following:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="datasette publish fly \ content.db \ --app your-application-name \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --install datasette-graphql \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' \"><pre class="notranslate"><code>datasette publish fly \ content.db \ --app your-application-name \ --install datasette-auth-passwords \ --install datasette-tiddlywiki \ --install datasette-graphql \ --plugin-secret datasette-auth-passwords root_password_hash 'pbkdf2_sha256$...' \ </code></pre></div> <p dir="auto">Since the application name is the same you don't need the <code>--create-volume</code> or <code>--create-db</code> options - these are persisted automatically between deploys.</p> <p dir="auto">You do need to specify the full list of plugins that you want to have installed, and any plugin secrets.</p> <p dir="auto">You also need to include any read-only database files that are part of the instance - <code>content.db</code> in this example - otherwise the new deployment will not include them.</p> <h3 dir="auto"><a id="user-content-advanced-volume-usage" class="anchor" aria-hidden="true" href="#user-content-advanced-volume-usage"><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>Advanced volume usage</h3> <p dir="auto"><code>datasette publish fly</code> will add a volume called <code>datasette</code> to your Fly application. You can customize the name using the <code>--volume name custom_name</code> option.</p> <p dir="auto">Fly can be used to scale applications to run multiple instances in multiple regions around the world. This works well with read-only Datasette but is not currently recommended using Datasette with volumes, since each Fly replica would need its own volume and data stored in one instance would not be visible in others.</p> <p dir="auto">If you want to use multiple instances with volumes you will need to switch to using the <code>flyctl</code> command directly. The <code>--generate-dir</code> option, described below, can help with this.</p> <h2 dir="auto"><a id="user-content-generating-without-deploying" class="anchor" aria-hidden="true" href="#user-content-generating-without-deploying"><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>Generating without deploying</h2> <p dir="auto">Use the <code>--generate-dir</code> option to generate a directory that can be deployed to Fly rather than deploying directly:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="datasette publish fly my-database.db \ --app=&quot;my-generated-app&quot; \ --generate-dir /tmp/deploy-this"><pre class="notranslate"><code>datasette publish fly my-database.db \ --app="my-generated-app" \ --generate-dir /tmp/deploy-this </code></pre></div> <p dir="auto">You can then manually deploy your generated application using the following:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cd /tmp/deploy-this flyctl apps create my-generated-app flyctl deploy"><pre class="notranslate"><code>cd /tmp/deploy-this flyctl apps create my-generated-app flyctl deploy </code></pre></div> <h2 dir="auto"><a id="user-content-datasette-publish-fly---help" class="anchor" aria-hidden="true" href="#user-content-datasette-publish-fly---help"><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 publish fly --help</h2> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Usage: datasette publish fly [OPTIONS] [FILES]... Deploy an application to Fly that runs Datasette against the provided database files. Usage example: datasette publish fly my-database.db --app=&quot;my-data-app&quot; Full documentation: https://datasette.io/plugins/datasette-publish-fly Options: -m, --metadata FILENAME Path to JSON/YAML file containing metadata to publish --extra-options TEXT Extra options to pass to datasette serve --branch TEXT Install datasette from a GitHub branch e.g. main --template-dir DIRECTORY Path to directory containing custom templates --plugins-dir DIRECTORY Path to directory containing custom plugins --static MOUNT:DIRECTORY Serve static files from this directory at /MOUNT/... --install TEXT Additional packages (e.g. plugins) to install --plugin-secret &lt;TEXT TEXT TEXT&gt;... Secrets to pass to plugins, e.g. --plugin- secret datasette-auth-github client_id xxx --version-note TEXT Additional note to show on /-/versions --secret TEXT Secret used for signing secure values, such as signed cookies --title TEXT Title for metadata --license TEXT License label for metadata --license_url TEXT License URL for metadata --source TEXT Source label for metadata --source_url TEXT Source URL for metadata --about TEXT About label for metadata --about_url TEXT About URL for metadata --spatialite Enable SpatialLite extension --region TEXT Fly region to deploy to, e.g sjc - see https://fly.io/docs/reference/regions/ --create-volume INTEGER RANGE Create and attach volume of this size in GB [x&gt;=1] --create-db TEXT Names of read-write database files to create --volume-name TEXT Volume name to use -a, --app TEXT Name of Fly app to deploy [required] -o, --org TEXT Name of Fly org to deploy to --generate-dir DIRECTORY Output generated application files and stop without deploying --show-files Output the generated Dockerfile, metadata.json and fly.toml --help Show this message and exit."><pre class="notranslate"><code>Usage: datasette publish fly [OPTIONS] [FILES]... Deploy an application to Fly that runs Datasette against the provided database files. Usage example: datasette publish fly my-database.db --app="my-data-app" Full documentation: https://datasette.io/plugins/datasette-publish-fly Options: -m, --metadata FILENAME Path to JSON/YAML file containing metadata to publish --extra-options TEXT Extra options to pass to datasette serve --branch TEXT Install datasette from a GitHub branch e.g. main --template-dir DIRECTORY Path to directory containing custom templates --plugins-dir DIRECTORY Path to directory containing custom plugins --static MOUNT:DIRECTORY Serve static files from this directory at /MOUNT/... --install TEXT Additional packages (e.g. plugins) to install --plugin-secret &lt;TEXT TEXT TEXT&gt;... Secrets to pass to plugins, e.g. --plugin- secret datasette-auth-github client_id xxx --version-note TEXT Additional note to show on /-/versions --secret TEXT Secret used for signing secure values, such as signed cookies --title TEXT Title for metadata --license TEXT License label for metadata --license_url TEXT License URL for metadata --source TEXT Source label for metadata --source_url TEXT Source URL for metadata --about TEXT About label for metadata --about_url TEXT About URL for metadata --spatialite Enable SpatialLite extension --region TEXT Fly region to deploy to, e.g sjc - see https://fly.io/docs/reference/regions/ --create-volume INTEGER RANGE Create and attach volume of this size in GB [x&gt;=1] --create-db TEXT Names of read-write database files to create --volume-name TEXT Volume name to use -a, --app TEXT Name of Fly app to deploy [required] -o, --org TEXT Name of Fly org to deploy to --generate-dir DIRECTORY Output generated application files and stop without deploying --show-files Output the generated Dockerfile, metadata.json and fly.toml --help Show this message and exit. </code></pre></div> <h2 dir="auto"><a id="user-content-development" class="anchor" aria-hidden="true" href="#user-content-development"><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 contribute to this tool, 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-publish-fly python -m venv venv source venv/bin/activate"><pre class="notranslate"><code>cd datasette-publish-fly python -m venv venv source venv/bin/activate </code></pre></div> <p dir="auto">Or if you are using <code>pipenv</code>:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pipenv shell"><pre class="notranslate"><code>pipenv shell </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> <h3 dir="auto"><a id="user-content-integration-tests" class="anchor" aria-hidden="true" href="#user-content-integration-tests"><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>Integration tests</h3> <p dir="auto">The tests in <code>tests/test_integration.py</code> make actual calls to Fly to deploy a test application.</p> <p dir="auto">These tests are skipped by default. If you have <code>flyctl</code> installed and configured, you can run the integration tests like this:</p> <div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pytest --integration -s"><pre class="notranslate"><code>pytest --integration -s </code></pre></div> <p dir="auto">The <code>-s</code> option here ensures that output from the deploys will be visible to you - otherwise it can look like the tests have hung.</p> <p dir="auto">The tests will create applications on Fly that start with the prefix <code>publish-fly-temp-</code> and then delete them at the end of the run.</p> </article></div> 1 public 0   0  

Links from other tables

  • 8 rows from repo in releases
Powered by Datasette · Queries took 3.682ms