百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

moodle-tool_objectfs

> 编程语言
开源

Moodle 的对象文件存储系统

100 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Moodle 的对象文件存储系统

moodle-tool_objectfs

A remote object storage file system for Moodle. Intended to provide a plug-in that can be installed and configured to work with any supported remote object storage solution.

  • moodle-tool_objectfs
    • Use cases
      • Offloading large and old files to save money
      • Sharing files across moodles to save disk
      • Sharing files across environments to save time
      • Sharing files with data washed environments
      • Serving files directly from object storage with signed URLs
    • GDPR
    • Branches
    • Installation
    • Compatible object stores
      • Amazon S3
      • Minio S3
      • Google GCS
      • Azure Blob Storage
      • DigitalOcean Spaces
      • Openstack Object Storage
    • Moodle configuration
      • General Settings
      • File Transfer settings
      • File System settings
      • Pre-Signed URLs Settings
      • Amazon S3 settings
      • Minio S3 settings
      • Azure Blob Storage settings
      • DigitalOcean Spaces settings
      • Openstack Object Storage settings
    • Integration testing
    • Applying core patches
      • Moodle 3.9:
      • Moodle 3.8:
      • Moodle 3.4 - 3.7:
      • Moodle 3.3 and Totara 12:
      • Moodle 3.2 and Totara 11:
      • Moodle 2.9 - 3.1 and Totara 2.9, 9 - 10:
      • Moodle 2.7 - 2.8 and Totara 2.7 - 2.8:
      • PHPUnit test compatibility
    • Contributing and support
    • Warm thanks
    • Crafted by Catalyst IT

Use cases

There are a number of different ways you can use this plugin. See Recommended use case settings for recommended settings for each one.

Offloading large and old files to save money

Disk can be expensive, so a simple use case is we simply want to move some of the largest and oldest files off local disk to somewhere cheaper. But we still want the convenience and performance of having the majority of files local, especially if you are hosting on-prem where the latency or bandwidth to the remote filesystem may not be great.

Sharing files across moodles to save disk

Many of our clients have multiple moodle instances, and there is much duplicated content across instances. By pointing multiple moodles at the same remote filesystem, and not allowing deletes, then large amounts of content can be de-duplicated.

Sharing files across environments to save time

Some of our clients' Moodles are truly massive. We also have multiple environments for various types of testing, and often have ad hoc environments created on demand. Not only do we not want to have to store duplicated files, but we also want refreshing data to new environments to be as fast as possible.

Using this plugin we can configure production to have full read write to the remote filesystem and store the vast bulk of content remotely. In this setup the latency and bandwidth isn't an issue as they are colocated. The local filedir on disk would only consist of small or fast churning files such as course backups. A refresh of the production data back to a staging environment can be much quicker now as we skip the sitedir clone completely and stage is simply configured with readonly access to the production filesystem. Any files it creates would only be written to its local filesystem which can then be discarded when next refreshed.

Sharing files with data washed environments

Often you want a sanitised version of the data for giving to developers or other 3rd parties to remove or obfuscate sensitive content. This plugin is designed to work in this scenario too where the 3rd party gets a 'cleaned' DB, and can still point to the production remote filesystem with readonly credentials. As they cannot query the filesystem directly and must know the content hash of any content in order to access a file, there is very low risk of them accessing sensitive content.

https://github.com/catalyst/moodle-local_datacleaner

Serving files directly from object storage with signed URLs

By default, when files are stored in remote object storage Moodle still proxies every file download through the web server: the file is fetched from the object store to the Moodle server and then streamed to the user. This is simple to set up but has significant downsides at scale:

  • Bandwidth costs double. Traffic flows from the object store to your web server and then again from your web server to the end user, doubling egress costs and network load.
  • Web server CPU and memory are consumed streaming large files. Video lectures, course backups, and large ZIP archives can tie up PHP workers for seconds at a time, reducing capacity for other requests.
  • Throughput is limited by your web tier. Peak concurrent downloads are capped by the number of available PHP workers rather than by the practically unlimited throughput of your object store.

Enabling Pre-Signed (signed) URLs changes this behaviour. When a user requests a file, Moodle generates a short-lived, cryptographically signed URL pointing directly at the object store and redirects the user's browser to it. The file is then downloaded directly between the user and the object store, bypassing the Moodle web server entirely.

