Apostrophe CMS With Wasabi
    • 13 Jun 2024
    • 1 Minute to read
    • PDF

    Apostrophe CMS With Wasabi

    • PDF

    Article summary

    How do I use Apostrophe CMS with Wasabi?

    Apostrophe CMS can be used with Wasabi using the config attributes below. All attributes regarding bucket name and keys refer to your preferred Wasabi bucket name and your Wasabi access & secret keys.  

    APOS_S3_BUCKET=YOUR-bucket-name

    APOS_S3_SECRET=YOUR-access-key

    APOS_S3_KEY=YOUR-secret-key

    APOS_S3_ENDPOINT=s3.wasabisys.com

    If you wish to deploy this in a Heroku environment, the details are below. 

    heroku config:set APOS_S3_BUCKET=YOUR-bucket-name

    heroku config:set APOS_S3_SECRET=YOUR-access-key

    heroku config:set APOS_S3_KEY=YOUR-secret-key

    heroku config:set APOS_S3_ENDPOINT=s3.wasabisys.com

    As an optional step, if you wish to add a bucket policy to prevent non-SSL (http) access, you can use the syntax below.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "AWS": [
              "*"
            ]
          },
          "Action": "s3:Get*",
          "Resource": "arn:aws:s3:::YOUR-BUCKET"
        },
        {
          "Effect": "Deny",
          "Principal": "*",
          "Action": "*",
          "Resource": "arn:aws:s3:::YOUR-BUCKET",
          "Condition": {
            "Bool": {
              "aws:SecureTransport": "false"
            }
          }
        }
      ]
    }
    
     
    
    Forcing UPLOADFS to use https only:
    
     
    
    in app.js:
    
     
    
    // apostrophe configruation.....
    
    modules: {
    
     
    
    //other modules.....
    
    
        'apostrophe-attachments': {
          uploadfs: {
            https: true
          }
        },
    
     
    
    }

    Note that this example discusses the use of Wasabi's us-east-1 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article.

    Many thanks to Felix from the Apostrophe community for his contributions in this area.