A tool that migrates an existing Wordpress site into a fully functioning Serverless site, powered by AWS (Cloudfront, API Gateway, Lambda, S3).
Pressless will:
domain
command)copydb
command)deploy
command)Pressless requires nodejs-6.x
or higher to run.
Pressless also requires AWS API credentials that have the following policy grant (least privilege):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"acm:ListCertificates",
"cloudformation:CreateStack",
"cloudformation:DescribeStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResources",
"cloudformation:ValidateTemplate",
"cloudfront:GetDistribution",
"cloudfront:UpdateDistribution",
"logs:DescribeLogGroups",
"logs:CreateLogGroup",
"route53:ListHostedZones",
"route53:ChangeResourceRecordSets",
"s3:CreateBucket"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iam:*",
"Resource": "arn:aws:iam::*:role/pl-*"
},
{
"Effect": "Allow",
"Action": [
"apigateway:GET",
"apigateway:POST",
"apigateway:PUT",
"apigateway:DELETE"
],
"Resource": [
"arn:aws:apigateway:*::/domainnames",
"arn:aws:apigateway:*::/domainnames/*",
"arn:aws:apigateway:*::/domainnames/*/*",
"arn:aws:apigateway:*::/restapis",
"arn:aws:apigateway:*::/restapis/*",
"arn:aws:apigateway:*::/restapis/*/*"
]
},
{
"Effect": "Allow",
"Action": [
"lambda:Get*",
"lambda:List*",
"lambda:CreateFunction"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"lambda:AddPermission",
"lambda:CreateAlias",
"lambda:DeleteFunction",
"lambda:InvokeFunction",
"lambda:PublishVersion",
"lambda:RemovePermission",
"lambda:Update*"
],
"Resource": "arn:aws:lambda:*:*:function:pl-*"
},
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::pressless-deploys-*"
},
{
"Effect": "Allow",
"Action": [
"cloudformation:UpdateStack",
"cloudformation:DeleteStack"
],
"Resource": "arn:aws:cloudformation:*:*:stack/pl-*"
}
]
}
If you wish to utilize RDS IAM Authentication so that you don't have to hard code your database password into wp-config.php
, you will also need to create an IAM authenticatable user on the RDS instance (CREATE USER [USERNAME] IDENTIFIED WITH AWSAuthenticationPlugin as 'RDS';
) along with the necessary grants. Then just specify an SSL connection to MySQL using the newly created user when you run pressless setup
. For example:
pressless setup -c [AWS_ACM_CERTIFICATE] -d 'mysql+ssl://[USERNAME]@[RDS_HOST]/[DATABASE]' [DOMAIN] [S3_WEBSITE_BUCKET]
Install this project:
npm install -g pressless
pressless
___
/\_ \
_____ _ __ __ ____ ____ \//\ \ __ ____ ____
/\ '__`\ /\`'__\ /'__`\ /',__\ /',__\ \ \ \ /'__`\ /',__\ /',__\
\ \ \L\ \\ \ \/ /\ __/ /\__, `\/\__, `\ \_\ \_ /\ __/ /\__, `\/\__, `\
\ \ ,__/ \ \_\ \ \____\\/\____/\/\____/ /\____\\ \____\\/\____/\/\____/
\ \ \/ \/_/ \/____/ \/___/ \/___/ \/____/ \/____/ \/___/ \/___/
\ \_\ ---helping wordpress cost less---
\/_/
Usage: [options] [command]
Commands:
setup [options] <domain> <website_bucket> Setup pressless configuration and install dependencies
domain Create AWS ApiGateway custom domain
copydb <dsn> Copy database
exportdb <db_username> Export the Pressless database
deploy [options] Deploy Wordpress via Serverless
copyuploads [options] Copy "wp-content/uploads" to S3
logs [options] Watch lambda logs
test <stage> <request_path> Test the Serverless function
warm Warm the S3 website bucket cache by crawling all pages
invalidate Invalidate the S3 website bucket cache (except `wp-content/uploads`)
Options:
-h, --help output usage information