You are here

README.txt in S3 File System 7.2

S3 File System (s3fs) provides an additional file system to your Drupal site,
alongside the public and private file systems, which stores files in Amazon's
Simple Storage Service (S3) (or any S3-compatible storage service). You can set
your site to use S3 File System as the default, or use it only for individual
fields. This functionality is designed for sites which are load-balanced across
multiple servers, as the mechanism used by Drupal's default file systems is not
viable under such a configuration.

=========================================
== Dependencies and Other Requirements ==
=========================================
- Libraries API 2.x - https://drupal.org/project/libraries
- AWS SDK for PHP 2.x - https://github.com/aws/aws-sdk-php/releases
- PHP 5.3.3+ is required. The AWS SDK will not work on earlier versions.
- Your PHP must be configured with "allow_url_fopen = On" in your php.ini file.
  Otherwise, PHP will be unable to open files that are in your S3 bucket.

==================
== Installation ==
==================
1) Install Libraries version 2.x from http://drupal.org/project/libraries.

2) Install the AWS SDK for PHP.
  a) If you have drush, you can install the SDK with this command (executed
    from the root folder of your Drupal codebase):
    drush make --no-core sites/all/modules/s3fs/s3fs.make
  b) If you don't have drush, download the SDK from here:
    https://github.com/aws/aws-sdk-php/releases/download/2.7.25/aws.zip
    Extract that zip file into your Drupal codebase's
    sites/all/libraries/awssdk2 folder such that the path to aws-autoloader.php
    is: sites/all/libraries/awssdk2/aws-autoloader.php

IN CASE OF TROUBLE DETECTING THE AWS SDK LIBRARY:
Ensure that the awssdk2 folder itself, and all the files within it, can be read
by your webserver. Usually this means that the user "apache" (or "_www" on OSX)
must have read permissions for the files, and read+execute permissions for all
the folders in the path leading to the awssdk2 files.

====================
== Initial Setup ==
====================
With the code installation complete, you must now configure s3fs to use your
Amazon Web Services credentials. To do so, store them in the $conf array in
your site's settings.php file (sites/default/settings.php), like so:
$conf['awssdk2_access_key'] = 'YOUR ACCESS KEY';
$conf['awssdk2_secret_key'] = 'YOUR SECRET KEY';

Configure your settings for S3 File System (including your S3 bucket name) at
/admin/config/media/s3fs/settings. You can input your AWS credentials on this
page as well, but using the $conf array is recommended.

You can also configure the rest of your S3 preferences in the $conf array. See
the "Configuring S3FS in settings.php" section below for more info.

===================== ESSENTIAL STEP! DO NOT SKIP THIS! ======================
With the settings saved, go to /admin/config/media/s3fs/actions to refresh the
file metadata cache. This will copy the filenames and attributes for every
existing file in your S3 bucket into Drupal's database. This can take a
significant amount of time for very large buckets (thousands of files). If this
operation times out, you can also perform it using "drush s3fs-refresh-cache".

Please keep in mind that any time the contents of your S3 bucket change without
Drupal knowing about it (like if you copy some files into it manually using
another tool), you'll need to refresh the metadata cache again. S3FS assumes
that its cache is a canonical listing of every file in the bucket. Thus, Drupal
will not be able to access any files you copied into your bucket manually until
S3FS's cache learns of them. This is true of folders as well; s3fs will not be
able to copy files into folders that it doesn't know about.

============================================
== How to Configure Your Site to Use s3fs ==
============================================
Visit the admin/config/media/file-system page and set the "Default download
method" to "Amazon Simple Storage Service"
-and/or-
Add a field of type File, Image, etc. and set the "Upload destination" to
"Amazon Simple Storage Service" in the "Field Settings" tab.

This will configure your site to store new uploaded files in S3. Files which
your site creates automatically (such as aggregated CSS) will still be stored
in the server's local filesystem, because Drupal is hard-coded to use the
public:// filesystem for such files.

However, s3fs can be configured to handle these files, as well. On the s3fs
configuration page (admin/config/media/s3fs) you can enable the "Use S3 for
public:// files" and/or "Use S3 for private:// files" options to make s3fs
take over the job of the public and/or private file systems. This will cause
your site to store newly uploaded/generated files from the public/private file
system in S3 instead of the local file system. However, it will make any
existing files in those file systems become invisible to Drupal. To remedy
this, you'll need to copy those files into your S3 bucket.

