Maximizing StorageRaya with Essential Practices

How can we help?
< All Topics
Print

Maximizing StorageRaya with Essential Practices

StorageRaya is CloudRaya’s S3 Object Storage service that can be used for a wide range of storage needs, from simple to advanced scenarios. This guide outlines effective practices for uploading files to StorageRaya, enhancing the storage and essential delivery of your valuable data.

Prerequisites

Prepare your environment:

  1. Set up StorageRaya: Deploy your StorageRaya instance.
    It is essential to note your StorageRaya credential so you can access the instance using an S3 client.

  2. Install an S3 client tool: Choose and install an S3 client tool, such as Cyberduck, s3cmd, or else, on your computer.
    This guide uses Cyberduck, but the steps are generally applicable to all S3 client tools.

Configuring Upload File Metadata

File metadata provides essential information about a file, including its type, validity, and descriptions. This data enables modern browsers to interpret and render files accurately. Common metadata attributes include filename, format, ownership, and timestamps.

To ensure seamless file delivery and enhanced functionality, configure the metadata for each uploaded file. This process involves defining the necessary metadata attributes and ensuring they are accurately associated with the respective files. By properly configuring file metadata, you can optimize file accessibility for users employing modern web browsers.

In the Cyberduck window, locate the file you want to modify and right-click on it, and choose the “Info” option.

A pop-up window will appear displaying detailed information about the file. 

Along the top menu bar, click on the “Metadata” tab.

In the bottom left corner, locate the “b” icon resembling a gear. Click on it.

A list of available metadata attributes will be displayed. Select the attribute you want to add.

Alternatively, you can specify custom metadata according to your preferences.

Enter the desired value for the selected metadata attribute. Once you’re satisfied with the changes, press ENTER.

Enabling File Caching

To improve loading times for media files like images, it is essential to enable caching when serving them from your Object Storage to your website. Caching enables the object to remain in the client’s browser cache before being revalidated with your Object Storage. To enhance resource speed, follow these instructions to apply caching:

Access the file’s metadata attributes and add a new Cache-Control attribute.

Enter max-age= in the Value field, followed by your desired caching duration. For instance, max-age=86400 sets the caching period to 24 hours. With the public declaration, all caching servers, including private ones, and client browsers can cache the resource. To save the changes, press ENTER.

Common Values:

  • public: Cache can be stored on the client side and shared among various users.
  • private: Cache should only be stored on the client side and must not be cached by proxies.
  • no-cache: Cache must always be accompanied by verification to the server before use.
  • max-age=<seconds>: Specifies how long a response can be cached, measured in seconds.

Controlling File Access with Permissions

Tailor file permissions to regulate how users engage with and utilize your object storage data based on your target audience.

On your file ‘Info‘, locate and click “Permissions” on the main navigation bar.

Manage your preferred access level and permissions here.

Although by default, CloudRaya has already provided default permissions as mentioned above.

Available Permission Levels

  • FULL_CONTROL: Grants read and write privileges to the file for any user with the public link.

  • READ: Grants read access to the file for all users with the public link.

  • WRITE: Grants write privileges to the file for all users with the public link.

Safeguarding Access with CORS

To safeguard access to your uploaded Object Storage files, implement Cross-Origin Resource Sharing (CORS) policies to define the origin addresses authorized to access specific files. Follow these steps to enable CORS:

Access the file’s metadata attributes and add a new custom header.

In the ‘Name‘ field, type Access-Control-Allow-Origin.

Double-click to edit the Value field, and type your authorized address or domain name. To save the changes, press ENTER.

While the Access-Control-Allow-Origin header is important for controlling access to resources via JavaScript on the client side, accessing a resource directly via a browser's address bar or a hyperlink may not be subject to CORS restrictions.

Configuring Browser Behavior for File Handling

By default, when you share files from CloudRaya Object Storage, browsers automatically download them. To display files instead of downloading them, enable the Content-Disposition header.

Access the file’s metadata attributes and add a new Content-Disposition attribute.

In the Value field, change the value from attachment to inline to enable file preview. To save the changes, press ENTER.

Understanding Content-Disposition Values

  • attachment: The default behavior, which instructs the browser to download the file.

  • inline: Allows the browser to display the file instead of downloading it. Users can still manually download the file if they choose.

This setting is particularly useful for media files like images, as it lets users view them without having to download them first.

Multiple Connections for File Transfers

Some S3 clients, such as Cyberduck, often come with built-in support for multi-connection functionality. This functionality becomes particularly beneficial when managing the transfer of sizable files, whether during downloading or uploading processes. It enables the splitting of a file transfer into multiple segments, allowing for simultaneous transfers and the subsequent assembly of the complete file upon completion.

To enable multiple connections in Cyberduck, go to the Preferences menu.

Within the Transfers tab and under the General subtab, select ‘Open Multiple Connections.

The maximum number of connections to open is limited with the control in the lower right of the Transfers window.

Conclusion

You’ve gained insights into essential set up, configuring metadata, enabling caching, managing permissions, implementing CORS, and optimizing file handling. For more tutorials on maximizing CloudRaya usage, please visit our Knowledge Base or our YouTube channel.

Table of Contents

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

Ready, Set, Cloud

Ready, Set, Cloud