Skip to content

Commit 768b0bb

Browse files
authored
Merge pull request #101 from supabase/docs
Docs
2 parents 90ff927 + 17428c9 commit 768b0bb

File tree

7 files changed

+128
-0
lines changed

7 files changed

+128
-0
lines changed

docs/assets/favicon.ico

14.7 KB
Binary file not shown.

docs/index.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# `dbdev`
2+
3+
<p>
4+
<a href=""><img src="https://img.shields.io/badge/postgresql-14+-blue.svg" alt="PostgreSQL version" height="18"></a>
5+
<a href="https://github.com/supabase/dbdev/blob/master/LICENSE"><img src="https://img.shields.io/pypi/l/markdown-subtemplate.svg" alt="License" height="18"></a>
6+
<a href="https://github.com/supabase/dbdev/actions/workflows/pgTAP.yaml"><img src="https://github.com/supabase/dbdev/actions/workflows/pgTAP.yaml/badge.svg" alt="pgTAP Tests" height="18"></a>
7+
<a href="https://github.com/supabase/dbdev/actions/workflows/cli.yaml"><img src="https://github.com/supabase/dbdev/actions/workflows/cli.yaml/badge.svg" alt="CLI" height="18"></a>
8+
9+
</p>
10+
11+
---
12+
13+
**Documentation**: <a href="https://supabase.github.io/dbdev" target="_blank">https://supabase.github.io/dbdev</a>
14+
15+
**Source Code**: <a href="https://github.com/supabase/dbdev" target="_blank">https://github.com/supabase/dbdev</a>
16+
17+
---
18+
19+
## Overview
20+
21+
dbdev is a package manager for Postgres [trusted lanuguage extensions](https://github.com/aws/pg_tle) (TLEs). It consists of:
22+
23+
- [database.dev](https://database.dev): our first-party package registry to store and distribute TLEs.
24+
- dbdev CLI: a CLI for publishing TLEs to a registry.
25+
- dbdev client: an in-database client for installing TLEs from registries.
26+
27+
If you want to publish your own TLE, you will need the dbdev CLI. Follow its [installation instructions](install.md) to get started.
28+
29+
If you want to install an extension from the registry, you will need the SQL dbdev client. Follow its [installation instructions](https://database.dev/installer) to enable it in your database.

docs/install.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
The dbdev CLI is required to publish your TLE to [database.dev](https://database.dev/).
2+
3+
## Installation
4+
5+
Binaries for dbdev CLI are available for Linux, Windows and macOS platforms. Visit the [dbdev releases page](https://github.com/supabase/dbdev/releases) to download a binary for your OS. The downloaded binary should be placed in a folder which is in your [PATH](https://en.wikipedia.org/wiki/PATH_(variable))
6+
7+
Alternatively, you can build the binary from source. You will need to have [Rust installed](https://www.rust-lang.org/tools/install) on your system. To build from source:
8+
9+
1. Clone the repo: ```git clone https://github.com/supabase/dbdev.git```.
10+
2. Change directory to `dbdev`: ```cd dbdev```.
11+
3. Build: ```cargo install --release```.
12+
4. Copy the `dbdev` binary in `target/release` to a folder in you PATH.
13+
14+
If you have [cargo-install](https://doc.rust-lang.org/cargo/commands/cargo-install.html), you can perform all the above steps with a single command: ```cargo install --git https://github.com/supabase/dbdev.git dbdev```.
15+
16+
17+
Now you're ready to [publish your first package](publish.md).

docs/publish.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Before you can publish your TLE, you need to authenticate with [database.dev](https://database.dev/).
2+
3+
### Login to database.dev
4+
5+
If you don't have an account, [sign-up for one](https://database.dev/sign-up) on the website. Then follow the steps below:
6+
7+
1. Make sure you are logged into the `database.dev` website.
8+
2. Navigate to the **Access Tokens** page from the account drop-down at top right.
9+
3. Click **New Token**.
10+
4. Enter a token name and click **Create Token**.
11+
5. Copy the generated token. Note that this is the only time the token will be shown.
12+
6. On the terminal, run the `dbdev login` command.
13+
7. Paste the token you copied.
14+
15+
You are now logged into `database.dev`.
16+
17+
### Publish TLE
18+
19+
To publish a TLE, run the `dbdev publish` command. For example, to publish a TLE in the `/all_tles/my_tle` folder run the following:
20+
21+
```
22+
dbdev publish --path /all_tles/my_tle
23+
```
24+
25+
Your TLE is now published to `database.dev` and visible at `https://database.dev/<handle>/<package_name>`. Users can install it using the [dbdev in-database client](https://database.dev/installer).

docs/requirements_docs.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
mkdocs
2+
mkdocs-material

mkdocs.yaml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
site_name: dbdev
2+
site_url: https://supabase.github.io/dbdev
3+
site_description: A package manager for PostgreSQL trusted language extensions
4+
5+
repo_name: supabase/dbdev
6+
repo_url: https://github.com/supabase/dbdev
7+
8+
nav:
9+
- Welcome: 'index.md'
10+
- Install CLI: 'install.md'
11+
- Publish a Package: 'publish.md'
12+
13+
theme:
14+
name: 'material'
15+
favicon: 'assets/favicon.ico'
16+
logo: 'assets/favicon.ico'
17+
homepage: https://supabase.github.io/dbdev
18+
features:
19+
- navigation.expand
20+
palette:
21+
primary: black
22+
accent: light green
23+
24+
markdown_extensions:
25+
- pymdownx.highlight:
26+
linenums: true
27+
guess_lang: false
28+
use_pygments: true
29+
pygments_style: default
30+
- pymdownx.superfences
31+
- pymdownx.tabbed:
32+
alternate_style: true
33+
- pymdownx.snippets
34+
- pymdownx.tasklist
35+
- admonition

website/pages/installer.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ create extension "supabase-dbdev";
5757
select dbdev.install('supabase-dbdev');
5858
drop extension if exists "supabase-dbdev";
5959
create extension "supabase-dbdev";
60+
\`\`\`
61+
62+
## Use
63+
64+
Once the client is installed, you an install a TLE available on [database.dev](https://database.dev/) by running SQL that looks like the following:
65+
66+
\`\`\`sql
67+
select dbdev.install(<extension_name>);
68+
create extension <extension_name>
69+
schema <schema>
70+
version <version>;
71+
\`\`\`
72+
73+
For example, to install [pg_headerkit](https://database.dev/burggraf/pg_headerkit) version \`1.0.0\` in schema \`public\` run:
74+
75+
\`\`\`sql
76+
select dbdev.install('burggraf-pg_headerkit');
77+
create extension "burggraf-pg_headerkit"
78+
schema 'public'
79+
version '1.0.0';
6080
\`\`\``}
6181
</Markdown>
6282
</div>

0 commit comments

Comments
 (0)