{"id":13930139,"url":"https://github.com/jersobh/zfs-resty","last_synced_at":"2025-06-28T09:36:23.275Z","repository":{"id":40354673,"uuid":"155728041","full_name":"jersobh/zfs-resty","owner":"jersobh","description":"Rest API for zfspool ","archived":false,"fork":false,"pushed_at":"2025-04-22T08:40:10.000Z","size":188,"stargazers_count":19,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-09T07:09:15.580Z","etag":null,"topics":["filesystem","python","rest-api","zfs","zfspool","zfssa"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jersobh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-01T14:31:10.000Z","updated_at":"2025-03-06T04:18:58.000Z","dependencies_parsed_at":"2024-02-07T14:58:47.908Z","dependency_job_id":"70f41ae0-7044-4f55-a84b-9977dc8c7a3f","html_url":"https://github.com/jersobh/zfs-resty","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jersobh/zfs-resty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jersobh%2Fzfs-resty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jersobh%2Fzfs-resty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jersobh%2Fzfs-resty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jersobh%2Fzfs-resty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jersobh","download_url":"https://codeload.github.com/jersobh/zfs-resty/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jersobh%2Fzfs-resty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262406946,"owners_count":23306285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesystem","python","rest-api","zfs","zfspool","zfssa"],"created_at":"2024-08-07T18:04:49.665Z","updated_at":"2025-06-28T09:36:23.270Z","avatar_url":"https://github.com/jersobh.png","language":"Python","funding_links":[],"categories":["rest-api"],"sub_categories":[],"readme":"# ZFS-Resty\n\n![ZFS Resty Logo](https://raw.githubusercontent.com/jersobh/zfs-resty/master/logo.png \"Logo\")\n\n## Disclaimer\n\nThis software is provided \"as is,\" without any warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.\n\n### Usage and Responsibility:\nThe user assumes full responsibility for the usage of this software and the potential risks it may pose to their systems or data.\nThis software interacts with ZFS, a powerful filesystem, and misconfiguration or misuse may lead to data loss or system instability.\n\n\n### Recommendations:\nIt is strongly recommended to test this software in a controlled, non-production environment before deploying it to critical systems.\nRegular backups should be made to mitigate potential risks associated with using this software.\nBy using this software, you agree to these terms and absolve the authors and contributors of any liability.\n\n## Overview\nZFS-Resty is a RESTful API for managing ZFS pools and devices. The application provides endpoints for authentication, creating pools, managing disks, and retrieving ZFS status information.\n\n**Note**: This application requires **root privileges** for certain operations, such as managing ZFS pools.\n\n---\n\n## Table of Contents\n- [Endpoints](#endpoints)\n- [Authentication](#authentication)\n- [Arguments](#arguments)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Examples](#examples)\n- [License](#license)\n\n---\n\n## Endpoints\n\n### **Authentication**\nAuthenticate and retrieve a JWT token for subsequent requests.\n\n- **Endpoint**: `/auth`\n- **Method**: `POST`\n- **Parameters**:\n  - `username` (string): System username\n  - `password` (string): User password\n\n---\n\n### **Pool Management**\n\n#### Create a ZFS Pool\n- **Endpoint**: `/create-pool`\n- **Method**: `POST`\n- **Parameters**:\n  - `name` (string): Pool name\n  - `raid` (string, optional): RAID type\n  - `devices` (list): Device paths (e.g., `/dev/sda`)\n\n#### Delete a Pool\n- **Endpoint**: `/delete-pool`\n- **Method**: `POST`\n- **Parameters**:\n  - `name` (string): Pool name\n\n#### Add Disk to Pool\n- **Endpoint**: `/add-disk`\n- **Method**: `POST`\n- **Parameters**:\n  - `pool` (string): Pool name\n  - `device` (string): Device path (e.g., `/dev/sdx`)\n\n#### Add Spare Disk\n- **Endpoint**: `/add-spare-disk`\n- **Method**: `POST`\n- **Parameters**:\n  - `pool` (string): Pool name\n  - `device` (string): Device path (e.g., `/dev/sdx`)\n\n#### Replace a Disk\n- **Endpoint**: `/replace-disk`\n- **Method**: `POST`\n- **Parameters**:\n  - `pool` (string): Pool name\n  - `old_device` (string): Path of the old device\n  - `new_device` (string): Path of the replacement device\n\n#### Set Mountpoint\n- **Endpoint**: `/mountpoint`\n- **Method**: `POST`\n- **Parameters**:\n  - `mountpoint` (string): Mountpoint path (e.g., `/mnt/pool`)\n  - `pool` (string): Pool name\n\n---\n\n### **Status and Information**\n\n#### Get Available Devices\n- **Endpoint**: `/devices`\n- **Method**: `GET`\n\n#### Get ZFS Pool Status\n- **Endpoint**: `/status`\n- **Method**: `GET`\n\n#### Get I/O Status\n- **Endpoint**: `/io-status`\n- **Method**: `GET`\n\n---\n\n## Authentication\nZFS-Resty uses JWT for authentication. To authenticate:\n1. Send a `POST` request to `/auth` with your system `username` and `password`.\n2. A token will be returned in the response.\n3. Include this token in the `Authorization` header of all subsequent requests:\n   ```\n   Authorization: \u003ctoken\u003e\n   ```\n\n---\n\n## Arguments\nThe application supports the following command-line arguments:\n\n- `-p`, `--port`: Set the HTTP port (default: `8089`).\n- `-s`, `--safe`: Restrict access to local network IPs (default: `false`).\n\n---\n\n## Installation\n\n### Using the Install Script\n1. Run the installation script:\n   ```bash\n   chmod +x install.sh\n   ./install.sh\n   ```\n\n### Manual Installation\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/jersobh/zfs-resty.git\n   cd zfs-resty\n   ```\n\n2. Install requirements:\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. Run the application:\n   ```bash\n   sudo python zfs-resty.py\n   ```\n\n---\n\n## Examples\n\n### Authenticate\nRequest:\n```bash\ncurl -X POST http://localhost:8089/auth -H \"Content-Type: application/json\" -d '{\"username\": \"admin\", \"password\": \"admin\"}'\n```\n\nResponse:\n```json\n{\n  \"token\": \"your-jwt-token\"\n}\n```\n\n### Create a Pool\nRequest:\n```bash\ncurl -X POST http://localhost:8089/create-pool -H \"Authorization: \u003ctoken\u003e\" -H \"Content-Type: application/json\" -d '{\"name\": \"mypool\", \"raid\": \"mirror\", \"devices\": [\"/dev/sda\", \"/dev/sdb\"]}'\n```\n\nResponse:\n```json\n{\n  \"success\": \"Pool 'mypool' created successfully\"\n}\n```\n\n---\n\n## License\nThis project is licensed under the MIT License.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjersobh%2Fzfs-resty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjersobh%2Fzfs-resty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjersobh%2Fzfs-resty/lists"}