Coder Social home page Coder Social logo

staticpress2019-s3's Introduction

🗽StaticPress2019-S3🗿

Test Build Status PHP from Travis config

Uploads dumped static site by StaticPress into S3.

Description

StaticPress2019-S3 transforms your WordPress into static websites and blogs.

This plugin is a revival of StaticPress-S3 by CI / CD pipeline and TDD, and maintained by volunteers instead of the original no longer maintained.

Installation

  1. Sign into your WordPress admin dashboard.
  2. Click [Plugins] -> [Add New].
  3. Search by keyword: staticpress2019.
  4. Click [Install Now] button for StaticPress2019 and StaticPress2019-S3.
  5. Click [Activate] button for StaticPress2019 and StaticPress2019-S3.

AWS settings

IAM User

Create IAM User for deploy and issue its access key. Then, attach following IAM policy:

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

S3 bucket policy

Create S3 bucket for hosting, set bucket object ownership control as BucketOwnerEnforced, and set bucket policy as following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<your-aws-account-id>:user/<your-iam-user-name>"
            },
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::<your-bucket-name>"
        },
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<your-aws-account-id>:user/<your-iam-user-name>"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::<your-bucket-name>/*"
        }
    ]
}

Note: Blocking all public access doesn't reject upload.

How to use

  1. Sign into your WordPress admin dashboard.
  2. Click [StaticPress2019] -> [StaticPress2019 Options].
  3. Set [Static URL] as URL to publish in S3.
  4. Set [Save DIR (Document root)] as appropriate directory to dump static files.
  5. Click [Save Changes].
  6. Set [AWS Access Key], [AWS Secret Key], [AWS Region] in [StaticPress S3 Option].
  7. Click [Save Changes].
  8. Choose [S3 Bucket].
  9. Click [Save Changes].
  10. Click [StaticPress2019] -> [StaticPress2019].
  11. Click [Rebuild].

Frequently Asked Questions

Why mime type of file in S3 is not correct?

This plugin uses magic file to detect mime type. If mime type is not correct, you can specify different magic file from default by using environment variable MAGIC.

What is [Put Object ACL] in StaticPress2019 Options form for?

It's just for backward compatibility. New user shouldn't use it:

Disabling ACLs for all new buckets and enforcing Object Ownership - Amazon Simple Storage Service

Updated user may need to use it. According to the old specifications, StaticPress2019-S3 put object ACL when upload static file to S3.

staticpress2019-s3's People

Contributors

yukihiko-shinoda avatar sakakinox avatar wokamoto avatar loadoff avatar hajihaji9988 avatar yuiwasaki avatar

Watchers

 avatar

Forkers

sakakinox

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.