Coder Social home page Coder Social logo

cdk-serverless-wordpress's Introduction

cdk-serverless-wordpress

what does this repo do

this project help to run the serverless wordpress with AWS Lambda and AWS EFS

init CDK project

  1. run below commands to install cdk components
npm install @aws-cdk/aws-ec2 @aws-cdk/aws-efs @aws-cdk/aws-lambda @aws-cdk/aws-rds @aws-cdk/aws-elasticloadbalancingv2 @aws-cdk/aws-elasticloadbalancingv2-targets @aws-cdk/aws-secretsmanager path
  1. find the cdk.json file, replace the domainName, keyName, dbPassword with your own value.
domainName your domain name, which used to validate the certificate
keyName the key pairs which used to login to the EC2
dbPassword the rds password
  1. compile and deploy
npm run build
cdk deploy

remeber use us-east-1 region, open aws console, find Certificate Manager service and validate the certificate with DNS name, you can refer this doc https://docs.aws.amazon.com/zh_cn/acm/latest/userguide/gs-acm-validate-dns.html

you can find the EFS ID at the output

  1. Launch EC2 and install wordpress on EFS
sudo mount -t efs YOUR_EFS_ID:/ /mnt/efs

you can download the wordpress package and unzip them into path /mnt/efs/wordpress then edit below items in the wp-config.php file

define( 'DB_NAME', getenv('DB_NAME') );
define( 'DB_USER', getenv('DB_USER') );
define( 'DB_PASSWORD', getenv('DB_PASSWORD') );
define( 'DB_HOST', getenv('DB_HOST') );
define('WP_SITEURL', 'https://' . getenv('HTTP_HOST') );
define('WP_HOME', 'https://' . getenv('HTTP_HOST') );
$_SERVER['HTTP_HOST'] = getenv('HTTP_HOST') ;

you can also download the source from below github https://github.com/forhead/wordpressForLambda.git

  1. launch the serverless wordpress with alb DNS name, you can config the dns on your own domain

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

cdk-serverless-wordpress's People

Contributors

amazon-auto avatar forhead 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.