Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

extensions/bak/README.md

Raw
Rendered preview
bak

bak

Keep Pi sessions available across machines through S3-compatible object storage.

Backups let you resume or retrieve session history after moving to another host without copying session files by hand.

Set up

Use a private bucket and credentials limited to that bucket's object read and write access.

Provide access credentials through environment variables, never settings files.

Set the endpoint there too, or configure its non-secret location in Pi settings.

PI_BAK_S3_ENDPOINT=https://<account>.eu.r2.cloudflarestorage.com
PI_BAK_S3_ACCESS_KEY_ID=...
PI_BAK_S3_SECRET_ACCESS_KEY=...

Start Pi, then assign this machine an alias:

/bak init laptop

bak remains disabled until its endpoint and credentials are present.

Install through Installation.

Use it in Pi

Automatic backup is on by default after setup.

Pi uploads the current session after completed work and keeps retryable uploads pending when a backup fails.

Use /bak backup to upload every locally discoverable session now.

On another configured machine, find a session with /bak search <name or path>, then restore a listed result with /bak restore <alias>/<session-id-prefix>.

Add a destination path to restore elsewhere: /bak restore <alias>/<session-id-prefix> /path/to/sessions.

/bak restore all [path] restores every session in a remote catalog.

Restore reports conflicting files instead of silently replacing them.

Use /bak status to check setup, pending uploads, and catalog state.

Set bak.autoBackup to false in trusted project or user Pi settings when you want manual backups only.

Reference

Commands

Command Purpose
/bak Back up and restore Pi sessions

Setting names

Setting Environment
bak.autoBackup PI_BAK_AUTO_BACKUP
bak.s3.bucket PI_BAK_S3_BUCKET
bak.s3.endpoint PI_BAK_S3_ENDPOINT
bak.s3.region PI_BAK_S3_REGION
<img src="assets/banner.svg" alt="bak" height="70">

# bak

Keep Pi sessions available across machines through S3-compatible object storage.

Backups let you resume or retrieve session history after moving to another host without copying session files by hand.

## Set up

Use a private bucket and credentials limited to that bucket's object read and write access.

Provide access credentials through environment variables, never settings files.

Set the endpoint there too, or configure its non-secret location in Pi settings.

```text
PI_BAK_S3_ENDPOINT=https://<account>.eu.r2.cloudflarestorage.com
PI_BAK_S3_ACCESS_KEY_ID=...
PI_BAK_S3_SECRET_ACCESS_KEY=...
```

Start Pi, then assign this machine an alias:

```text
/bak init laptop
```

`bak` remains disabled until its endpoint and credentials are present.

Install through [Installation](../../README.md#install).

## Use it in Pi

Automatic backup is on by default after setup.

Pi uploads the current session after completed work and keeps retryable uploads pending when a backup fails.

Use `/bak backup` to upload every locally discoverable session now.

On another configured machine, find a session with `/bak search <name or path>`, then restore a listed result with `/bak restore <alias>/<session-id-prefix>`.

Add a destination path to restore elsewhere: `/bak restore <alias>/<session-id-prefix> /path/to/sessions`.

`/bak restore all [path]` restores every session in a remote catalog.

Restore reports conflicting files instead of silently replacing them.

Use `/bak status` to check setup, pending uploads, and catalog state.

Set `bak.autoBackup` to `false` in trusted project or user Pi settings when you want manual backups only.

## Reference

<!-- config:start -->
### Commands

| Command | Purpose |
| --- | --- |
| `/bak` | Back up and restore Pi sessions |

### Setting names

| Setting | Environment |
| --- | --- |
| `bak.autoBackup` | `PI_BAK_AUTO_BACKUP` |
| `bak.s3.bucket` | `PI_BAK_S3_BUCKET` |
| `bak.s3.endpoint` | `PI_BAK_S3_ENDPOINT` |
| `bak.s3.region` | `PI_BAK_S3_REGION` |
<!-- config:end -->