Skip to content
forked from roots/bedrock

WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure

Notifications You must be signed in to change notification settings

amitrahav/bedrock

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

414 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bedrock on aws ElastickBeanstalk multi containers Docker

Packagist Build Status

Bedrock is a modern WordPress stack that helps you get started with the best development tools and project structure.

Much of the philosophy behind Bedrock is inspired by the Twelve-Factor App methodology including the WordPress specific version.

Features

  • Better folder structure (adding site/ folder to separate php application from deployment configurations)
  • Dependency management with Composer
  • Easy WordPress configuration with environment specific files
  • Environment variables with Dotenv
  • Autoloader for mu-plugins (use regular plugins as mu-plugins)
  • Enhanced security (separated web root and secure passwords with wp-password-bcrypt)

See a complete working example in the roots-example-project.com repo.

Software Requirements

Deployment Requirements

  • Aws account
  • Configured pipeline with:
    • CodeCommit.
    • CodeBuild on a docker environment can run composer.
    • Elastic Container Service with good php-fpm image - to run composer and php-fpm on.
    • Elastic Beanstalk on a multi docker environment.

Installation

  1. Create a new project in a new folder for your project:

composer create-project roots/bedrock your-project-folder-name

  1. Update environment variables in .env file - mostly for local development:
  • RDS_DB_NAME - Database name
  • RDS_USERNAME - Database user
  • RDS_PASSWORD - Database password
  • RDS_HOSTNAME - Database host
  • WP_ENV - Set to environment (development, staging, production)
  • WP_HOME - Full URL to WordPress home (http://example.com)
  • WP_SITEURL - Full URL to WordPress including subdirectory (http://example.com/wp)
  • AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY, AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT, NONCE_SALT

If you want to automatically generate the security keys (assuming you have wp-cli installed locally) you can use the very handy wp-cli-dotenv-command:

  wp package install aaemnnosttv/wp-cli-dotenv-command

  wp dotenv salts regenerate

Or, you can cut and paste from the Roots WordPress Salt Generator.

On ElasticBeanstalk multi containers environment, env vars are transferd throgh RDS data tier and custome env vars you can insert on ebstalk->environment->config->softwer configurations. so on this version of bedrock - the env vars are ElasticBeanstalk multi containers Ready

  1. Add theme(s) in web/app/themes as you would for a normal WordPress site.

  2. Set your site vhost document root to /path/to/site/web/ (/path/to/site/current/web/ if using deploys)

  3. Access WP admin at http://example.com/wp/wp-admin

Deploys

defining CodePipeline

  • selecting codeCommit as a source (or any other source supported and available).
  • running codeBuild with buildspec.yml - IMPORTANT! configure codeBuild to run on a php-fpm image with composer install on it.
  • configure ElasticBeanstalk to use multi containers docker environment - IMPORTANT! change Dockerrunaws.json file with the right docker image details, should look something like this: 123456789101.dkr.ecr.eu-wast-1.amazonaws.com/php-fpm:latest
  • push code to codeCommit to start deployment process.

How does it works?

  1. codeBuild install all composer dependencies and create artifact that include all files necessary to run the software.
  2. ElasticBeanstalk deploys all those files into a host.
  3. php-fpm docker copy all site files and run php-fpm.
  4. nginx docker copy all site and config files and run nginx so it can serve all existing files.

Static files

amazon web services wp plugin is required by default by composer.json, it's critical to configure it. it's recommended to serve files with aws cloudFront, but also possible with simple aws S3 with hosting permission.

Documentation

Bedrock documentation is available at https://roots.io/bedrock/docs/.

BeanStalk multi containers docker documentation is available at http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_docker_ecs.html.

Contributing

Contributions are welcome from everyone. We have contributing guidelines to help you get started.

Community

Keep track of development and community news.

About

WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%