You are strongly encouraged to use the drush command "drush s3fs-copy-local"
to do this, as it will copy all the files into the correct subfolders in your
bucket, according to your s3fs configuration, and will write them to the
metadata cache. If you don't have drush, you can use the buttons provided on
the S3FS Actions page (admin/config/media/s3fs/actions), though the copy
operation may fail if you have a lot of files, or very large files. The drush
command will cleanly handle any combination of files.

If you're using nginx rather than Apache, you probably have a config block
like this:

location ~ (^/sites/.*/files/imagecache/|^/sites/default/themes/.*/includes/fonts/|^/sites/.*/files/styles/) {
  expires max;
  try_files $uri @rewrite;
}

To make s3fs's custom image derivative mechanism work, you'll need to modify
that regex it with an additional path, like so:

location ~ (^/s3/files/styles/|^/sites/.*/files/imagecache/|^/sites/default/themes/.*/includes/fonts/|^/sites/.*/files/styles/) {
  expires max;
  try_files $uri @rewrite;
}

========================
== AWS Permissions ==
========================
For s3fs to be able to function, the AWS user identified by the configured
credentials should have the following User Policy set:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:ListAllMyBuckets"
            ],
            "Resource": "arn:aws:s3:::*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:*"
            ],
            "Resource": [
                "arn:aws:s3:::<bucket_name>",
                "arn:aws:s3:::<bucket_name>/*"
            ]
        }
    ]
}

This is not the precise list of permissions necessary, but it's broad enough
to allow s3fs to function while being strict enough to restrict access to other
services.

=================================
== Aggregated CSS and JS in S3 ==
=================================
If you want your site's aggregated CSS and JS files to be stored on S3, rather
than the default of storing them on the webserver's local filesystem, you'll
need to do two things:
1) Enable the "Use S3 for public:// files" option in the s3fs coniguration,
   because Drupal always* puts aggregated CSS/JS into the public:// filesystem.
2) Because of the way browsers interpret relative URLs used in CSS files, and
   how they restrict requests made from external javascript files, you'll need
   to set up your webserver as a proxy for those files.

* When you've got a module like "Advanced CSS/JS Aggregation" installed, things
get hairy. For now, that module is not compatible with s3fs public:// takeover.

S3FS will present all css files in the taken over public:// filesystem with the
url prefix /s3fs-css/, and all javascript files with /s3fs-js/. So you need to
set up your webserver to proxy those URLs into your S3 bucket.

For Apache, add this code to the right location* in your server's config:

ProxyRequests Off
SSLProxyEngine on
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
ProxyPass /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
ProxyPassReverse /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
ProxyPass /s3fs-js/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
ProxyPassReverse /s3fs-js/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/

If you're using the "S3FS Root Folder" option, you'll need to insert that
folder before the /s3fs-public/ part of the target URLs. Like so:

ProxyPass /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/YOUR-ROOT-FOLDER/s3fs-public/
ProxyPassReverse /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/YOUR-ROOT-FOLDER/s3fs-public/

If you've set up a custom name for the public folder, you'll need to change the
's3fs-public' part of the URLs above to match your custom folder name.

* The "right location" is implementation-dependent. Normally, placing these
lines at the bottom of your httpd.conf file should be sufficient. However, if
your site is configured to use SSL, you'll need to put these lines in the
VirtualHost settings for both your normal and SSL sites.


For nginx, add this to your server config:

location ~* ^/(s3fs-css|s3fs-js)/(.*) {
  set $s3_base_path 'YOUR-BUCKET.s3.amazonaws.com/s3fs-public';
  set $file_path $2;

  resolver 8.8.4.4 8.8.8.8 valid=300s;
  resolver_timeout 10s;

  proxy_pass http://$s3_base_path/$file_path;
}

Again, be sure to take the S3FS Root Folder setting into account, here.

The /s3fs-public/ subfolder is where s3fs stores the files from the public://
filesystem, to avoid name conflicts with files from the s3:// filesystem.

