DigitalOcean Storage Problem

Hello.

I’m using October CMS v3.3.17. Several content types defined via Tailor blueprints.
Now I want to use DigitalOcean Spaces bucket to store the images, sounds and other media.

This is what I’ve done so far:

Installed the required package:

sail composer require league/flysystem-aws-s3-v3 "^3.0"

Added the driver to the filesystems.php with:

    'disks' => [

       //......

        /* DigitalOcean storage */
        'do_spaces' => [
            'driver'   => 's3',
            'key' => env('SPACES_ACCESS_KEY_ID'),
            'secret' => env('SPACES_SECRET_ACCESS_KEY'),
            'region' => env('SPACES_DEFAULT_REGION'),
            'bucket' => env('SPACES_BUCKET'),
            'endpoint' => env('SPACES_ENDPOINT'),
            'visibility' => 'public', // Update: this is necessary to make your uploads read-only for anyone
        ],

    ],

The environment parameters are in the .env file:


#DigitalOcean storage parameters

SPACES_ACCESS_KEY_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

SPACES_SECRET_ACCESS_KEY=yyyyyyyyyyyyyyyyyyyyy

SPACES_DEFAULT_REGION=nyc3

SPACES_BUCKET=mybucket

SPACES_ENDPOINT=https://mybucket.nyc3.digitaloceanspaces.com

Updated the configuration in cms.php:

'storage' => [

        // ...
        
        //Use DigitalOcean driver (as defined in filesystems.php) for media manager
        'media' => [
            'disk'   => 'do_spaces',
            'folder' => '',
            'path'   => env('SPACES_ENDPOINT'),
        ],
    ],

Clear caches with:


sail artisan optimize:clear

The problem: Media manager still using local storage. I see no changes.

What else is needed to make this work?

Best regards.

It seems that the storage configuration in cms.php is now deprecated. I couldn’t find any references in the documentation.

So, I ended up defining the disks in filesystems.php only:

/* DigitalOcean storage */
        'uploads' => [
            'driver'   => 's3',
            'key' => env('SPACES_ACCESS_KEY_ID'),
            'secret' => env('SPACES_SECRET_ACCESS_KEY'),
            'region' => env('SPACES_DEFAULT_REGION'),
            'bucket' => env('SPACES_BUCKET'),
            'endpoint' => env('SPACES_ENDPOINT'),
            'url' => env('SPACES_URL'),
            'visibility' => 'public', // Update: this is necessary to make your uploads read-only for anyone
        ],
        /* DigitalOcean storage */
        'media' => [
            'driver'   => 's3',
            'key' => env('SPACES_ACCESS_KEY_ID'),
            'secret' => env('SPACES_SECRET_ACCESS_KEY'),
            'region' => env('SPACES_DEFAULT_REGION'),
            'bucket' => env('SPACES_BUCKET'),
            'endpoint' => env('SPACES_ENDPOINT'),
            'url' => env('SPACES_URL'),
            'visibility' => 'public', // Update: this is necessary to make your uploads read-only for anyone
        ],

Objects storage is working fine now.

1 Like

There is a note about the storage disk changes in the release notes: Release Note 32: October CMS 3.1 - Stable Release - October CMS

It has an example that is similar to the one above.

1 Like