• Document Up to Date
  • Updated On 4.0.3

Blob Stores Configuration

The Blob Stores configuration file allows you to configure 0 or more stores for assets with the corresponding information required by the store being used. To modify the Blob Stores configuration, click on projectTools from the bottom of the Sidebar, then click on Configuration and select Blob Stores from the list.

Configurations - Open Blob Stores Configuration


Here’s a sample Blob Stores Configuration file (click on the triangle on the left to expand/collapse):

Sample "blob-stores-config.xml"
 1<?xml version="1.0" encoding="UTF-8"?>
 3  ~ Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved.
 4  ~
 5  ~ This program is free software: you can redistribute it and/or modify
 6  ~ it under the terms of the GNU General Public License as published by
 7  ~ the Free Software Foundation, either version 3 of the License, or
 8  ~ (at your option) any later version.
 9  ~
10  ~ This program is distributed in the hope that it will be useful,
11  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
13  ~ GNU General Public License for more details.
14  ~
15  ~ You should have received a copy of the GNU General Public License
16  ~ along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  -->
20    Blob stores configuration file.
22    For every store you need to specify:
23    <blobStore>
24        <id/>
25        <type/>
26        <pattern/>
27        <mappings>
28            <mapping>
29                <publishingTarget/>
30                <storeTarget/>
31                <prefix/>
32            </mapping>
33        </mappings>
34        <configuration/>
35    </blobStore>
37    id:	a unique id for the store
38    type: the type of store to use
39    pattern: the regex to match file paths
40    mappings.mapping.publishingTarget: the name of the publishing storeTarget (preview, staging, live)
41    mappings.mapping.storeTarget: the name of the storeTarget inside the store
42    mappings.mapping.prefix: the prefix to use for all paths (optional)
43    configuration: configuration specific for the store type
45   Every store can require additional properties.
48    <!--
49      AWS S3 Store
51      Configuration properties:
53        <credentials>
54            <accessKey/>
55            <secretKey/>
56        </credentials>
57        <region/>
58        <endpoint/>
59        <pathStyleAccess/>
61        credentials.accessKey: AWS access key (optional)
62        credentials.secretKey: AWS secret key (optional)
63        region: AWS region for the service (optional)
64        pathStyleAccess: indicates if path style access should be used for all requests (defaults to false)
66      -->
68    <blobStore>
69        <id>s3-store</id>
70        <type>s3BlobStore</type>
71        <pattern>/static-assets/s3/.*</pattern>
72        <mappings>
73            <mapping>
74                <publishingTarget>preview</publishingTarget>
75                <storeTarget>my-authoring-bucket</storeTarget>
76                <prefix>sandbox</prefix>
77            </mapping>
78            <mapping>
79                <publishingTarget>staging</publishingTarget>
80                <storeTarget>my-authoring-bucket</storeTarget>
81                <prefix>staging</prefix>
82            </mapping>
83            <mapping>
84                <publishingTarget>live</publishingTarget>
85                <storeTarget>my-delivery-bucket</storeTarget>
86            </mapping>
87        </mappings>
88        <configuration>
89            <credentials>
90                <accessKey>xxxxxxxxx</accessKey>
91                <secretKey>xxxxxxxxx</secretKey>
92            </credentials>
93            <region>us-west-1</region>
94            <pathStyleAccess>true</pathStyleAccess>
95        </configuration>
96    </blobStore>

For better security and control, we recommend setting an AWS profile via the crafter-setenv.sh file instead of configuring the encrypted credentials in the blob stores configuration file. This allows you to have an IAM user per developer, which is a better approach than a single user whose credentials are included (encrypted) in the configuration file. In this way, if you need to rotate or remove the credentials of a single user, the access of other users won’t be affected.

To set an AWS profile, using your favorite editor, open CRAFTER_HOME/bin/crafter-setenv.sh and add the following:


where YOUR_AWS_PROFILE is the AWS profile you wish to use for the blob store. See here for more information on configuring AWS profiles.

When using an AWS profile, you can now remove the <credentials /> section in your blob stores configuration file.

Remember to restart your CrafterCMS install for the changes you made to take effect.

See Publishing Assets in External Storage for an example of using the blob stores configuration

Using AWS Service Roles

CrafterCMS supports AWS access without using access/secret keys, by setting AWS service roles on your machine

Simply follow the instructions here for attaching an IAM role to your instance: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#attach-iam-role

Remember to remove the <credentials /> section in your blob stores configuration file.