If you're using the "Use a Custom Host" option to store your files in a
non-Amazon file service, you'll need to change the proxy target to the
appropriate URL for your service.

Under some domain name setups, you may be able to avoid the need for proxying
by having the same domain name as your site also point to your S3 bucket. If
that is the case with your site, enable the "Don't rewrite CSS/JS file paths"
option to prevent s3fs from prefixing the URLs for CSS/JS files.

======================================
== Configuring S3FS in settings.php ==
======================================
If you want to configure S3 File System entirely from settings.php, here are
examples of how to configure each setting:

// All the s3fs config settings start with "s3fs_"
$conf['s3fs_bucket'] = 'YOUR BUCKET NAME';
$conf['s3fs_region'] = 'YOUR REGION';
$conf['s3fs_use_cname'] = TRUE or FALSE;
$conf['s3fs_domain'] = 'cdn.example.com';
$conf['s3fs_domain_root'] = 'none', 'root', 'public', or 'root_public';
$conf['s3fs_domain_s3_private'] = TRUE or FALSE;
$conf['s3fs_use_customhost'] = TRUE or FALSE;
$conf['s3fs_hostname'] = 'host.example.com';
$conf['s3fs_use_versioning'] = TRUE OR FALSE;
$conf['s3fs_cache_control_header'] = 'public, max-age=300';
$conf['s3fs_encryption'] = 'aws:kms';
$conf['s3fs_use_https'] = TRUE or FALSE;
$conf['s3fs_ignore_cache'] = TRUE or FALSE;
$conf['s3fs_use_s3_for_public'] = TRUE or FALSE;
$conf['s3fs_no_rewrite_cssjs'] = TRUE or FALSE;
$conf['s3fs_use_s3_for_private'] = TRUE or FALSE;
$conf['s3fs_root_folder'] = 'drupal-root';
$conf['s3fs_public_folder'] = 's3fs-public';
$conf['s3fs_private_folder'] = 's3fs-private';
$conf['s3fs_presigned_urls'] = "300|presigned-files/*\n60|other-presigned/*";
$conf['s3fs_saveas'] = "videos/*\nfull-size-images/*";
$conf['s3fs_torrents'] = "yarrr/*";


// AWS Credentials use a different prefix than the rest of s3fs's settings
$conf['awssdk2_access_key'] = 'YOUR ACCESS KEY';
$conf['awssdk2_secret_key'] = 'YOUR SECRET KEY';
$conf['awssdk2_use_instance_profile'] = TRUE or FALSE;
$conf['awssdk2_default_cache_config'] = '/tmp/cache';


===========================================
== Upgrading from S3 File System 7.x-1.x ==
===========================================
s3fs 7.x-2.x is not 100% backwards-compatible with 7.x-1.x. Most things will
work the same, but if you were using certain options in 1.x, you'll need to
perform some manual intervention to handle the upgrade to 2.x.

The Partial Refresh Prefix setting has been replaced with the Root Folder
setting. Root Folder fulfills the same purpose, but the implementation is
sufficiently different that you'll need to re-configure your site, and
possibly rearrange the files in your S3 bucket to make it work.

With Root Folder, *everything* s3fs does is contained to the specified folder
in your bucket. s3fs acts like the root folder is the bucket root, which means
that the URIs for your files will not reflect the root folder's existence.
Thus, you won't need to configure anything else, like the "file directory"
setting of file and image fields, to make it work.

This is different from how Partial Refresh Prefix worked, because that prefix
*was* reflected in the uris, and you had to configure your file and image
fields appropriately.

So, when upgrading to 7.x-2.x, you'll need to set the Root Folder option to the
same value that you had for Partial Refresh Prefix, and then remove that folder
from your fields' "File directory" settings. Then, move every file that s3fs
previously put into your bucket into the Root Folder. And if there are other
files in your bucket that you want s3fs to know about, move them into there,
too. Then do a metadata refresh.

==================
== Known Issues ==
==================
Some curl libraries, such as the one bundled with MAMP, do not come
with authoritative certificate files. See the following page for details:
http://dev.soup.io/post/56438473/If-youre-using-MAMP-and-doing-something

