leoloso/awseb-le-wp-install

Quickly launch WordPress in a AWS Elastic Beanstalk single instance with Let's Encrypt

v0.1 2019-08-02 12:40 UTC

This package is auto-updated.

Last update: 2024-10-29 05:59:52 UTC


README

Bootstrapper to launch WordPress in an AWS Elastic Beanstalk single instance with Let's Encrypt, configurable through environment variables

Description

This project is ready to be deployed to Elastic Beanstalk under a single instance, featuring:

  • WordPress pre-installed, admin area accessible under /wp/wp-admin/
  • HTTPS through Let's Encrypt
  • Cronjob to automatically renew the Let's Encrypt certificate
  • All information is set through environment variables

Usage

Via Composer:

composer create-project leoloso/awseb-le-wp-install

After bootstrapping this project, add your own code, and deploy!

Environment variables

Define the following environment variables in the Elastic Beanstalk application's configuration (under entry "Software"), or using CLI command eb setenv:

  1. WordPress configuration (wp-config.php):
DB_NAME={YOUR_SITE_DB_NAME} #eg: database
DB_USER={YOUR_SITE_DB_USER} #eg: admin
DB_PASSWORD={YOUR_SITE_DB_PASSWORD} #eg: sADF!kl9diq@#Sjfk
DB_HOST={YOUR_SITE_DB_HOST} #eg: 127.0.0.1
SITE_URL_WITHOUT_HTTP={YOUR_SITE_URL_WITHOUT_HTTP} #eg: yourdomain.com
SITE_URL_WITH_HTTP={YOUR_SITE_URL_WITH_HTTP} #eg: https://yourdomain.com
SITE_NAME="{YOUR_SITE_NAME}" #eg: "My awesome website"
ADMIN_USER={ADMIN_USER} #eg: admin
ADMIN_PASSWORD={ADMIN_PASSWORD} #eg: JKo$@sfjASD00w
ADMIN_EMAIL={ADMIN_EMAIL} #eg: pedro@example.com

To set the SALT keys there are two alternatives:

I. Set random values through environment variable SHUFFLE_SALT_KEYS:

SHUFFLE_SALT_KEYS=true

II. Set the corresponding values directly:

# Obtain random values from https://api.wordpress.org/secret-key/1.1/salt
AUTH_KEY={YOUR_AUTH_KEY}
SECURE_AUTH_KEY={YOUR_SECURE_AUTH_KEY}
LOGGED_IN_KEY={YOUR_LOGGED_IN_KEY}
NONCE_KEY={YOUR_NONCE_KEY}
AUTH_SALT={YOUR_AUTH_SALT}
SECURE_AUTH_SALT={YOUR_SECURE_AUTH_SALT}
LOGGED_IN_SALT={YOUR_LOGGED_IN_SALT}
NONCE_SALT={YOUR_NONCE_SALT}
  1. Let's Encrypt configuration:
LETSENCRYPT_DOMAIN={YOUR_LETSENCRYPT_DOMAIN} # Domain to register: yourdomain.com
LETSENCRYPT_EMAIL={YOUR_EMAIL} # eg: pedro@example.com
LETSENCRYPT_OPTIONS={YOUR_LETSENCRYPT_OPTIONS} # Can be used to pass "--dry-run" to avoid re-registering the certificate when launching a new server instance

Credits

The Let's Encrypt configuration was mostly taken from Radek Zajkowski's article Elastic Beanstalk and Let’s Encrypt.

Installing WordPress through Composer and WP-CLI is based another project of mine.

License

The MIT License (MIT). Please see License File for more information.