Benefits include:

  • Reduced server load. Web server workers are freed immediately after issuing the redirect, so the same infrastructure can serve far more concurrent users.
  • Lower bandwidth costs. Egress from the object store goes directly to end users rather than being routed through your servers.
  • Better performance for large files. Users benefit from the high-throughput, geographically distributed infrastructure of the object store (or a CDN such as CloudFront placed in front of it).
  • CDN acceleration. When combined with a CDN such as Amazon CloudFront, signed URLs allow you to cache and deliver files from edge locations close to your users, dramatically reducing latency for globally distributed audiences.

The trade-off is that signed URLs expose a time-limited direct link to the object store. You control the exposure window via the Pre-Signed URL expiration time setting and can restrict which file types are eligible via the Pre-Signed URL whitelist, so sensitive file types can still be proxied through Moodle's access-control layer if required.

See Pre-Signed URLs Settings for configuration options.

GDPR

This plugin is GDPR compliant if you enable the deletion of remote objects.

Supported branches

Moodle version Totara version Branch PHP MySQL PostgreSQL
Moodle 4.4+ MOODLE_404_STABLE 8.1+ 8.0+ 13+
Moodle 4.2+ MOODLE_402_STABLE 8.0+ 8.0+ 13+
Moodle 3.10 - 4.1 MOODLE_310_STABLE 7.2+ 5.7+ 12+

Installation

  1. If not on Moodle 3.3, backport the file system API. See Backporting
  2. Setup your remote object storage. See Remote object storage setup
  3. Clone this repository into admin/tool/objectfs
  4. Install one of the required SDK libraries for the storage file system that you will be using
    1. AWS SDK: the SDK is already integrated into Moodle 4.4+
    2. Clone moodle-local_azureblobstorage into local/azureblobstorage for Azure Blob Storage, or
    3. Clone moodle-local_openstack into local/openstack for openstack(swift) storage
  5. Install the plugins through the moodle GUI.
  6. Configure the plugin. See Moodle configuration
  7. Place one of the following lines inside your Moodle config.php:
  • Amazon S3
php
$CFG->alternative_file_system_class = '\tool_objectfs\s3_file_system';
  • Azure Blob Storage
php
$CFG->alternative_file_system_class = '\tool_objectfs\azure_blob_storage_file_system';
  • DigitalOcean Spaces
php
$CFG->alternative_file_system_class = '\tool_objectfs\digitalocean_file_system';
  • Openstack Object Storage (swift)
php
$CFG->alternative_file_system_class = '\tool_objectfs\swift_file_system';

Compatible object stores

Note: Not all object stores listed below are tested/in-use directly by Catalyst and some rely on community contributions. If you require commercial support/help please contact us privately for details on our rates.

Amazon S3

Amazon S3 bucket setup

  • Create an Amazon S3 bucket.
  • The AWS Users access policy should mirror the policy listed below.
  • Replace 'bucketname' with the name of your S3 bucket.
  • If you intend to allow deletion of objects in S3, Add 's3:DeleteObject' to the actions below.
json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:ListBucket"],
      "Resource": ["arn:aws:s3:::bucketname"]
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject"
      ],
      "Resource": ["arn:aws:s3:::bucketname/*"]
    }
  ]
}

Configurable S3 Object Ownership

S3 Object Ownership is an Amazon S3 bucket-level setting that you can use to control ownership of objects uploaded to your bucket and to disable or enable access control lists (ACLs). By default, Object Ownership is set to the Bucket owner enforced setting and all ACLs are disabled. When ACLs are disabled, the bucket owner owns all the objects in the bucket and manages access to data exclusively using access management policies.

To provide control over S3 Object Ownership when storing files in an S3 bucket, users can now select from various ACL options. Previously, the default ACL was set to private, which could lead to access control limitations in certain configurations. This setting allows users to better manage permissions by choosing the most appropriate ACL option for their needs.

The available ACL options are:

  • private
  • public-read
  • public-read-write
  • authenticated-read
  • aws-exec-read
  • bucket-owner-read
  • bucket-owner-full-control

For more details on S3 Object Ownership and permissions, refer to:

  • Amazon S3 Object Ownership
  • [AWS PutObject API Documentation](https://docs.aws.amazon.com/AmazonS3/latest/API/

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPawsaws-s3azureazure-blob-storage

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言