GithubHelp home page GithubHelp logo

punkch / craft-remote-assets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from servdhost/craft-remote-assets

0.0 2.0 0.0 33 KB

Allow Craft CMS 3 control panel assets to be hosted remotely for load balanced environments

License: MIT License

PHP 100.00%

craft-remote-assets's Introduction

Craft Remote Assets plugin for Craft CMS 3.x

Move CP assets to an external filesystem such as S3

Props to yii-cdn-asset-management-library

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require servd/craft-remote-assets
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Craft Remote Assets.

Craft Remote Assets Overview

In a load balanced environment with multiple PHP servers you can't serve Yii bundles or thumbnails from the local file system. This plugin publishes CP bundles and asset thumbnails to S3 instead. Tested in a multi-PHP, single nginx K8s cluster with no volume mounts.

Configuring Craft Remote Assets

Create a file at config/craft-remote-assets.php which looks like this:

<?php

return [
    'use' => 's3Config',
    's3Config' => [
        'region' => 'eu-west-1',
        'bucket' => 'yourbucketname',
        'root' => 'defaultKeyPrepend',
        'key' => 's3APIKey',
        'secret' => 's3APISecret'
    ],
    'gsConfig' => [
      'bucket' => 'yourbucketname',
      'root' => 'defaultKeyPrepend',
      'projectId' => 'yourProjectId',
      'keyFilePath' => '/path/to/serviceworker/creds/file.json'
    ]
];

Your S3 API key will need to be linked to an IAM user with bucket read and write permissions.

Your Google Cloud cred sfile will need to belong to a service worker with read and write access to the bucket

Using Craft Remote Assets

Install it. You're done.

Brought to you by Servd

craft-remote-assets's People

Contributors

mattgrayisok avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.