mgamadeus / ddd-clouddrive-server
The cloud drive service of mgamadeus/ddd: the drive's metadata in its own PostgreSQL database, bytes in its own bucket, the service API for ddd-clouddrive clients, malware scan, Office renditions, SVG sanitising, ingest and maintenance
Package info
github.com/ddd-framework/ddd-clouddrive-server
pkg:composer/mgamadeus/ddd-clouddrive-server
Requires
- php: >=8.3
- ext-pdo_pgsql: *
- ext-sodium: *
- async-aws/s3: ^2.0 || ^3.0
- enshrined/svg-sanitize: ^0.21 || ^1.1
- guzzlehttp/psr7: ^2.6
- maennchen/zipstream-php: ^3.1
- mgamadeus/ddd: ^3.53.2
- mgamadeus/ddd-clouddrive: ^0.11.3
- symfony/doctrine-messenger: 7.4.*
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
The drive service of mgamadeus/ddd: the cloud drive as a deployment of its own. It keeps the drive's metadata in its own PostgreSQL database and the bytes in its own S3-compatible bucket, scans uploads with clamd, renders Office files to PDF, sanitises SVG, runs ingest and maintenance, and serves the drive over HTTP to applications that install the client mgamadeus/ddd-clouddrive (0.11.3 or later).
- 101 routes (spaces, nodes and lists with natural sort and filters, versions, the trash over every space and single versions in the trash, content and ZIP downloads, uploads, bulk incl. copy, transfers, working copies, change feed, system API, status, probes, metrics): docs/api.md, machine-readable in docs/openapi.yaml.
- Access: every call carries the host's service credential (normal or read-only); JSON calls also carry a call context the host signs with Ed25519. Bytes always pass the host's backend: the service has no ingress, no public link and no CORS.
- Operations: environment, keys, roles of the image, probes, workers, schema, pooler, monitoring, commands, store probe, limits: docs/operations.md.
- Moving a 0.9 drive in: a host that ran the embedded drive (client 0.9) exports it,
app:drive:import-0.9writes it into the empty database in one transaction andapp:drive:import-objectscopies the bucket, sha256-checked: docs/operations.md › Import of a 0.9 drive. - Change feed epoch
<system identifier>.<timeline>.<restore generation>: a move to another cluster, a failover or point-in-time recovery, a restore in place (app:drive:feed:new-epoch) and an import each make the hosts' feeds start over (docs/api.md › 3.4).
Requirements
- PHP 8.3 with
ext-pdo_pgsql,ext-sodium, Imagick;mgamadeus/ddd3.53.2 or later (no warning floods in an image with a read-onlyvendor/),mgamadeus/ddd-clouddrive0.11.3 or later (its entity classes check the import origin of a write by its form only and carry the version trash,DriveFileVersion::$trashedAt) - PostgreSQL 15 or later, built with ICU (the service's own database; the database owner role is enough, no superuser; the primary, not a standby); a transaction pooler such as PgBouncer is supported
- an S3-compatible bucket for the service alone (
app:drive:store-probechecks it) - clamd beside the service (not in the image)
- for Office renditions: LibreOffice (in the image)
Running the image
The release of each version publishes ghcr.io/ddd-framework/ddd-clouddrive-server:<version> (nginx and php-fpm on
port 8080, LibreOffice; every answer names its version in X-App-Release). One image serves every role:
# web, one container (local run); in a cluster: the containers `php-fpm` and `nginx` of the same image in one pod docker run --env-file drive.env -p 8080:8080 ghcr.io/ddd-framework/ddd-clouddrive-server:<version> # before every rollout, with the NEW image: the schema (direct database host, database owner), dry run first docker run --env-file drive.env ghcr.io/ddd-framework/ddd-clouddrive-server:<version> \ php app/bin/console app:drive:schema:apply --dryRun docker run --env-file drive.env ghcr.io/ddd-framework/ddd-clouddrive-server:<version> \ php app/bin/console app:drive:schema:apply # workers (config/system/workers.yaml) and the maintenance loop docker run --env-file drive.env ghcr.io/ddd-framework/ddd-clouddrive-server:<version> \ php app/bin/console messenger:consume drive_ingest --no-debug --time-limit=3600 docker run --env-file drive.env ghcr.io/ddd-framework/ddd-clouddrive-server:<version> \ php app/bin/console app:drive:maintain
Upgrade order (binding): build the new image, run app:drive:schema:apply --dryRun and then
app:drive:schema:apply with the new image, and only then switch the deployments (web, workers, maintenance loop).
Never the other way round: from 0.2.0 the lists sort by the ICU collation drive_natural that the apply creates, and
until it exists every list answers 500; from 0.3.0 every version read and write uses the columns
DriveFileVersions.trashedAt / trashedByPrincipalKey that the apply adds. docs/operations.md › Rollout / Upgrade.
The variables of drive.env (database, bucket, credentials, context keys, token secret, clamd, trusted proxies) and
their formats are in docs/operations.md › Environment of the service and › Keys and credentials.
Probes: GET /healthz, GET /readyz; metrics: GET /metrics with a credential.
As a module
composer require mgamadeus/ddd-clouddrive-server registers the module (extra.ddd-module) in a kernel of your own;
the reference kernel in app/ shows what that kernel carries (module registration, the client-to-server class map in
config/services.yaml, excludedTables, the worker list, the Messenger transports). The skill below lists the steps.
Documentation
- docs/api.md and docs/openapi.yaml: the API
- docs/operations.md: the operations sheet
- .claude/skills/ddd-module-clouddrive-server-specialist/SKILL.md: installation, operation, extension, troubleshooting (agent skill)
- AGENTS.md: code map and rules for contributors
- CHANGELOG.md
The host side (credential and signing key, download modes, change feed, upgrade of a host from client 0.9) is documented in the client's README.
Contributing
A pull request sets no version: it leaves composer.json as it is and writes its changelog entry under
## Unreleased; the maintainer versions at release. Commit messages follow Conventional Commits. See
AGENTS.md.
License
MIT, see LICENSE.