Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
levkk committed Jan 6, 2025
1 parent 05ac1bf commit 25b383c
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: docs
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
working-directory: docs
- run: mkdocs gh-deploy --force
working-directory: docs
1 change: 1 addition & 0 deletions docs/docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pgdog.dev
96 changes: 96 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# pgDog

[pgDog](https://github.com/levkk/pgdog) is a PostgreSQL query router, pooler, proxy and load balancer written in Rust. Spiritual successor to
[pgcat](https://github.com/levkk/pgcat), pgDog comes with many similar features, better performance,
and introduces new features like plugins.

## Getting started

pgDog is easily compiled from source. Before proceeding, make sure you have the latest version of the Rust
programming language compiler, available from [rust-lang.org](https://rust-lang.org).

### Checkout the code

pgDog source code can be downloaded from [GitHub](https://github.com/levkk/pgdog):

```bash
git clone https://github.com/levkk/pgdog && \
cd pgdog
```

### Compile pgDog

pgDog should be compiled in release mode to make sure you get all performance benefits. You can do this with Cargo:

```bash
cargo build --release
```

### Configuration

pgDog is configured via two configuration files:

* `pgdog.toml` which contains general pooler settings and PostgreSQL server information
* `users.toml` which contains passwords for users allowed to connect to the pooler

The passwords are stored in a separate file to simplify deployments in environments where
secrets can be safely encrypted, like Kubernetes or AWS EC2.

Both files need to be placed in the current working directory (CWD) for pgDog to detect them. Alternatively,
you can pass the `--config` and `--secrets` arguments when starting the pooler.

#### Example `pgdog.toml`

Most pgDog configuration options have sensible defaults. This allows a basic primary-only configuration to be pretty short.

```toml
[general]
host = "0.0.0.0"
port = 6432

[databases]
default_pool_size = 10
pooler_mode = transaction

[databases.production.primary]
host = "127.0.0.1"
port = 5432
database_name = "postgres"
```

#### Example `users.toml`

This configuration file contains a mapping between databases, users and passwords. Users not specified in this file
won't be able to connect to the pooler.

```toml
[production.alice]
password = "hunter2"
```

### Launch the pooler

Starting the pooler can be done by executing the binary or with Cargo:


=== "Command"
```bash
cargo run --release
```

=== "Output"

```
🐕 pgDog 0.1.0
Loaded pgdog.toml
Loaded "pgdog_routing" plugin
Listening on 0.0.0.0:6432
New server connection [127.0.0.1:5432]
```

## Next steps

* [Features](features/index.md)
* [Architecture](architecture/index.md)
* [Configuration](configuration/index.md)

4 changes: 4 additions & 0 deletions docs/docs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
table {
table-layout: fixed !important;
display: table !important;
}
50 changes: 50 additions & 0 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
site_name: pgDog
repo_url: "https://github.com/levkk/pgdog"
site_url: "https://pgdog.dev"
extra_css:
- style.css
site_description: "pgDog - PostgreSQL query router, pooler, and proxy."
theme:
name: material
features:
- content.code.copy
palette:
# Palette toggle for automatic mode
- media: "(prefers-color-scheme)"
toggle:
icon: material/brightness-auto
name: Switch to light mode

# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: "white"
toggle:
icon: material/brightness-7
name: Switch to dark mode

# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: "black"
toggle:
icon: material/brightness-4
name: Switch to system preference
docs_dir: docs
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- footnotes
- admonition
- pymdownx.details
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
plugins:
- search
- awesome-pages
34 changes: 34 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
babel==2.16.0
bracex==2.5.post1
certifi==2024.8.30
charset-normalizer==3.4.0
click==8.1.7
colorama==0.4.6
ghp-import==2.1.0
idna==3.10
Jinja2==3.1.4
Markdown==3.7
MarkupSafe==3.0.1
mergedeep==1.3.4
mkdocs==1.6.1
mkdocs-awesome-pages-plugin==2.9.3
mkdocs-get-deps==0.2.0
mkdocs-material==9.5.41
mkdocs-material-extensions==1.3.1
mkdocs-terminal==4.6.0
natsort==8.4.0
packaging==24.1
paginate==0.5.7
pathspec==0.12.1
platformdirs==4.3.6
Pygments==2.18.0
pymdown-extensions==10.11.2
python-dateutil==2.9.0.post0
PyYAML==6.0.2
pyyaml_env_tag==0.1
regex==2024.9.11
requests==2.32.3
six==1.16.0
urllib3==2.2.3
watchdog==5.0.3
wcmatch==10.0

0 comments on commit 25b383c

Please sign in to comment.