Wondering how to store the uploaded files inside Azure in a Drupal CMS? Take a peek at this blog.
Here at Bobcares, we have seen several such Azure-related queries as part of our Development Services for developers.
Today, we will take a look at how to store the uploaded files inside Azure in a Drupal CMS.
More about Microsoft Azure and Drupal
Microsoft Azure is one of the cloud-computing services Microsoft provides for building, testing, deploying, and managing applications and services through Microsoft-managed data centers. When hosting a customer-facing Drupal application in Azure, it is recommended to use one of their scalable Azure Storage services, such as Blobs, Asure Files, and so on rather than storing it in the same server.
In our Drupal Project, we created multiple instances of VPS nodes and databases to comply with Azure’s service level agreements (SLA). Since we cannot duplicate the user uploaded files in both hosts, we used Azure Storage, so that we can use the same set of files on different hosts and it would be updated.
How to store the uploaded files inside Azure in a Drupal CMS
One can also use Azure Files as an SMB mount storage for storing files. We set an SMB mount point on our VPS for storing the files with some insight from the aGov CMS case study. After verifying the permissions of the mount point ( read & write as apache user ), we then proceed with the integration task.
In order to integrate Azure Files with Drupal, we need to set the private file path to a location inside the File Share. Then change the upload buttons in the Webform Module to save the files to Private Storage.
For instance, if the Azure Files is mounted at /var/www/shared folder, we would set the private file path at /var/www/html/sites/default/settings.php as follows
$settings['file_private_path'] = '/var/www/shared/private';
After that, we clear the drupal cache, either from admin panel or via drush.
Visiting “/admin/config/media/file-system” in a browser would lead to a page similar to the following:
Here, we see the updated path under the Private file system path. Please note that here we have set the Default download method to ‘Private local files server by Drupal’.
Additionally, we need to change the File upload destination to ‘Private files’ in all the form upload elements, such as the one shown below for a Drupal Webform based file input element.
[Need any assistance with the Drupal queries? – Our experts can help you]
Conclusion
Today, we learned how to store the uploaded files inside Azure in a Drupal CMS.
0 Comments