diff --git a/.env.test b/.env.test new file mode 100644 index 00000000..a8c805e0 --- /dev/null +++ b/.env.test @@ -0,0 +1 @@ +DATABASE_URL=:memory: diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml new file mode 100644 index 00000000..36b4abec --- /dev/null +++ b/.github/actions/install-dependencies/action.yml @@ -0,0 +1,15 @@ +name: Install dependencies + +description: Install dependencies + +runs: + using: "composite" + steps: + - uses: oven-sh/setup-bun@v2 + name: Install Bun + with: + bun-version: "1.3.5" + + - name: Install dependencies + shell: bash + run: bun install --frozen-lockfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acb4c335..1d7d4d7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ name: Checks permissions: contents: read - security-events: write on: pull_request: @@ -21,15 +20,18 @@ jobs: uses: actions/checkout@v5 with: fetch-depth: 0 - ref: ${{ github.ref }} - - name: Scan current project - id: scan - uses: anchore/scan-action@v7 - with: - path: "." + - name: Install dependencies + uses: "./.github/actions/install-dependencies" - - name: upload Anchore scan SARIF report - uses: github/codeql-action/upload-sarif@v4 - with: - sarif_file: ${{ steps.scan.outputs.sarif }} + - name: Run type checks + shell: bash + run: bun run tsc + + - name: Run tests + shell: bash + run: bun run test --ci --coverage + + - name: Build project + shell: bash + run: bun run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 946ad8ef..1d7f7158 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: - "v*.*.*-alpha.*" permissions: - contents: read + contents: write packages: write security-events: write diff --git a/AGENTS.md b/AGENTS.md index 6ba3fcd9..92f7ff18 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,6 +36,16 @@ This is a unified application with the following structure: bun run tsc ``` +### Testing + +```bash +# Run all tests +bun run test + +# Run a specific test file +bunx dotenv-cli -e .env.test -- bun test --preload ./app/test/setup.ts path/to/test.ts +``` + ### Building ```bash diff --git a/README.md b/README.md index e07807d0..ae261fbb 100644 --- a/README.md +++ b/README.md @@ -447,6 +447,9 @@ services: - ./zerobyte.config.json:/app/zerobyte.config.json:ro # Mount your config file ``` +> [!WARNING] +> It is highly discouraged to run Zerobyte on a server that is accessible from the internet (VPS or home server with port forwarding) If you do, make sure to change the port mapping to "127.0.0.1:4096:4096" and use a secure tunnel (SSH tunnel, Cloudflare Tunnel, etc.) with authentication. + > [!WARNING] > Do not try to point `/var/lib/zerobyte` on a network share. You will face permission issues and strong performance degradation. @@ -486,6 +489,10 @@ services: If you need remote mount capabilities, keep the original configuration with `cap_add: SYS_ADMIN` and `devices: /dev/fuse:/dev/fuse`. +## Examples + +See [examples/README.md](examples/README.md) for runnable, copy/paste-friendly examples. + ## Adding your first volume Zerobyte supports multiple volume backends including NFS, SMB, WebDAV, and local directories. A volume represents the source data you want to back up and monitor. @@ -546,22 +553,27 @@ Zerobyte can use [rclone](https://rclone.org/) to support 40+ cloud storage prov **Setup instructions:** 1. **Install rclone on your host system** (if not already installed): + ```bash curl https://rclone.org/install.sh | sudo bash ``` 2. **Configure your cloud storage remote** using rclone's interactive config: + ```bash rclone config ``` + Follow the prompts to set up your cloud storage provider. For OAuth providers (Google Drive, Dropbox, etc.), rclone will guide you through the authentication flow. 3. **Verify your remote is configured**: + ```bash rclone listremotes ``` 4. **Mount the rclone config into the Zerobyte container** by updating your `docker-compose.yml`: + ```diff services: zerobyte: @@ -583,6 +595,7 @@ Zerobyte can use [rclone](https://rclone.org/) to support 40+ cloud storage prov ``` 5. **Restart the Zerobyte container**: + ```bash docker compose down docker compose up -d @@ -600,6 +613,7 @@ For a complete list of supported providers, see the [rclone documentation](https Once you have added a volume and created a repository, you can create your first backup job. A backup job defines the schedule and parameters for backing up a specific volume to a designated repository. When creating a backup job, you can specify the following settings: + - **Schedule**: Define how often the backup should run (e.g., daily, weekly) - **Retention Policy**: Set rules for how long backups should be retained (e.g., keep daily backups for 7 days, weekly backups for 4 weeks) - **Paths**: Specify which files or directories to include in the backup diff --git a/app/client/modules/backups/components/create-schedule-form.tsx b/app/client/modules/backups/components/create-schedule-form.tsx index 8f6de25c..2cf62e15 100644 --- a/app/client/modules/backups/components/create-schedule-form.tsx +++ b/app/client/modules/backups/components/create-schedule-form.tsx @@ -318,7 +318,7 @@ export const CreateScheduleForm = ({ initialValues, formId, onSubmit, volume }: onSelectionChange={handleSelectionChange} withCheckboxes={true} foldersOnly={false} - className="flex-1 border rounded-md bg-card p-2 min-h-[300px] max-h-[400px] overflow-auto" + className="flex-1 border rounded-md bg-card p-2 min-h-75 max-h-100 overflow-auto" /> {selectedPaths.size > 0 && (
@@ -342,7 +342,7 @@ export const CreateScheduleForm = ({ initialValues, formId, onSubmit, volume }: