{"id":24003418,"url":"https://github.com/r0wi-dev/workflow_ocr_backend","last_synced_at":"2026-05-16T00:10:24.599Z","repository":{"id":271441507,"uuid":"913466398","full_name":"R0Wi-DEV/workflow_ocr_backend","owner":"R0Wi-DEV","description":"Alternative backend for https://github.com/R0Wi-DEV/workflow_ocr","archived":false,"fork":false,"pushed_at":"2025-02-17T20:10:05.000Z","size":135,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T21:24:42.143Z","etag":null,"topics":["nextcloud","nextcloud-workflow-ocr","ocr","pdf-files"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/R0Wi-DEV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2025-01-07T18:32:08.000Z","updated_at":"2025-02-17T20:10:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"270a8295-620e-47f6-86ca-297f934796c3","html_url":"https://github.com/R0Wi-DEV/workflow_ocr_backend","commit_stats":null,"previous_names":["r0wi-dev/workflow_ocr_backend"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R0Wi-DEV%2Fworkflow_ocr_backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R0Wi-DEV%2Fworkflow_ocr_backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R0Wi-DEV%2Fworkflow_ocr_backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/R0Wi-DEV%2Fworkflow_ocr_backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/R0Wi-DEV","download_url":"https://codeload.github.com/R0Wi-DEV/workflow_ocr_backend/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240654028,"owners_count":19835853,"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":["nextcloud","nextcloud-workflow-ocr","ocr","pdf-files"],"created_at":"2025-01-08T01:38:20.993Z","updated_at":"2026-05-16T00:10:24.593Z","avatar_url":"https://github.com/R0Wi-DEV.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Workflow OCR Backend\n\n![Build Action](https://github.com/R0Wi-DEV/workflow_ocr_backend/actions/workflows/test.yml/badge.svg)\n\nThis is an alternative backend for the [workflow_ocr](https://github.com/R0Wi-DEV/workflow_ocr) Nextcloud App.\nIt's written in Python and provides a simple REST API for [ocrmypdf](https://ocrmypdf.readthedocs.io/en/latest/).\n\n- [Workflow OCR Backend](#workflow-ocr-backend)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [`docker-compose` Example](#docker-compose-example)\n  - [HaRP Support (Nextcloud 32+)](#harp-support-nextcloud-32)\n\n## Prerequisites\n\nThis app should be installed via Nextcloud [ExApp / AppApi](https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/AppAPIAndExternalApps.html).\nIt will take care of all the heavy lifting like installation, orchestration, configuration and authentication between Nextcloud and this backend implementation.\n\n1. Install [`docker`](https://docs.docker.com/engine/install/ubuntu/) on the host where the app should be installed.\n2. Install the [`AppApi`](https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/AppAPIAndExternalApps.html#installing-appapi) app. It will take care of the installation and orchestration of the backend as Docker Container.\n3. Setup a [Deploy Daemon](https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/AppAPIAndExternalApps.html#setup-deploy-daemon):\n   - **For Nextcloud 32+**: It's recommended to use [HaRP (AppAPI HaProxy Reversed Proxy)](https://github.com/nextcloud/HaRP) for better performance and simplified deployment.\n   - **For older versions**: Use the [Docker Socket Proxy](https://github.com/nextcloud/docker-socket-proxy#readme) to communicate with the docker daemon.\n\n## Installation\n\nThe easiest way to install this app is to use the [Nexcloud Appstore](https://apps.nextcloud.com/apps/workflow_ocr_backend). You can find more information about how to install ExApps [here](https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/AppAPIAndExternalApps.html#installing-exapps).\n\nAlternatively, use the folling [`occ`](https://docs.nextcloud.com/server/latest/admin_manual/occ_command.html) command to register the latest version of this app:\n\n```bash\nsudo -u www-data php occ app_api:app:register workflow_ocr_backend \\\n\t--info-xml https://raw.githubusercontent.com/R0Wi-DEV/workflow_ocr_backend/refs/heads/master/appinfo/info.xml\n```\n\nUse `sudo -u www-data php occ app_api --help` to get a full list of AppApi commands.\n\n## `docker-compose` Example\n\nIf you want to run both Nextcloud **and** this backend in Docker, you can use the following `docker-compose.yml` to start Nextcloud, a database and the docker-socket-proxy. \n\n**(1)** Create a new docker network first:\n\n```bash\ndocker network create nextcloud\n```\n\n**(2)** Then create a `docker-compose.yml` file with the following content:\n\n```yaml\nvolumes:\n  nextcloud:\n  db:\n\nnetworks:\n  nextcloud:\n    name: nextcloud\n    external: true\n\nservices:\n  db:\n    image: mariadb:10.6\n    restart: no\n    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW\n    volumes:\n      - db:/var/lib/mysql\n    environment:\n      - MYSQL_ROOT_PASSWORD=\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n      - MARIADB_ROOT_PASSWORD=nextcloud\n    networks:\n      - nextcloud\n\n  app:\n    image: nextcloud:\u003cversion\u003e\n    container_name: nextcloud-in-docker\n    restart: no\n    ports:\n      - 80:80\n    volumes:\n      - nextcloud:/var/www/html\n    environment:\n      - MYSQL_PASSWORD=\n      - MYSQL_DATABASE=nextcloud\n      - MYSQL_USER=nextcloud\n      - MYSQL_HOST=db\n      - PHP_MEMORY_LIMIT=1024M\n      - PHP_UPLOAD_LIMIT=1024M\n    networks:\n      - nextcloud\n\n  nextcloud-cron:\n    image: nextcloud:\u003cversion\u003e\n    container_name: nextcloud-in-docker-cron\n    restart: no\n    volumes:\n      - nextcloud:/var/www/html\n    entrypoint: /cron.sh\n    depends_on:\n      - app\n    networks:\n      - nextcloud\n    environment:\n      - PHP_MEMORY_LIMIT=1024M\n      - PHP_UPLOAD_LIMIT=1024M\n\n  # Proxy for Docker Socket\n  nextcloud-appapi-dsp:\n    image: ghcr.io/nextcloud/nextcloud-appapi-dsp:release\n    container_name: docker-socket-proxy\n    hostname: nextcloud-appapi-dsp\n    environment:\n      - NC_HAPROXY_PASSWORD=password\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock\n    restart: no\n    privileged: true\n    networks:\n      - nextcloud\n```\n\nAdjust the values for `\u003cversion\u003e` and `NC_HAPROXY_PASSWORD` to your needs, then start the stack with `docker-compose up -d`.\n\n**(3)** Before configuring the Deploy Daemon, make sure to add the Docker network DNS name (`nextcloud-in-docker`) of the Nextcloud container to the `trusted_domains` in `config/config.php`:\n\n```php\n\u003c?php\n$CONFIG = array (\n    // ...\n    'trusted_domains' =\u003e \n        array (\n          0 =\u003e 'localhost',\n          1 =\u003e 'nextcloud-in-docker'\n        )\n)\n```\n\nOtherwise, ExApps might not be able to connect back to your Nextcloud instance and fail with errors like this:\n\n```bash\n# Taken from \"docker logs \u003cnc-ex-app-container-id\u003e\nFile \"/home/serviceuser/.local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py\", line 2461, in run_sync_in_worker_thread\n    return await future\n           ^^^^^^^^^^^^\n  File \"/home/serviceuser/.local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py\", line 962, in run\n    result = context.run(func, *args)\n             ^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/serviceuser/.local/lib/python3.12/site-packages/nc_py_api/ex_app/integration_fastapi.py\", line 138, in fetch_models_task\n    nc.set_init_status(100)\n  File \"/home/serviceuser/.local/lib/python3.12/site-packages/nc_py_api/nextcloud.py\", line 431, in set_init_status\n    self._session.ocs(\n  File \"/home/serviceuser/.local/lib/python3.12/site-packages/nc_py_api/_session.py\", line 213, in ocs\n    check_error(response, info)\n  File \"/home/serviceuser/.local/lib/python3.12/site-packages/nc_py_api/_exceptions.py\", line 65, in check_error\n    raise NextcloudException(status_code, reason=codes(status_code).phrase, info=info)\nnc_py_api._exceptions.NextcloudException: [400] Bad Request \u003crequest: PUT /ocs/v1.php/apps/app_api/apps/status/workflow_ocr_backend\u003e\n\n```\n\n**(4)** The Deploy Daemon configuration for this setup would look like this:\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./doc/img/deploy-daemon.png\" width=\"30%\"/\u003e\n\u003c/p\u003e\n\n\u003e  :warning: Make sure to create the docker network `nextcloud` before starting the stack. If you don't declare the network as\n\u003e `external`, `docker-compose` will create the network with some [project/directory prefix](https://docs.docker.com/compose/how-tos/networking/), which will cause the Deploy Daemon to fail because it doesn't find the network.\n\n## HaRP Support (Nextcloud 32+)\n\nSince Nextcloud 32, [HaRP (AppAPI HaProxy Reversed Proxy)](https://github.com/nextcloud/HaRP) is the recommended deployment method for ExApps, replacing Docker Socket Proxy. This app now supports HaRP out of the box.\n\nHaRP simplifies deployment and improves performance by enabling direct communication between clients and ExApps. The implementation is fully backward compatible with Docker Socket Proxy deployments.\n\nFor installation and migration instructions, see the [HaRP documentation](https://github.com/nextcloud/HaRP#readme).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr0wi-dev%2Fworkflow_ocr_backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr0wi-dev%2Fworkflow_ocr_backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr0wi-dev%2Fworkflow_ocr_backend/lists"}