Because of a bizarre limitation regarding MySQL's maximum index length for
InnoDB tables, the maximum uri length that S3FS supports is 250 characters.
That includes the full path to the file in your bucket, as the full folder
path is part of the uri.

eAccelerator, a deprecated opcode cache plugin for PHP, is incompatible with
AWS SDK for PHP. eAccelerator will corrupt the configuration settings for
the SDK's s3 client object, causing a variety of different exceptions to be
thrown. If your server uses eAccelerator, it is highly recommended that you
replace it with a different opcode cache plugin, as its development was
abandoned several years ago.

=====================
== Acknowledgments ==
=====================
Special recognition goes to justafish, author of the AmazonS3 module:
http://drupal.org/project/amazons3
S3 File System started as a fork of her great module, but has evolved
dramatically since then, becoming a very different beast. The main benefit of
using S3 File System over AmazonS3 is performance, especially for image-
related operations, due to the metadata cache that is central to S3
File System's operation.

File

README.txt
View source
  1. S3 File System (s3fs) provides an additional file system to your Drupal site,
  2. alongside the public and private file systems, which stores files in Amazon's
  3. Simple Storage Service (S3) (or any S3-compatible storage service). You can set
  4. your site to use S3 File System as the default, or use it only for individual
  5. fields. This functionality is designed for sites which are load-balanced across
  6. multiple servers, as the mechanism used by Drupal's default file systems is not
  7. viable under such a configuration.
  8. =========================================
  9. == Dependencies and Other Requirements ==
  10. =========================================
  11. - Libraries API 2.x - https://drupal.org/project/libraries
  12. - AWS SDK for PHP 2.x - https://github.com/aws/aws-sdk-php/releases
  13. - PHP 5.3.3+ is required. The AWS SDK will not work on earlier versions.
  14. - Your PHP must be configured with "allow_url_fopen = On" in your php.ini file.
  15. Otherwise, PHP will be unable to open files that are in your S3 bucket.
  16. ==================
  17. == Installation ==
  18. ==================
  19. 1) Install Libraries version 2.x from http://drupal.org/project/libraries.
  20. 2) Install the AWS SDK for PHP.
  21. a) If you have drush, you can install the SDK with this command (executed
  22. from the root folder of your Drupal codebase):
  23. drush make --no-core sites/all/modules/s3fs/s3fs.make
  24. b) If you don't have drush, download the SDK from here:
  25. https://github.com/aws/aws-sdk-php/releases/download/2.7.25/aws.zip
  26. Extract that zip file into your Drupal codebase's
  27. sites/all/libraries/awssdk2 folder such that the path to aws-autoloader.php
  28. is: sites/all/libraries/awssdk2/aws-autoloader.php
  29. IN CASE OF TROUBLE DETECTING THE AWS SDK LIBRARY:
  30. Ensure that the awssdk2 folder itself, and all the files within it, can be read
  31. by your webserver. Usually this means that the user "apache" (or "_www" on OSX)
  32. must have read permissions for the files, and read+execute permissions for all
  33. the folders in the path leading to the awssdk2 files.
  34. ====================
  35. == Initial Setup ==
  36. ====================
  37. With the code installation complete, you must now configure s3fs to use your
  38. Amazon Web Services credentials. To do so, store them in the $conf array in
  39. your site's settings.php file (sites/default/settings.php), like so:
  40. $conf['awssdk2_access_key'] = 'YOUR ACCESS KEY';
  41. $conf['awssdk2_secret_key'] = 'YOUR SECRET KEY';
  42. Configure your settings for S3 File System (including your S3 bucket name) at
  43. /admin/config/media/s3fs/settings. You can input your AWS credentials on this
  44. page as well, but using the $conf array is recommended.
  45. You can also configure the rest of your S3 preferences in the $conf array. See
  46. the "Configuring S3FS in settings.php" section below for more info.
  47. ===================== ESSENTIAL STEP! DO NOT SKIP THIS! ======================
  48. With the settings saved, go to /admin/config/media/s3fs/actions to refresh the
  49. file metadata cache. This will copy the filenames and attributes for every
  50. existing file in your S3 bucket into Drupal's database. This can take a
  51. significant amount of time for very large buckets (thousands of files). If this
  52. operation times out, you can also perform it using "drush s3fs-refresh-cache".
  53. Please keep in mind that any time the contents of your S3 bucket change without
  54. Drupal knowing about it (like if you copy some files into it manually using
  55. another tool), you'll need to refresh the metadata cache again. S3FS assumes
  56. that its cache is a canonical listing of every file in the bucket. Thus, Drupal
  57. will not be able to access any files you copied into your bucket manually until
  58. S3FS's cache learns of them. This is true of folders as well; s3fs will not be
  59. able to copy files into folders that it doesn't know about.
  60. ============================================
  61. == How to Configure Your Site to Use s3fs ==
  62. ============================================
  63. Visit the admin/config/media/file-system page and set the "Default download
  64. method" to "Amazon Simple Storage Service"
  65. -and/or-
  66. Add a field of type File, Image, etc. and set the "Upload destination" to
  67. "Amazon Simple Storage Service" in the "Field Settings" tab.
  68. This will configure your site to store new uploaded files in S3. Files which
  69. your site creates automatically (such as aggregated CSS) will still be stored
  70. in the server's local filesystem, because Drupal is hard-coded to use the
  71. public:// filesystem for such files.
  72. However, s3fs can be configured to handle these files, as well. On the s3fs
  73. configuration page (admin/config/media/s3fs) you can enable the "Use S3 for
  74. public:// files" and/or "Use S3 for private:// files" options to make s3fs
  75. take over the job of the public and/or private file systems. This will cause
  76. your site to store newly uploaded/generated files from the public/private file
  77. system in S3 instead of the local file system. However, it will make any
  78. existing files in those file systems become invisible to Drupal. To remedy
  79. this, you'll need to copy those files into your S3 bucket.
  80. You are strongly encouraged to use the drush command "drush s3fs-copy-local"
  81. to do this, as it will copy all the files into the correct subfolders in your
  82. bucket, according to your s3fs configuration, and will write them to the
  83. metadata cache. If you don't have drush, you can use the buttons provided on
  84. the S3FS Actions page (admin/config/media/s3fs/actions), though the copy
  85. operation may fail if you have a lot of files, or very large files. The drush
  86. command will cleanly handle any combination of files.
  87. If you're using nginx rather than Apache, you probably have a config block
  88. like this:
  89. location ~ (^/sites/.*/files/imagecache/|^/sites/default/themes/.*/includes/fonts/|^/sites/.*/files/styles/) {
  90. expires max;
  91. try_files $uri @rewrite;
  92. }
  93. To make s3fs's custom image derivative mechanism work, you'll need to modify
  94. that regex it with an additional path, like so:
  95. location ~ (^/s3/files/styles/|^/sites/.*/files/imagecache/|^/sites/default/themes/.*/includes/fonts/|^/sites/.*/files/styles/) {
  96. expires max;
  97. try_files $uri @rewrite;
  98. }
  99. ========================
  100. == AWS Permissions ==
  101. ========================
  102. For s3fs to be able to function, the AWS user identified by the configured
  103. credentials should have the following User Policy set:
  104. {
  105. "Version": "2012-10-17",
  106. "Statement": [
  107. {
  108. "Effect": "Allow",
  109. "Action": [
  110. "s3:ListAllMyBuckets"
  111. ],
  112. "Resource": "arn:aws:s3:::*"
  113. },
  114. {
  115. "Effect": "Allow",
  116. "Action": [
  117. "s3:*"
  118. ],
  119. "Resource": [
  120. "arn:aws:s3:::",
  121. "arn:aws:s3:::/*"
  122. ]
  123. }
  124. ]
  125. }
  126. This is not the precise list of permissions necessary, but it's broad enough
  127. to allow s3fs to function while being strict enough to restrict access to other
  128. services.
  129. =================================
  130. == Aggregated CSS and JS in S3 ==
  131. =================================
  132. If you want your site's aggregated CSS and JS files to be stored on S3, rather
  133. than the default of storing them on the webserver's local filesystem, you'll
  134. need to do two things:
  135. 1) Enable the "Use S3 for public:// files" option in the s3fs coniguration,
  136. because Drupal always* puts aggregated CSS/JS into the public:// filesystem.
  137. 2) Because of the way browsers interpret relative URLs used in CSS files, and
  138. how they restrict requests made from external javascript files, you'll need
  139. to set up your webserver as a proxy for those files.
  140. * When you've got a module like "Advanced CSS/JS Aggregation" installed, things
  141. get hairy. For now, that module is not compatible with s3fs public:// takeover.
  142. S3FS will present all css files in the taken over public:// filesystem with the
  143. url prefix /s3fs-css/, and all javascript files with /s3fs-js/. So you need to
  144. set up your webserver to proxy those URLs into your S3 bucket.
  145. For Apache, add this code to the right location* in your server's config:
  146. ProxyRequests Off
  147. SSLProxyEngine on
  148. Order deny,allow
  149. Allow from all
  150. ProxyPass /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
  151. ProxyPassReverse /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
  152. ProxyPass /s3fs-js/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
  153. ProxyPassReverse /s3fs-js/ https://YOUR-BUCKET.s3.amazonaws.com/s3fs-public/
  154. If you're using the "S3FS Root Folder" option, you'll need to insert that
  155. folder before the /s3fs-public/ part of the target URLs. Like so:
  156. ProxyPass /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/YOUR-ROOT-FOLDER/s3fs-public/
  157. ProxyPassReverse /s3fs-css/ https://YOUR-BUCKET.s3.amazonaws.com/YOUR-ROOT-FOLDER/s3fs-public/
  158. If you've set up a custom name for the public folder, you'll need to change the
  159. 's3fs-public' part of the URLs above to match your custom folder name.
  160. * The "right location" is implementation-dependent. Normally, placing these
  161. lines at the bottom of your httpd.conf file should be sufficient. However, if
  162. your site is configured to use SSL, you'll need to put these lines in the
  163. VirtualHost settings for both your normal and SSL sites.
  164. For nginx, add this to your server config:
  165. location ~* ^/(s3fs-css|s3fs-js)/(.*) {
  166. set $s3_base_path 'YOUR-BUCKET.s3.amazonaws.com/s3fs-public';
  167. set $file_path $2;
  168. resolver 8.8.4.4 8.8.8.8 valid=300s;
  169. resolver_timeout 10s;
  170. proxy_pass http://$s3_base_path/$file_path;
  171. }
  172. Again, be sure to take the S3FS Root Folder setting into account, here.
  173. The /s3fs-public/ subfolder is where s3fs stores the files from the public://
  174. filesystem, to avoid name conflicts with files from the s3:// filesystem.
  175. If you're using the "Use a Custom Host" option to store your files in a
  176. non-Amazon file service, you'll need to change the proxy target to the
  177. appropriate URL for your service.
  178. Under some domain name setups, you may be able to avoid the need for proxying
  179. by having the same domain name as your site also point to your S3 bucket. If
  180. that is the case with your site, enable the "Don't rewrite CSS/JS file paths"
  181. option to prevent s3fs from prefixing the URLs for CSS/JS files.
  182. ======================================
  183. == Configuring S3FS in settings.php ==
  184. ======================================
  185. If you want to configure S3 File System entirely from settings.php, here are
  186. examples of how to configure each setting:
  187. // All the s3fs config settings start with "s3fs_"
  188. $conf['s3fs_bucket'] = 'YOUR BUCKET NAME';
  189. $conf['s3fs_region'] = 'YOUR REGION';
  190. $conf['s3fs_use_cname'] = TRUE or FALSE;
  191. $conf['s3fs_domain'] = 'cdn.example.com';
  192. $conf['s3fs_domain_root'] = 'none', 'root', 'public', or 'root_public';
  193. $conf['s3fs_domain_s3_private'] = TRUE or FALSE;
  194. $conf['s3fs_use_customhost'] = TRUE or FALSE;
  195. $conf['s3fs_hostname'] = 'host.example.com';
  196. $conf['s3fs_use_versioning'] = TRUE OR FALSE;
  197. $conf['s3fs_cache_control_header'] = 'public, max-age=300';
  198. $conf['s3fs_encryption'] = 'aws:kms';
  199. $conf['s3fs_use_https'] = TRUE or FALSE;
  200. $conf['s3fs_ignore_cache'] = TRUE or FALSE;
  201. $conf['s3fs_use_s3_for_public'] = TRUE or FALSE;
  202. $conf['s3fs_no_rewrite_cssjs'] = TRUE or FALSE;
  203. $conf['s3fs_use_s3_for_private'] = TRUE or FALSE;
  204. $conf['s3fs_root_folder'] = 'drupal-root';
  205. $conf['s3fs_public_folder'] = 's3fs-public';
  206. $conf['s3fs_private_folder'] = 's3fs-private';
  207. $conf['s3fs_presigned_urls'] = "300|presigned-files/*\n60|other-presigned/*";
  208. $conf['s3fs_saveas'] = "videos/*\nfull-size-images/*";
  209. $conf['s3fs_torrents'] = "yarrr/*";
  210. // AWS Credentials use a different prefix than the rest of s3fs's settings
  211. $conf['awssdk2_access_key'] = 'YOUR ACCESS KEY';
  212. $conf['awssdk2_secret_key'] = 'YOUR SECRET KEY';
  213. $conf['awssdk2_use_instance_profile'] = TRUE or FALSE;
  214. $conf['awssdk2_default_cache_config'] = '/tmp/cache';
  215. ===========================================
  216. == Upgrading from S3 File System 7.x-1.x ==
  217. ===========================================
  218. s3fs 7.x-2.x is not 100% backwards-compatible with 7.x-1.x. Most things will
  219. work the same, but if you were using certain options in 1.x, you'll need to
  220. perform some manual intervention to handle the upgrade to 2.x.
  221. The Partial Refresh Prefix setting has been replaced with the Root Folder
  222. setting. Root Folder fulfills the same purpose, but the implementation is
  223. sufficiently different that you'll need to re-configure your site, and
  224. possibly rearrange the files in your S3 bucket to make it work.
  225. With Root Folder, *everything* s3fs does is contained to the specified folder
  226. in your bucket. s3fs acts like the root folder is the bucket root, which means
  227. that the URIs for your files will not reflect the root folder's existence.
  228. Thus, you won't need to configure anything else, like the "file directory"
  229. setting of file and image fields, to make it work.
  230. This is different from how Partial Refresh Prefix worked, because that prefix
  231. *was* reflected in the uris, and you had to configure your file and image
  232. fields appropriately.
  233. So, when upgrading to 7.x-2.x, you'll need to set the Root Folder option to the
  234. same value that you had for Partial Refresh Prefix, and then remove that folder
  235. from your fields' "File directory" settings. Then, move every file that s3fs
  236. previously put into your bucket into the Root Folder. And if there are other
  237. files in your bucket that you want s3fs to know about, move them into there,
  238. too. Then do a metadata refresh.
  239. ==================
  240. == Known Issues ==
  241. ==================
  242. Some curl libraries, such as the one bundled with MAMP, do not come
  243. with authoritative certificate files. See the following page for details:
  244. http://dev.soup.io/post/56438473/If-youre-using-MAMP-and-doing-something
  245. Because of a bizarre limitation regarding MySQL's maximum index length for
  246. InnoDB tables, the maximum uri length that S3FS supports is 250 characters.
  247. That includes the full path to the file in your bucket, as the full folder
  248. path is part of the uri.
  249. eAccelerator, a deprecated opcode cache plugin for PHP, is incompatible with
  250. AWS SDK for PHP. eAccelerator will corrupt the configuration settings for
  251. the SDK's s3 client object, causing a variety of different exceptions to be
  252. thrown. If your server uses eAccelerator, it is highly recommended that you
  253. replace it with a different opcode cache plugin, as its development was
  254. abandoned several years ago.
  255. =====================
  256. == Acknowledgments ==
  257. =====================
  258. Special recognition goes to justafish, author of the AmazonS3 module:
  259. http://drupal.org/project/amazons3
  260. S3 File System started as a fork of her great module, but has evolved
  261. dramatically since then, becoming a very different beast. The main benefit of
  262. using S3 File System over AmazonS3 is performance, especially for image-
  263. related operations, due to the metadata cache that is central to S3
  264. File System's operation.